Professional Documents
Culture Documents
Quadratic Optimization
Quadratic Optimization
Robert Luce
October 2022
• Univariate function:
𝑓: ℝ ⟶ ℝ, 𝑓 𝑥 = 𝑥 2 + 2𝑥 + 1
• Bivariate function:
𝑓: ℝ2 ⟶ ℝ, 𝑓 𝑥, 𝑦 = 3𝑥 2 − 𝑥𝑦 + 2𝑦 2 + 2𝑥 − 𝑦
5
Convex functions and constraints
• A function f is convex if its epigraph 𝑒𝑝𝑖 𝑓 ≔ 𝑥, 𝑡 𝑓 𝑥 ≤ 𝑡} ⊂ ℝ𝑛+1 is convex
• An inequality constraint 𝑓 𝑥 ≤ 0 is convex, if f is convex.
convex nonconvex
𝑥2 ≤ 𝑡 −𝑥 2 ≤ 𝑡
Until further notice all quadratic functions in this lecture are assumed convex!
𝑚𝑖𝑛 𝑥 𝑇 𝑄 𝑥 + 𝑝𝑇 𝑥
𝑠. 𝑡. 𝐴𝑥 = 𝑏
𝑥≥0
• Only difference: quadratic term in objective function
• (All kinds of linear inequality constraints allowed, “standard” form just normalizes
the formulation).
𝑚𝑖𝑛 𝑐𝑇 𝑥
𝑠. 𝑡. 𝐴𝑥 = 𝑏
𝑥 𝑇 𝑄 𝑥 + 𝑝𝑇 𝑥 ≤ 0
𝑥≥0
• Here: One single quadratic constraint
• In general: Can have arbitrarily many such constraints
• In general: Can have a quadratic objective, too
• (All kinds of linear constraints allowed, “standard form” just for simplicity)
• Simplex Algorithm
• Exploits polyhedral structure of feasible region
• Basic solutions correpond to vertices
• One simplex iteration: Move from one vertex to an adjacent one
• Typically takes “many” iterations, each single iteration typically very cheap. Sparse
structure exploited in every algorithmic component
• Interior Point Method
• Exploits analytic properties of the constraint functions
• Iterates traverse the interior of the polyhedron
• One interior point iteration: Move from “centered” point in the interior to the next
• Typically takes “few” iterations, each single one is quite expensive. Sparse structure
exploited for solving linear systems of equations.
• Both simplex and interior point methods extend quite naturally to quadratic
objective functions
• Feasible region not structurally different: Still a polyhedron!
• But optimality conditions have more geometry now
• Consequence: Pivoting becomes more complicated, and gives more sources of
numeric trouble
Barrier statistics:
Dense cols : 2
AA' NZ : 2.800e+01
Factor NZ : 4.500e+01
Factor Ops : 1.310e+02 (less than 1 second per iteration)
Threads : 1
Objective Residual
Iter Primal Dual Primal Dual Compl Time
0 4.30955767e+02 -1.54332297e+05 1.93e+03 1.00e+03 9.94e+05 0s
1 1.00700784e+06 -1.04761020e+06 1.93e-03 1.00e-03 1.28e+05 0s
<<<< SNIP >>>>
Barrier solved model in 10 iterations and 0.00 seconds (0.00 work units)
Optimal objective 3.56257979e+00
Algorithms for QCP
• Assume for simplicity that we have a MILP with one additional standard SOC
constraint
𝑓 𝑥 = −𝑥12 + 𝑥22 + … + 𝑥𝑛2 ≤ 0,
• Next simply forget that the SOC constraint exist, and solve ”just” the LP relaxation
of the resulting MILP, call the optimal solution vector 𝑥 ∗
• If 𝑓 𝑥 ∗ ≤ 0: We are done!
• Otherwise find a separating hyperplane for 𝑥 ∗
• Add as new linear constraint to the LP
• Resolve and repeat!
27
Nonconvexity and optimization
28
Convex and nonconvex Optimization
Quadratic
Linear
Objective SOS
Objective
min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥 Constraints
min 𝑐 𝑇𝑥
with PSD 𝑄
Linear Quadratic
Continuous Integer
Constraints Inequalities
Variables Variables
𝑎 𝑥 + 𝑥 𝑇 𝑄𝑥 ≤ 𝑏
𝑇
𝑎𝑇 𝑥 ⋚ 𝑏 𝑥∈ℝ 𝑥∈ℤ
with PSD 𝑄
29
Convex and nonconvex Optimization
Quadratic
Linear
Objective SOS
Objective
min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥 Constraints
min 𝑐 𝑇𝑥
with PSD 𝑄
Linear Quadratic
Continuous Integer
Constraints Inequalities
Variables Variables
𝑎 𝑥 + 𝑥 𝑇 𝑄𝑥 ≤ 𝑏
𝑇
𝑎𝑇 𝑥 ⋚ 𝑏 𝑥∈ℝ 𝑥∈ℤ
with PSD 𝑄
Linear
Program
(LP)
30
Convex and nonconvex Optimization
Quadratic
Linear
Objective SOS
Objective
min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥 Constraints
min 𝑐 𝑇𝑥
with PSD 𝑄
Linear Quadratic
Continuous Integer
Constraints Inequalities
Variables Variables
𝑎 𝑥 + 𝑥 𝑇 𝑄𝑥 ≤ 𝑏
𝑇
𝑎𝑇 𝑥 ⋚ 𝑏 𝑥∈ℝ 𝑥∈ℤ
with PSD 𝑄
Linear Quadratic
Program Program
(LP) (QP)
31
Convex and nonconvex Optimization
Quadratic
Linear
Objective SOS
Objective
min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥 Constraints
min 𝑐 𝑇𝑥
with PSD 𝑄
Linear Quadratic
Continuous Integer
Constraints Inequalities
Variables Variables
𝑎 𝑥 + 𝑥 𝑇 𝑄𝑥 ≤ 𝑏
𝑇
𝑎𝑇 𝑥 ⋚ 𝑏 𝑥∈ℝ 𝑥∈ℤ
with PSD 𝑄
32
Convex and nonconvex Optimization
Quadratic
Linear
Objective SOS
Objective
min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥 Constraints
min 𝑐 𝑇𝑥
with PSD 𝑄
Linear Quadratic
Continuous Integer
Constraints Inequalities
Variables Variables
𝑎 𝑥 + 𝑥 𝑇 𝑄𝑥 ≤ 𝑏
𝑇
𝑎𝑇 𝑥 ⋚ 𝑏 𝑥∈ℝ 𝑥∈ℤ
with PSD 𝑄
33
Convex and nonconvex Optimization
Quadratic
Linear
Objective SOS
Objective
min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥 Constraints
min 𝑐 𝑇𝑥
with PSD 𝑄
Linear Quadratic
Continuous Integer
Constraints Inequalities
Variables Variables
𝑎 𝑥 + 𝑥 𝑇 𝑄𝑥 ≤ 𝑏
𝑇
𝑎𝑇 𝑥 ⋚ 𝑏 𝑥∈ℝ 𝑥∈ℤ
with PSD 𝑄
34
Convex and nonconvex Optimization
Quadratic
Linear
Objective SOS
Objective
min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥 Constraints
min 𝑐 𝑇𝑥
with PSD 𝑄
Linear Quadratic
Continuous Integer
Constraints Inequalities
Variables Variables
𝑎 𝑥 + 𝑥 𝑇 𝑄𝑥 ≤ 𝑏
𝑇
𝑎𝑇 𝑥 ⋚ 𝑏 𝑥∈ℝ 𝑥∈ℤ
with PSD 𝑄
35
Convex and nonconvex Optimization
Quadratic Quadratic
Linear
Objective SOS Objective
Objective
min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥 Constraints min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥
min 𝑐 𝑇𝑥
with PSD 𝑄 with non-PSD 𝑄
36
Convex and nonconvex Optimization
Quadratic Quadratic
Linear
Objective SOS Objective
Objective
min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥 Constraints min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥
min 𝑐 𝑇𝑥
with PSD 𝑄 with non-PSD 𝑄
37
Convex and nonconvex Optimization
Quadratic Quadratic
Linear
Objective SOS Objective
Objective
min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥 Constraints min 𝑎𝑇 𝑥 + 𝑥 𝑇 𝑄𝑥
min 𝑐 𝑇𝑥
with PSD 𝑄 with non-PSD 𝑄
38
Mixed Integer Quadratically Constrained Programming
39
Nonconvex QP, QCP, MIQP, and MIQCP
• Applications
• Pooling problem (blending problem is LP, pooling introduces intermediate pools →
bilinear)
• Petrochemical industry (oil refinery: constraints on ratio of components in tanks)
• Wastewater treatment
• Emissions regulation
• Agricultural / food industry (blending based on pre-mix products)
• Mining
• Energy
• Production planning (constraints on ratio between internal and external workforce)
• Logistics (restrictions from free trade agreements)
• Water distribution (Darcy-Weisbach equation for volumetric flow)
• Engineering design
• Finance (constraints on exchange rates)
• General MINLP
• Non-convex MIQCP can model polynomial problems of arbitrary degree
• Solve general MINLPs by approximating as polynomial problem
• but: will often fail for higher degrees due to numerical issues
40
Nonconvex QP, QCP, MIQP, and MIQCP
41
More Details on Bilinear Transformation
• More sophisticated partitions into convex and nonconvex parts are possible and
may work better!
42
Dealing With Bilinear Constraints
• General form: 𝑎 𝑇 𝑧 + 𝑑𝑥𝑦 ≦ 𝑏 (linear sum plus single product term, inequality or
equation)
convex nonconvex
−𝑧 + 𝑥 2 ≤ 0 −𝑧 − 𝑥 2 ≤ 0
43
Dealing With Bilinear Constraints
• General form: 𝑎 𝑇 𝑧 + 𝑑𝑥𝑦 ≦ 𝑏 (linear sum plus single product term, inequality or
equation)
convex nonconvex
−𝑧 + 𝑥 2 ≤ 0 −𝑧 − 𝑥 2 ≤ 0
44
Dealing With Bilinear Constraints
• General form: 𝑎 𝑇 𝑧 + 𝑑𝑥𝑦 ≦ 𝑏 (linear sum plus single product term, inequality or
equation)
nonconvex
−𝑧 − 𝑥 2 ≤ 0
45
Dealing With Bilinear Constraints
• General form: 𝑎 𝑇 𝑧 + 𝑑𝑥𝑦 ≦ 𝑏 (linear sum plus single product term, inequality or
equation)
nonconvex
−𝑧 − 𝑥 2 ≤ 0
46
Dealing With Bilinear Constraints
• General form: 𝑎 𝑇 𝑧 + 𝑑𝑥𝑦 ≦ 𝑏 (linear sum plus single product term, inequality or
equation)
nonconvex
−𝑧 − 𝑥 2 ≤ 0
branching
𝑥 ≤ 0 or 𝑥 ≥ 0
47
LP Relaxation of Bilinear Constraints
−𝑧 + 𝑢𝑥 𝑦 + 𝑙𝑦𝑥 ≥ 𝑢𝑥 𝑙𝑦
−𝑧 + 𝑙𝑥 𝑦 + 𝑢𝑦𝑥 ≥ 𝑙𝑥𝑢𝑦
48
LP Relaxation of Bilinear Constraints
−𝑧 + 𝑢𝑥 𝑦 + 𝑙𝑦𝑥 ≥ 𝑢𝑥 𝑙𝑦
−𝑧 + 𝑙𝑥 𝑦 + 𝑢𝑦𝑥 ≥ 𝑙𝑥𝑢𝑦
coefficients depend
on local bounds
49
Adaptive Constraints in LP Relaxation
• Coefficients and right hand sides of McCormick constraints depend on local bounds
of variables
• Whenever local bounds change, LP coefficients and right hand sides are updated
• May lead to singular or ill-conditioned basis
• in worst case, simplex needs to start from scratch
50
Spatial Branching
51
Performance Impact of Branching
1.40
1.20
1.00
faster
0.80
1.25
0.60 1.05
1.00
0.40
0.20
0.00
Time limit: 10000 sec. Default No Shadow Costs No McCormick Volume Test set has 444 models, using 5 random seeds:
Intel Xeon CPU E3-1240 v3 @ 3.40GHz - 4 discarded due to inconsistent answ ers
4 cores, 8 hyper-threads
32 GB RAM
Timeouts: 5 60 8 - 54 discarded that none of the versions can solve
- speed-up measured on >10s bracket: 143 models
52
Cutting Planes for Mixed Bilinear Programs
53
Performance Impact of Cutting Planes
3.00
2.50
2.00
faster
2.94
1.50
1.00
1.26
1.00 1.02
0.50
0.00
Time limit: 10000 sec. Default No RLT Cuts No BQP Cuts No PSD Cuts Test set has 477 models, using 5 random seeds:
Intel Xeon CPU E3-1240 v3 @ 3.40GHz - 5 discarded due to inconsistent answ ers
4 cores, 8 hyper-threads
32 GB RAM
Timeouts: 2 114 7 13 - 55 discarded that none of the versions can solve
- speed-up measured on >10s bracket: 158 models
54
Summary