-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
412 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
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 <https://projects.coin-or.org/MibS>`_. | ||
Idol seamlessly integrates 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. | ||
|
||
.. contents:: Table of Contents | ||
:local: | ||
:depth: 2 | ||
|
||
Setup | ||
----- | ||
|
||
We will assume that you have your bilevel problem already modeled in idol. In particular, we consider that you have | ||
two variables: | ||
|
||
1. :code:`high_point_relaxation` which is a :code:`Model` representing the high-point relaxation of your bilevel problem. | ||
|
||
2. :code:`description` which is a :code:`Bilevel:Description` object representing the bilevel problem. If you do not know what this is or how to create it, please refer to the :ref:`previous tutorial <tutorial_optimistic_bilevel>`. | ||
|
||
Using MibS | ||
---------- | ||
|
||
To solve your bilevel problem, you can use the :code:`MibS` optimizer factory as follows: | ||
|
||
.. code:: | ||
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 to the executable. | ||
You can download MibS from `here <https://projects.coin-or.org/MibS>`_. | ||
|
||
Then, idol should be compiled with the options :code:`USE_MIBS=YES`, :code:`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: | ||
|
||
.. code:: | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
.. _tutorial_pessimistic_bilevel: | ||
|
||
From Pessimistic Bilevel Optimization to Optimistic Bilevel Optimization | ||
======================================================================== | ||
|
||
Most of the litereature on bilevel optimization focuses on the optimistic setting, where the lower-level problem is assumed to | ||
pick the solution in favor of the upper-level problem. | ||
However, there exists other notions such as pessimistic bilevel problems. | ||
|
||
A pessimistic problem reads as follows: | ||
|
||
.. math:: | ||
:label: pessimistic | ||
\begin{align} | ||
\min_{x} \quad & \max_{ y\in S(x) } \ F(x,y) \\ | ||
\text{s.t.} \quad & x\in X, \\ | ||
& S(x) \neq \emptyset, | ||
\end{align} | ||
with :math:`S(x)` the solution set of | ||
|
||
.. math:: | ||
\begin{align} | ||
\min_{y} \quad & f(x,y) \\ | ||
\text{s.t.} \quad & g(x,y) \ge 0, \\ | ||
& y\in Y. | ||
\end{align} | ||
In this tutorial, we will show how a pessimistic bilevel problem can be automatically transformed into an optimistic bilevel problem. | ||
This transformation is due to :cite:`Zeng2020`. | ||
|
||
.. hint:: | ||
|
||
Here, :math:numref:`pessimistic` does not have coupling constraints for simplicity. | ||
However, the transformation can be extended to bilevel problems with coupling constraints. | ||
|
||
.. contents:: Table of Contents | ||
:local: | ||
:depth: 2 | ||
|
||
The Equivalent Optimistic Problem | ||
--------------------------------- | ||
|
||
In :cite:`Zeng2020`, the authors show that the pessimistic bilevel problem :math:numref:`pessimistic` is equivalent to the following optimistic bilevel problem: | ||
|
||
.. math:: | ||
:label: optimistic | ||
\begin{align} | ||
\min_{x,\bar y} \quad & F(x,y) \\ | ||
\text{s.t.} \quad & x\in X, \ \bar y\in Y, \\ | ||
& g(x,\bar y) \ge 0, \\ | ||
& y\in \tilde S(x, \bar y), | ||
\end{align} | ||
in which :math:`\tilde S(x, \bar y)` is the solution set of | ||
|
||
.. math:: | ||
\begin{align} | ||
\min_y \quad & -F(x,y) \\ | ||
\text{s.t.} \quad & g(x,y) \ge 0, \\ | ||
& y\in Y, \\ | ||
& f(x,y) \le f(x, \bar y). | ||
\end{align} | ||
Note that :math:numref:`optimistic` is an optimistic bilevel problem. | ||
|
||
Implementation | ||
-------------- | ||
|
||
Deriving the equivalent optimistic bilevel problem from a pessimistic bilevel problem can be done easily in idol. | ||
|
||
To this end, let us assume that you have your bilevel problem already modeled in idol. In particular, let us consider that you have | ||
two variables: | ||
|
||
1. :code:`high_point_relaxation` which is a :code:`Model` representing the high-point relaxation of your bilevel problem. | ||
|
||
2. :code:`description` which is a :code:`Bilevel:Description` object representing the bilevel problem. If you do not know what this is or how to create it, please refer to the :ref:`previous tutorial <tutorial_optimistic_bilevel>`. | ||
|
||
Then, you can derive the equivalent optimistic bilevel problem as follows: | ||
|
||
.. code:: | ||
auto [opt_model, opt_description] = | ||
Bilevel::PessimisticAsOptimistic::make_model(high_point_relaxation, description); | ||
Here, :code:`opt_model` is the high-point relaxation of :math:numref:`optimistic` and :code:`opt_description` is the bilevel description of :math:numref:`optimistic`. | ||
|
||
The rest of the code is the same as with any other solver. For instance, you can solve the optimistic bilevel problem with MibS as follows: | ||
|
||
.. code:: | ||
opt_model.use(Bilevel::MibS(opt_description)); | ||
opt_model.optimize(); | ||
std::cout << save_primal(opt_model) << std::endl; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.