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

[Feature Request] support constraints on ChoiceParameters #2311

Closed
zhqrbitee opened this issue Apr 2, 2024 · 4 comments
Closed

[Feature Request] support constraints on ChoiceParameters #2311

zhqrbitee opened this issue Apr 2, 2024 · 4 comments

Comments

@zhqrbitee
Copy link

Hi, I'm having a use case that my parameters A and B are all odd values, so I put them as ChoiceParameters, but I also want to bound them to make them close enough, e.g. -10 <= A - B <= 10.
Currently, when putting constraint on a ChoiceParameters, I got below error msgs (the ax version is 0.3.7):

ax.exceptions.core.UnsupportedError: Constraints on ChoiceParameters are not allowed. Try absorbing this constraint into the associated range parameter's bounds.

I searched through existing issues and find this one: #621. According to the comment here: #621 (comment):

As far as choice parameters are concerned, the reason we didn't allow constraints on these was that they were one-hot encoded and thus representing the constraint as a linear constraint is not straightforward. However, we made some changes recently that handle choice parameters in a different way and optimize over their actual values, so it would potentially be possible to incorporate them into parameter constraints (in fact, potentially even nonlinear ones)

So I'm wondering if above is still true? If possible, is there any plan for this?

@mgrange1998
Copy link
Contributor

Hi @zhqrbitee, I am taking a look into whether ordered choice parameters can be incorporated into parameter constraints.

One quick thought first- is it possible to use RangeParameters for A and B across all integers, but then map the parameters to odd values in your usecase?

@mgrange1998
Copy link
Contributor

Hi, so I found that we have an open issue for supporting constraints on choice parameters on our wishlist
#710.

Closing this issue for now, please feel free to make another issue for help with the usecase design if the mapping approach doesn't work. Thank you!

@zhqrbitee
Copy link
Author

One quick thought first- is it possible to use RangeParameters for A and B across all integers, but then map the parameters to odd values in your usecase?

Hi @mgrange1998 , thanks for your quick reply! Yes, this is the way I'm currently use to work around the problem. But it is less straightforward and more error-prone, so I'm hoping this would be a natively supported feature in AX.

Closing this issue for now, please feel free to make another issue for help with the usecase design if the mapping approach doesn't work. Thank you!

I see it be putting in the wishlist as a long term task (#566) , so should I can close this issue (it seems not closed yet)?

@mgrange1998
Copy link
Contributor

Yes, please close the issue. Best of luck with your problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants