Skip to content

Commit

Permalink
update tutorials for robust
Browse files Browse the repository at this point in the history
  • Loading branch information
hlefebvr committed Feb 20, 2025
1 parent 6fc0f18 commit 7973fed
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 14 deletions.
4 changes: 4 additions & 0 deletions docs/tutorials/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ Robust Optimization

robust-optimization/index

Artificial Intelligence
-----------------------

To come...
20 changes: 17 additions & 3 deletions docs/tutorials/robust-optimization/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
Robust Optimization
===================

.. warning::
Robust optimization is a field of mathematical optimization that explicitly accounts for uncertainty in optimization problems.
In many real-world applications, the input parameters—such as costs, demands, or resource availabilities—are not precisely known
at the time decisions must be made. This uncertainty can arise from estimation errors, forecasting inaccuracies,
or inherent variability in the system.
Robust optimization provides a framework for making decisions that remain feasible and perform well across a range of
possible realizations of the uncertain parameters.

This section is under construction.
A key concept in robust optimization is the *uncertainty set*, which defines the range of possible values that uncertain
parameters can take.
Instead of assuming that uncertain parameters follow a known probability distribution (as, e.g., in stochastic optimization),
robust optimization only requires that they belong to a predefined set. This set, typically denoted as :math:`U`, captures
the worst-case deviations within a specified level of conservatism.
By optimizing against the worst-case scenario within :math:`U`, robust optimization ensures that the solution remains
feasible and performs satisfactorily under all realizations within the uncertainty set.

There are mainly two types of problems that can be handled by idol: single-stage problems and two-stage problems.
If you are new to robust optimization, we strongly advise you to start with the single-stage problems.

.. toctree::
:maxdepth: 3
:maxdepth: 2
:glob:

single-stage/index
Expand Down
21 changes: 19 additions & 2 deletions docs/tutorials/robust-optimization/single-stage/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
Single-stage Robust Optimization
================================

.. warning::
A classic robust optimization model can be formulated as follows:

.. math::
\min_{x} \quad & c^\top x \\
\text{s.t.} \quad & \sum_{i=1}^j (\bar a_{ij} + \hat a_{ij}u_j)x_j \ge b_i \qquad \text{for all }u\in U_i, \qquad i=1,\dotsc,m, \\
& x\in X.
Here:

- :math:`x` represents the decision variables.
- :math:`c^\top x` is the objective function to be minimized.
- The constraints involve uncertain coefficients :math:`a_{ij}`, which are modeled as :math:`\bar a_{ij} + \hat a_{ij} u_j`, where :math:`\bar a_{ij}` is the nominal value, and :math:`\hat a_{ij} u_j` represents the uncertainty.
- :math:`U_i` is the uncertainty set, specifying the range of possible values for the uncertain parameters :math:`u_j`.
- The goal is to find a solution :math:`x` that satisfies the constraints for all possible values of :math:`u` within :math:`U_i` for row :math:`i`.

This formulation ensures that the solution is robust against the worst-case realizations of the uncertain parameters within the given uncertainty set.
The choice of :math:`U` significantly impacts the conservatism of the solution: a larger uncertainty set leads to a more
robust but potentially more conservative solution, while a smaller set provides less protection against extreme variations.

This section is under construction.

.. toctree::
:maxdepth: 3
Expand Down
8 changes: 6 additions & 2 deletions docs/tutorials/robust-optimization/two-stage/ccg.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Introduction to the Column-and-Constraint Generation
====================================================
The Column-and-Constraint Generation: Introduction
==================================================

.. contents:: Table of Contents
:local:
Expand All @@ -8,6 +8,10 @@ Introduction to the Column-and-Constraint Generation
Introduction
------------

.. warning::

This tutorial is still under construction.

Robust Bilevel Optimization with Wait-and-See Lower Level
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
7 changes: 2 additions & 5 deletions docs/tutorials/robust-optimization/two-stage/index.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
.. _robust_single:

Adjustable Robust Optimization (Two-stage)
Two-stage Robust Optimization (Adjustable)
==========================================



.. toctree::
:maxdepth: 3
:maxdepth: 1
:glob:

modeling
ccg
column-and-constraint-generation/index
4 changes: 4 additions & 0 deletions docs/tutorials/robust-optimization/two-stage/modeling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Modeling Adjustable Robust Problems
===================================

.. warning::

This tutorial is still under construction.

In this tutorial, we will see how to model a two-stage robust problem in idol.

To follow this tutorial, you should be familiar with two-stage robust optimization and modeling optimization problems in idol.
Expand Down
16 changes: 16 additions & 0 deletions examples/robust/ccg-wait-and-see-follower.data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
5 5
28 109
60 144
42 103
0 31
42 154
63
59
35
49
65
0.98 0.58 0.37 0.84 1.08
0.78 0.58 0.48 0.51 0.54
0.9 0.61 0.41 0.64 0.73
0.27 0.46 0.64 0.16 0.14
0.18 0.34 0.57 0.1 0.27
2 changes: 1 addition & 1 deletion examples/robust/ccg-wait-and-see-follower.example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ int main(int t_argc, const char** t_argv) {
for (const auto& ctr : second_stage_constraints) {
bilevel_description.make_lower_level(ctr);
}
bilevel_description.set_lower_level_obj(model.get_obj_expr());
bilevel_description.set_lower_level_obj(-model.get_obj_expr());

/**************************/
/* Create Uncertainty Set */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ idol::CCG::Formulation::Formulation(const idol::Model &t_parent, const idol::Rob
parse_constraints();
copy_bilevel_description(t_bilevel_description, m_bilevel_description_separation);

// if is wait-and-see follower, copy annotation, make sure master solver is a bilevel solver
if (is_wait_and_see_follower()) {
auto& env = m_parent.env();
m_bilevel_description_master = std::make_optional<::idol::Bilevel::Description>(env);
Expand Down

0 comments on commit 7973fed

Please sign in to comment.