Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter constraint with square roots #816

Closed
EvanClaes opened this issue Feb 22, 2022 · 2 comments
Closed

Parameter constraint with square roots #816

EvanClaes opened this issue Feb 22, 2022 · 2 comments
Labels
wishlist Long-term wishlist feature requests

Comments

@EvanClaes
Copy link

Hi all,

I'm trying to solve a multi-objective optimization problem that has a relatively complex parameter constraint involving squares and square roots. So far I have failed to do this as the API does not seem to accept np.square for example.

Here is the code I'm using:

ax_client.create_experiment(
    name="moo_experiment",
    parameters=[
        {
            "name": f"x{i+1}",
            "type": "range",
            "bounds": [400, 500],
        }
        for i in range(2)
    ],
    objectives={
        # `threshold` arguments are optional
        "a": ObjectiveProperties(minimize=False), 
        "b": ObjectiveProperties(minimize=False)
    },
    overwrite_existing_experiment=True,
    is_test=True,
    parameter_constraints=["-np.sqrt(2*np.square( 0.5*x1 )) + x1 <= -100"],
)

Which produces the following error:

AssertionError: Parameter not in dict_keys(['x1', 'x2'])

Is there any way in which I can implement this constraint? I've also tried reformulating the constraint to get rid of the square root which (I think) yields 0.5x12 - x22 - 200x2 >= 10000, but this gives the same error (perhaps because of the squared terms?).

Is there any solution for this?

@Balandat
Copy link
Contributor

Hi, unfortunately we currently do not support non-linear parameter constraints. #769 has a pretty lengthy discussion of this, incl. pointers to other issues as well a draft PR (#794) that can allow this - but this is very much preliminary work and can potentially cause unwanted behavior when interacting with the transforms we do of the parameters - if you want to try this out USE AT YOUR OWN RISK.

@lena-kashtelyan lena-kashtelyan added wontfix This will not be worked on wishlist Long-term wishlist feature requests and removed wontfix This will not be worked on labels Feb 23, 2022
@lena-kashtelyan
Copy link
Contributor

Closing as duplicate of #153 that is already on our wishlist. As @Balandat states, full support for this is not likely in the short-term, and #769 discusses some very experimental workarounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wishlist Long-term wishlist feature requests
Projects
None yet
Development

No branches or pull requests

3 participants