Relax variable constraints c++
回答済みHi there. I have been using gurobi for several years now for my research and am hoping to get help with the c++ interface.
I have a defined 0-1 integer linear program model (this works fine). I can optimize this model (this works fine). I would like to relax the model (i.e. the variables can take on continuous values between 0 and 1 as opposed to simply being 0 or 1). I can just copy the code and change the variables to GRB_CONTINUOUS but it would be nice to just copy the model and run the relax.
I see that the Python api has the functionality: https://support.gurobi.com/hc/en-us/articles/360049542931?input_string=relax+variable+constraints+of+model
I see that there is a feasibilitysolve: https://www.gurobi.com/documentation/10.0/refman/cpp_model_feasrelax.html
but the later does not really solve the problem in this instance.
Thanks!
Aaron
-
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try Gurobot? -
Hi Aaron,
The convenience method relax is currently only available in Python.
To relax your variables to continuous ones, you can loop over your variables and use the GRBVar::set() method to set the VType attribute to \(\texttt{'C'}\) for continuous.
Best regards,
Jaromił0
投稿コメントは受け付けていません。
コメント
2件のコメント