From 6912d455487886e952617f6e74fdc926c94b959d Mon Sep 17 00:00:00 2001 From: Neal Kesterton Date: Sun, 1 Dec 2024 14:55:39 +0000 Subject: [PATCH 1/2] Initial fix to comparison --- smt/sampling_methods/lhs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smt/sampling_methods/lhs.py b/smt/sampling_methods/lhs.py index 4fc3c6f49..93806511a 100644 --- a/smt/sampling_methods/lhs.py +++ b/smt/sampling_methods/lhs.py @@ -211,7 +211,7 @@ def _maximinESE( hist_T.extend(inner_loop * [T]) hist_proba.extend(inner_loop * [p_accpt]) - if PhiP_best - PhiP_oldbest < tol: + if PhiP_oldbest - PhiP_best > tol: # flag_imp = 1 if p_accpt >= 0.1 and p_imp < p_accpt: T = 0.8 * T From 0ec4c22ece874fa7f83c6028c4ba27ce2d98b86b Mon Sep 17 00:00:00 2001 From: Neal Kesterton Date: Sun, 1 Dec 2024 20:13:04 +0000 Subject: [PATCH 2/2] Changed test cases reliant on lhs ese optimisation results --- smt/applications/tests/test_ego.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/smt/applications/tests/test_ego.py b/smt/applications/tests/test_ego.py index 21bb01e5e..f1f8a8a1f 100644 --- a/smt/applications/tests/test_ego.py +++ b/smt/applications/tests/test_ego.py @@ -1119,7 +1119,7 @@ def f_obj(X): LHS, design_space, criterion="ese", random_state=random_state ) Xt = sampling(n_doe) - self.assertAlmostEqual(np.sum(Xt), 28.568852027679586, delta=1e-4) + self.assertAlmostEqual(np.sum(Xt), 33.56885202767958, delta=1e-4) Xt = np.array( [ [0.37454012, 1.0], @@ -1151,8 +1151,8 @@ def f_obj(X): n_start=25, ) x_opt, y_opt, dnk, x_data, y_data = ego.optimize(fun=f_obj) - self.assertAlmostEqual(np.sum(y_data), 7.8471910288712, delta=1e-4) - self.assertAlmostEqual(np.sum(x_data), 34.81192549, delta=1e-4) + self.assertAlmostEqual(np.sum(y_data), 8.846225742003778, delta=1e-4) + self.assertAlmostEqual(np.sum(x_data), 41.81192549000013, delta=1e-4) def test_ego_gek(self): ego, fun = self.initialize_ego_gek()