Solving Mixed-Integer Bilevel Problems with coin-or/MibS¶
MibS is an optimization solver for mixed-integer bilevel problems; for more information, please refer to the MibS website. Idol seamlessly interfaces with MibS to solve bilevel problems.
We will see that solving bilevel problems with MibS is very similar to solving any optimization problem in idol.
Setup¶
We will assume that you have your bilevel problem already modeled in idol. In particular, we consider that you have two variables:
high_point_relaxation
which is aModel
representing the high-point relaxation of your bilevel problem.description
which is aBilevel:Description
object representing the bilevel problem. If you do not know what this is or how to create it, please refer to the previous tutorial.
Using MibS¶
To solve your bilevel problem, you can use the MibS
optimizer factory as follows:
high_point_relaxation.use(Bilevel::MibS(description));
high_point_relaxation.optimize();
std::cout << save_primal(high_point_relaxation) << std::endl;
Notice how the MibS optimizer factory is attached to the high-point relaxation model and that the bilevel description is passed as an argument.
The rest of the code is the same as with any other solver.
Hint
To use MibS, you need to have the MibS library installed on your system and idol linked against it. You can download MibS from here.
Then, idol should be compiled with the options USE_MIBS=YES
, USE_CLP=YES
.
Using CPLEX for Feasibility Check¶
Note that it is also possible to use MibS in combination with CPLEX for the feasibility check. This can be done as follows:
const auto mibs = Bilevel::MibS(description)
.with_cplex_for_feasibility(true)
.with_time_limit(3600)
.with_logs(true);
high_point_relaxation.use(mibs);
high_point_relaxation.optimize();
std::cout << save_primal(high_point_relaxation) << std::endl;
Off course, MibS must have been installed with CPLEX for this to work.