Skip to content

Commit 2cdeefd

Browse files
authored
Fix NumberOfExperimentsCondition (#470)
* debug NumberOfExperimentsCondition * Update test_conditions.py * Update test_stepwise.py
1 parent 5e46d94 commit 2cdeefd

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

bofire/data_models/strategies/stepwise/conditions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def evaluate(self, domain: Domain, experiments: Optional[pd.DataFrame]) -> bool:
3333
n_experiments = len(
3434
domain.outputs.preprocess_experiments_all_valid_outputs(experiments),
3535
)
36-
return n_experiments <= self.n_experiments
36+
return n_experiments < self.n_experiments
3737

3838

3939
class AlwaysTrueCondition(SingleCondition, EvaluateableCondition):

tests/bofire/strategies/stepwise/test_conditions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def test_RequiredExperimentsCondition():
88
benchmark = Himmelblau()
9-
experiments = benchmark.f(benchmark.domain.inputs.sample(3), return_complete=True)
9+
experiments = benchmark.f(benchmark.domain.inputs.sample(2), return_complete=True)
1010
condition = data_models.NumberOfExperimentsCondition(n_experiments=3)
1111
assert condition.evaluate(benchmark.domain, experiments=experiments) is True
1212
experiments = benchmark.f(benchmark.domain.inputs.sample(10), return_complete=True)

tests/bofire/strategies/stepwise/test_stepwise.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_StepwiseStrategy_invalid_AlwaysTrue():
9191

9292
@pytest.mark.parametrize(
9393
"n_experiments, expected_strategy",
94-
[(5, strategies.RandomStrategy), (10, strategies.SoboStrategy)],
94+
[(5, strategies.RandomStrategy), (9, strategies.SoboStrategy)],
9595
)
9696
def test_StepWiseStrategy_get_step(n_experiments, expected_strategy):
9797
benchmark = Himmelblau()

0 commit comments

Comments
 (0)