diff --git a/AcquistionFunctions/PreferenceExpectedImprovement.py b/AcquistionFunctions/PreferenceExpectedImprovement.py index b69595c..829b06b 100644 --- a/AcquistionFunctions/PreferenceExpectedImprovement.py +++ b/AcquistionFunctions/PreferenceExpectedImprovement.py @@ -22,10 +22,19 @@ class PreferenceExpectedImprovement: pass def rejection_sampling(self): - samples = np.empty((self.nr_samples, self.nr_dims)) - i = 0 - while i < self.nr_samples: - pass + samples = np.empty((0, self.nr_dims)) + while samples.shape[0] < self.nr_samples: + # sample from the multi variate gaussian distribution + sample = self.rng.multivariate_normal( + self.proposal_model_mean, + self.proposal_model_covariance + ) + + # check if the sample is within the bounds + if np.all(sample >= self.lower_bound) and np.all(sample <= self.upper_bound): + samples = np.append(samples, [sample], axis=0) + + return samples def expected_improvement(self):