Skip to content

[Bug]: parameter_constraints does not support RangeParameterConfig #4905

@AlbanMor

Description

@AlbanMor

What happened?

Trying:
client.configure_experiment(parameters=[x1,x2,x3,x4,x5], parameter_constraints=[upper_constraint, lower_constraint])

I get the following error:

in validate_constraint_parameters(parameters)
for parameter in parameters:
if not isinstance(parameter, RangeParameter):
raise ValueError(
"All parameters in a parameter constraint must be RangeParameters."
)
Log parameters require a non-linear transformation, and Ax
models only support linear constraints.
if isinstance(parameter, RangeParameter) and parameter.log_scale is True:

ValueError: All parameters in a parameter constraint must be RangeParameters.

I believe this is due to the fact that in Ax 1.2.1 we use RangeParameterConfig and not RangeParameter

Please provide a minimal, reproducible example of the unexpected behavior.

X1 = RangeParameterConfig(name="X1", parameter_type="float", bounds=(80, 175))
X2 = RangeParameterConfig(name="X2", parameter_type="float", bounds=(9,12),step_size=1)
X3 = RangeParameterConfig(name="X3", parameter_type="float", bounds=(600, 800))
X4 = RangeParameterConfig(name="X4", parameter_type="float", bounds=(180, 196))
X5 = RangeParameterConfig(name="X5", parameter_type="float", bounds=(1300, 1620), step_size=20)

upper_constraint = 'X1 - 25.667X2 <= - 133'
lower_constraint = 'X1 - 20
X2 >= - 100'

#Initialize Client
client = Client()
#Configure Experiment and Optimization
client.configure_experiment(parameters=[X1, X2, X3, X4, X5],
parameter_constraints=[upper_constraint, lower_constraint])

Please paste any relevant traceback/logs produced by the example provided.

Ax Version

1.2.1

Python Version

3.13

Operating System

MS

(Optional) Describe any potential fixes you've considered to the issue outlined above.

No response

Pull Request

None

Code of Conduct

  • I agree to follow Ax's Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions