-
Notifications
You must be signed in to change notification settings - Fork 358
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
I set a constraint that four parameters must sum to <= 1 and the first trial generated sets all parameters to 0.5, violating this constraint. (on ax-platform v1.0.0)
Please provide a minimal, reproducible example of the unexpected behavior.
Code:
from ax.api.client import Client
from ax.api.configs import RangeParameterConfig
parameter_names = [f'x_{i}' for i in range(4)]
parameters = [
RangeParameterConfig(
name=x,
bounds=(0.0, 1.0),
parameter_type="float",
) for x in parameter_names]
sum_constraint = " + ".join(parameter_names) + " <= 1.0"
client = Client()
client.configure_experiment(
parameters=parameters,
parameter_constraints=[sum_constraint],
)
client.configure_optimization(objective="objective")
print(sum_constraint)
print(client._experiment.search_space.parameter_constraints)
trials = client.get_next_trials(max_trials=3)
for trial_index, trial_parameters in trials.items():
print(trial_index, trial_parameters)
print(client._experiment.search_space.parameter_constraints[0].check(trial_parameters))
Output:
x_0 + x_1 + x_2 + x_3 <= 1.0
[ParameterConstraint(1.0*x_0 + 1.0*x_1 + 1.0*x_2 + 1.0*x_3 <= 1.0)]
0 {'x_0': 0.5, 'x_1': 0.5, 'x_2': 0.5, 'x_3': 0.5}
False
1 {'x_0': 0.07523129135370255, 'x_1': 0.07053725980222225, 'x_2': 0.32778964564204216, 'x_3': 0.3629995724186301}
True
2 {'x_0': 0.12477120012044907, 'x_1': 0.13883846905082464, 'x_2': 0.11183641757816076, 'x_3': 0.012117702513933182}
True
Please paste any relevant traceback/logs produced by the example provided.
Ax Version
1.0.0
Python Version
3.10.12
Operating System
NAME="Ubuntu" VERSION="22.04.2 LTS (Jammy Jellyfish)"
(Optional) Describe any potential fixes you've considered to the issue outlined above.
No response
Pull Request
Yes
Code of Conduct
- I agree to follow Ax's Code of Conduct
Balandat
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working