From 41803cc317a237abc3ff3be20dcb064beeae52e0 Mon Sep 17 00:00:00 2001 From: nabenabe0928 Date: Wed, 4 Dec 2024 13:57:58 +0100 Subject: [PATCH] Add the constraint split for no feasible observations --- package/samplers/ctpe/sampler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/samplers/ctpe/sampler.py b/package/samplers/ctpe/sampler.py index ca55c0e7..35c1db2b 100644 --- a/package/samplers/ctpe/sampler.py +++ b/package/samplers/ctpe/sampler.py @@ -109,8 +109,8 @@ def _build_parzen_estimators_for_constraints_and_get_quantiles( mpes_below: list[_ParzenEstimator] = [] mpes_above: list[_ParzenEstimator] = [] quantiles: list[float] = [] - for constraint_vals in constraints_vals.T: - is_satisfied = constraint_vals <= 0 + for cstr_vals in constraints_vals.T: + is_satisfied = np.logical_or(cstr_vals <= 0, cstr_vals == max(cstr_vals)) satisfied_trials = [t for t, include in zip(trials, is_satisfied) if include] unsatisfied_trials = [t for t, exclude in zip(trials, is_satisfied) if not exclude] mpes_below.append(