Gurobi Live Barcelona
Application | Phenomenon | Nonlinearity |
---|---|---|
Finance | risk | quadratic (convex) |
Truss topology | physical forces | quadratic (convex) |
Pooling (petrochemical, mining, agriculture) | mixing products | quadratic non-convex |
electricity distribution (ACOPF) | Alternative Current | \(\sin\) and \(\cos\) (can be made quadratic) |
machine learning | — | logistic function, \(\tanh\) |
chemical engineering | chemical reactions | — |
Ideally, we seek to solve \[ \begin{aligned} & \min f(x)\\ & \text{s.t:}\\ & g_i(x) \le 0, i = 1,\ldots, m \\ & x_j \in \mathbb Z, j \in \mathcal I\\ & l \le x \le u \end{aligned} \]
Any segment connecting two points inside the region is inside the region.
There exists two points in the region the segment connecting them is not completely in the region.
New in Gurobi 11
\[ \begin{aligned} & \min c^T x + x^T Q^0 x\\ & \text{s.t:}\\ & {a_k}^T x + x^T Q^k x \le b_k, k = 1,\ldots, m\\ & x_j \in \mathbb Z, j \in \mathcal I\\ & l \le x \le u \end{aligned} \]
Through simple algebra, can be represented as SOC:
Very powerful but modeling sometimes far from obvious.
Not all forms recognized by solvers
New in Gurobi 11
Note
Our barrier algorithm needs everything converted
to SOC or linear by presolve.
flowchart TD A((c* = 0.5, <br> x*=0.3)) A -- "x ≤ 0" --> B((c* = 0.6, <br> z*=2.2)) A -->|"x ≥ 1"| C((c* = 0.8, <br> y*=1.6)) B -->|"z ≤ 2"| D((c* = 2)) B -->|"z ≥ 3"| E(("c* = +∞")) C -->|"y ≤ 1"| F((c* = 2.1)) C -->|"y ≥ 2"| G((c* = 1.3 <br> t* = 0.5)) G -->|"t ≤ 0"| H((c* = ?)) G -->|"t ≥ 1"| I((c* = ?)) class A branchnode class B branchnode class C branchnode class D intfeasnode class E prunenode class F prunenode class G branchnode classDef intfeasnode stroke:#0f0 classDef prunenode stroke:#f00 classDef branchnode stroke:#00f
At each node of the tree:
flowchart TD A[Solve continuous relaxation] A --> B[Integer feasible?] B -- no --> C[Branch] B -- yes -->F[New solution? <br> Update best known]
In MILP and MIQP continuous relaxation usually solved by simplex.
In MISOCP/MIQCP, continuous relaxation solved by barrier.
flowchart TD A((c* = 0.5, <br> x*=0.3)) A -- "x ≤ 0" --> B((c* = 0.6, <br> z*=2.2)) A -->|"x ≥ 1"| C((c* = ?)) B -->|"z ≤ 2"| D((c* = 2 <br> SOCP?)) B -->|"z ≥ 3"| E((c* = ?)) D -.-> H((c* = ?)) D -.-> I((c* = ?)) class A branchnode class B branchnode class D intfeasnode classDef intfeasnode stroke:#0f0 classDef prunenode stroke:#f00 classDef branchnode stroke:#00f
Drop quadratic constraints and solve an LP relaxation at each node.
Integer feasible nodes are not necessarily solutions.
flowchart TD A[Solve LP relaxation] A --> B[Integer feasible?] B -- no --> C[Branch] B -- yes --> D[SOCP Feasible?] D -- yes -->F[New solution? <br> Update best known] D -- no -->E[Generate OA cuts] E --> A
New in Gurobi 11
Rely on barrier algorithm for those nodes (usually very few).
flowchart TD A[Solve LP relaxation] A --> B[Integer feasible?] B -- no --> C[Branch] B -- yes --> D[SOCP Feasible?] D -- yes -->F[New solution? <br> Update best known] D -- no -->E[Generate OA cuts] E -- "no cutting!" --> A linkStyle 0,2,4,5 stroke:#dd2113,stroke-width:4px;
An exponential number of cutting planes is needed to approximate a convex quadratic form.
From \[ \sum_{i = 1}^n x_i^2 \le x_0^2, x_0 \ge 0 \]
\[ (A) \left\{ \begin{aligned} &\sum_{i = 1}^n x_i^2 \le x_0^2,\\ &x_0 \ge 0 \end{aligned} \right. \]
\[ (B) \left\{ \begin{aligned} & \sum_{i = 1}^n y_i \le x_0\\ & x_i^2 \le y_i x_0 & & i = 1, \ldots, n\\ & y \ge 0, x \ge 0 \end{aligned} \right. \]
Gurobi tries to deal with it but can be an issue.
MIQCPMethod
PreMIQCPForm
\[ \begin{aligned} & \min c^T x + x^T Q^0 x\\ & \text{s.t:}\\ & {a_k}^T x + x^T Q^k x \le b_k, & &k = 1,\ldots, m\\ & x_j \in \mathbb Z, j \in \mathcal I\\ & l \le x \le u \end{aligned} \]
Note
For simplicity sake, consider model without integer variables, in remainder.
NonConvex
New in Gurobi 11
Default behavior change: New default \(2\) (was \(1\))).
\[ \begin{aligned} & \min c^T x + \left\langle Q^0, Z \right\rangle\\ & \text{s.t:}\\ & {a_k}^T x + \color{red}{\left\langle Q^k , Z \right\rangle} \le b_k, & &k = 1,\ldots, m\\ & \color{red}{Z = x x^T} \\ & l \le x \le u\\ \\ &(\left\langle Q , Z \right\rangle = \sum_i \sum_j q_{ij} z_{ij}) \end{aligned} \]
Warning
Similar to disaggregation, infeasibilities in bilinear formulation can be larger than in the original model
Consider the square case: \(z = x^2\)
It is convex: \[ z^-(x_i, x_i) = x_i^2 \]
Can be dealt with by OA.
\(z^+(x_i, x_i)\) is given by the secant: \[ z^+_{ii} = (u + l) x_i - l \cdot u \]
\[ z^-_{ij} = \max \left\{ \begin{aligned} & 𝑙_j x_i+ 𝑙_i 𝑥_j - 𝑙_i 𝑙_j \\ & 𝑢_j x_i + 𝑢_i x_j - u_i u_j \end{aligned} \right\} \le z_{ij} \le z^+_{ij} = \min \left\{ \begin{aligned} & 𝑙_j x_i+ u_i 𝑥_j - u_i l_j \\ & 𝑢_j x_i + l_i x_j - l_i u_j \end{aligned} \right\} \]
RLTCuts
BQPCuts
SDPCuts
OBBT
:
New in Gurobi 11
Pooling problem from MINLPLIB
Gurobi Optimizer version 11.0.0 build v11.0.0beta2 (mac64[x86] - macOS 13.6.1 22G313)
CPU model: Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 662 rows, 403 columns and 2229 nonzeros
Model fingerprint: 0x883de6ff
Model has 70 quadratic constraints
Variable types: 295 continuous, 108 integer (108 binary)
Coefficient statistics:
Matrix range [2e-03, 1e+03]
QMatrix range [1e+00, 1e+00]
QLMatrix range [1e+00, 1e+00]
Objective range [1e+00, 5e+00]
Bounds range [1e+00, 1e+03]
RHS range [1e+00, 1e+03]
Presolve removed 188 rows and 93 columns
Presolve time: 0.01s
Presolved: 754 rows, 310 columns, 2283 nonzeros
Presolved model has 70 bilinear constraint(s)
Variable types: 218 continuous, 92 integer (92 binary)
Root relaxation: objective 1.262419e+04, 542 iterations, 0.01 seconds (0.01 work units)
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 12624.1926 0 101 - 12624.1926 - - 0s
0 0 10416.0029 0 111 - 10416.0029 - - 0s
0 0 10405.6081 0 108 - 10405.6081 - - 0s
0 0 10299.1966 0 104 - 10299.1966 - - 0s
0 0 10299.1966 0 104 - 10299.1966 - - 0s
0 0 10299.1833 0 125 - 10299.1833 - - 0s
0 0 10299.1828 0 109 - 10299.1828 - - 0s
0 0 10299.0296 0 125 - 10299.0296 - - 0s
0 0 10299.0195 0 112 - 10299.0195 - - 0s
0 0 10299.0195 0 115 - 10299.0195 - - 0s
0 0 10298.8700 0 84 - 10298.8700 - - 0s
0 2 10298.8700 0 84 - 10298.8700 - - 0s
* 1064 307 157 10246.216735 10292.1669 0.45% 18.2 0s
H 1139 270 10246.219957 10291.0140 0.44% 17.7 0s
Cutting planes:
Cover: 3
Implied bound: 18
Clique: 1
MIR: 26
Flow cover: 33
Flow path: 9
GUB cover: 1
Inf proof: 3
RLT: 47
Explored 1392 nodes (24192 simplex iterations) in 0.84 seconds (0.77 work units)
Thread count was 8 (of 8 available processors)
Solution count 2: 10246.2 10246.2
Optimal solution found (tolerance 1.00e-04)
Best objective 1.024621995655e+04, best bound 1.024621995655e+04, gap 0.0000%
Since Gurobi 9.0. Allow to state \(𝑦=𝑓(𝑥)\)
Library of predefined functions include:
Gurobi 9.0-10.0: nonlinear functions replaced during presolve by a piece-wise linear approximation.
Gurobi 11, can treat nonlinear functions directly:
FuncNonLinear=1
%%{ init: { 'flowchart': { 'curve': 'linear' } } }%% flowchart TD IV[Integer variables <br> SOS Constraints] GF["General function <br> y = f(x)"] GF--"Gurobi ≤ 10"--- IV MILP[MILP] IV --- MILP MINLP[MINLP] GF --"Gurobi 11 <br> FuncNonLinear=1"---- MINLP BB(branch-and-cut) MILP --- BB SBB(spatial b&b) MINLP --- SBB class Model subg class Convex subg class Nonconvex subg class Problems subg class Algorithms subg classDef subg fill:#FFFFFF; classDef difficult stroke:#dd2113 classDef easy stroke:#1675a9
E.g.: Consider for \(x\ge 0\): \[ f(x) = \sqrt{1 + x^2} + \ln({x + \sqrt{1 + x^2}}) \le 2 \] We can formulate it:
Caution
Feasibility tolerances!
\[ y = f(x) = \frac{x}{\sin (x)} \] a solution is \(x= 0.0001\), \(y = 1.0000000016666666\).
Now decompose \(f(x)\): \(u = sin(x)\), \(v = \frac{1}{u}\), \(y = x \cdot v\).
And consider:
😱
We have \(\overline y - f(\overline x) \approxeq 10^-2\)
This beautiful slide is stolen from Elisabeth 🥺
©️ Gurobi Optimization