-
Really glad I came across this repo, because I'm learning a lot of new things! I have a question and would like to discuss some ideas. I have a product development problem which we solve using Bayesian Optimization, but we have a tricky constraint. We have a bunch of ingredients as explanatory variables which we can use to create products. These products have properties which we predict and want to optimize. The tricky constraint is that we can only use 5 ingredients of a set of around 30 total, this really sounds like the NChooseKConstraint which I found a discussion about here by @jduerholt , which led me to this repo. Really interesting idea and I think exactly what I'm looking for. I was trying to solve this by introducing binary decision variables Would love to hear your thoughts! Best, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi @Aschwins , if you want to use IPOPT this could be problematic, because IPOPT only supports continuous variables. So I guess in the most general case any constraint relying on binary decision variables is not so easy to realize. I think there have been approaches to overcome this limitation (e.g. #243 ), but @dlinzner-bcs probably knows more about that. I think pyomo offers a solver for MINLP https://pyomo.readthedocs.io/en/stable/contributed_packages/mindtpy.html, so maybe this is an option for you if you want to realize the NChooseK constraint via binary variables. Cheers, |
Beta Was this translation helpful? Give feedback.
If I got you right you could do the following:
Add 1 NChooseKConstraint on all 15 features with max_count=5
Add the LinearInequalityConstraint x_1 + x_2 + x_3 >= c > 0 to ensure at least one feature from the first group is nonzero
Add the LinearInequalityConstraint x_3 + ... + x_15 >= c > 0 to ensure at least one feature from the second group is nonzero
This roughly follows the procedure described in #145 in case you are interested in more details, I hope this helps.
Maybe also have a look into the open issue #314 .
Cheers
Aaron :)