85
Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization Jeff Linderoth Department of Industrial and Systems Engineering Wisconsin Institutes of Discovery University of Wisconsin-Madison August 10, 2016 Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 1 / 45

Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Integer Programming Modeling

IMA New Directions Short Course on Mathematical Optimization

Jeff Linderoth

Department of Industrial and Systems EngineeringWisconsin Institutes of DiscoveryUniversity of Wisconsin-Madison

August 10, 2016

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 1 / 45

Page 2: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

I Say MIP It. MIP It Good.

Today we start talking about the Mixed Integer Linear Program:

MILP: z∗ = max{c>x+ h>y : (x, y) ∈ S}

whereS := {(x, y) ∈ Zn+ × Rp+ : Ax+Gy ≤ b}

This is the The Most Important class of optimization problems

IPs Rule!

Turn constraints on and off.

Indicate whether or not constraints hold.

Enforce logical relationships between these conditions

Model (low-dimensional) piecewise-linear functions

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 2 / 45

Page 3: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

I Say MIP It. MIP It Good.

Today we start talking about the Mixed Integer Linear Program:

MILP: z∗ = max{c>x+ h>y : (x, y) ∈ S}

whereS := {(x, y) ∈ Zn+ × Rp+ : Ax+Gy ≤ b}

This is the The Most Important class of optimization problems

IPs Rule!

Turn constraints on and off.

Indicate whether or not constraints hold.

Enforce logical relationships between these conditions

Model (low-dimensional) piecewise-linear functions

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 2 / 45

Page 4: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models

MIP for $$$

“He just immediately figured out, ifyou want to succeed in this business

you needed a MIP.”

MIP Industries

1 Supply Chain

2 Electric Power

3 Finance

4 Work Force Management

5 Airlines

6 Railroads

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 3 / 45

Page 5: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Supply Chain

Supply Chain: (Uncapacitated) Facility LocationFacilities: I

Customers: J min∑i∈I

fiyi +∑i∈I

∑j∈J

cijxij

∑i∈I

xij = 1 ∀j ∈ J∑j∈J

xij ≤ |J |yi ∀i ∈ I (1)

OR xij ≤ yi ∀i ∈ I, j ∈ J (2)

Which formulation is to be preferred?

I = J = 40. Costs random.

Formulation 1. 53,121 seconds, optimal solution.Formulation 2. 2 seconds, optimal solution.

Why!? Stay tuned. (Next lecture)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 4 / 45

Page 6: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Supply Chain

Supply Chain: (Uncapacitated) Facility LocationFacilities: I

Customers: J min∑i∈I

fiyi +∑i∈I

∑j∈J

cijxij

∑i∈I

xij = 1 ∀j ∈ J∑j∈J

xij ≤ |J |yi ∀i ∈ I (1)

OR xij ≤ yi ∀i ∈ I, j ∈ J (2)

Which formulation is to be preferred?

I = J = 40. Costs random.

Formulation 1. 53,121 seconds, optimal solution.Formulation 2. 2 seconds, optimal solution.

Why!? Stay tuned. (Next lecture)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 4 / 45

Page 7: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Supply Chain

Supply Chain: (Uncapacitated) Facility LocationFacilities: I

Customers: J min∑i∈I

fiyi +∑i∈I

∑j∈J

cijxij

∑i∈I

xij = 1 ∀j ∈ J∑j∈J

xij ≤ |J |yi ∀i ∈ I (1)

OR xij ≤ yi ∀i ∈ I, j ∈ J (2)

Which formulation is to be preferred?

I = J = 40. Costs random.

Formulation 1. 53,121 seconds, optimal solution.Formulation 2. 2 seconds, optimal solution.

Why!? Stay tuned. (Next lecture)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 4 / 45

Page 8: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Supply Chain

Supply Chain: (Uncapacitated) Facility LocationFacilities: I

Customers: J min∑i∈I

fiyi +∑i∈I

∑j∈J

cijxij

∑i∈I

xij = 1 ∀j ∈ J∑j∈J

xij ≤ |J |yi ∀i ∈ I (1)

OR xij ≤ yi ∀i ∈ I, j ∈ J (2)

Which formulation is to be preferred?

I = J = 40. Costs random.

Formulation 1. 53,121 seconds, optimal solution.Formulation 2. 2 seconds, optimal solution.

Why!? Stay tuned. (Next lecture)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 4 / 45

Page 9: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Supply Chain

Supply Chain: (Uncapacitated) Facility LocationFacilities: I

Customers: J min∑i∈I

fiyi +∑i∈I

∑j∈J

cijxij

∑i∈I

xij = 1 ∀j ∈ J∑j∈J

xij ≤ |J |yi ∀i ∈ I (1)

OR xij ≤ yi ∀i ∈ I, j ∈ J (2)

Which formulation is to be preferred?

I = J = 40. Costs random.

Formulation 1. 53,121 seconds, optimal solution.Formulation 2. 2 seconds, optimal solution.

Why!? Stay tuned. (Next lecture)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 4 / 45

Page 10: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Supply Chain

Supply Chain: (Uncapacitated) Facility LocationFacilities: I

Customers: J min∑i∈I

fiyi +∑i∈I

∑j∈J

cijxij

∑i∈I

xij = 1 ∀j ∈ J∑j∈J

xij ≤ |J |yi ∀i ∈ I (1)

OR xij ≤ yi ∀i ∈ I, j ∈ J (2)

Which formulation is to be preferred?

I = J = 40. Costs random.

Formulation 1. 53,121 seconds, optimal solution.Formulation 2. 2 seconds, optimal solution.

Why!? Stay tuned. (Next lecture)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 4 / 45

Page 11: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Supply Chain

Supply Chain: Lot Sizing

xt: Production quantity in period t

st: Inventory at end of period t

yt: Production indicator in period t

minn∑t=1

ptxt +n∑t=1

htst +n∑t=1

ftyt

s.t. st−1 + xt − st = dt, t = 1, . . . , n

xt ≤ Dtnyt, t = 1, . . . , n

s0 = sn = 0, st ≥ 0, xt ≥ 0, yt ∈ {0, 1}, t = 1, . . . , n

where Dj` =∑`

t=j dt for j ≤ `.

This is our “working IP” for the exercises

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 5 / 45

Page 12: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Supply Chain

Supply Chain: Lot Sizing

xt: Production quantity in period t

st: Inventory at end of period t

yt: Production indicator in period t

min

n∑t=1

ptxt +

n∑t=1

htst +

n∑t=1

ftyt

s.t. st−1 + xt − st = dt, t = 1, . . . , n

xt ≤ Dtnyt, t = 1, . . . , n

s0 = sn = 0, st ≥ 0, xt ≥ 0, yt ∈ {0, 1}, t = 1, . . . , n

where Dj` =∑`

t=j dt for j ≤ `.

This is our “working IP” for the exercises

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 5 / 45

Page 13: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Supply Chain

Supply Chain: Lot Sizing

xt: Production quantity in period t

st: Inventory at end of period t

yt: Production indicator in period t

min

n∑t=1

ptxt +

n∑t=1

htst +

n∑t=1

ftyt

s.t. st−1 + xt − st = dt, t = 1, . . . , n

xt ≤ Dtnyt, t = 1, . . . , n

s0 = sn = 0, st ≥ 0, xt ≥ 0, yt ∈ {0, 1}, t = 1, . . . , n

where Dj` =∑`

t=j dt for j ≤ `.

This is our “working IP” for the exercises

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 5 / 45

Page 14: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Power Systems

Power Systems

1 2

3

45

6 78

9

10

1112

13

14 Power Network: (N,A) with...

G ⊂ N : generation nodes

D ⊂ N : demand nodes

Load forecasts (MW) bi fori ∈ DGeneration cost ($/MW) ci andcapability pi (MW) for i ∈ GPeak load rating (MW) uij for(i, j) ∈ A

Economic Dispatch Problem

Determine power generation levels for i ∈ G and powertransmission levels for (i, j) ∈ A to meet demands bi, i ∈ D, atminimum cost

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 6 / 45

Page 15: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Power Systems

Power Systems

1 2

3

45

6 78

9

10

1112

13

14 Power Network: (N,A) with...

G ⊂ N : generation nodes

D ⊂ N : demand nodes

Load forecasts (MW) bi fori ∈ DGeneration cost ($/MW) ci andcapability pi (MW) for i ∈ GPeak load rating (MW) uij for(i, j) ∈ A

Economic Dispatch Problem

Determine power generation levels for i ∈ G and powertransmission levels for (i, j) ∈ A to meet demands bi, i ∈ D, atminimum cost

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 6 / 45

Page 16: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Power Systems

Power Flow

Electric power grids follow the laws of physics, characterized bynonlinear, nonconvex equations

DC Power Flow Approximation: The (real) power xijtransmit overline (i, j) ∈ A is proportional to angle differences (θi, θj) at theendpoint nodes:

xij = αij(θi − θj)

pi: (Real) power inject at generator i ∈ G

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 7 / 45

Page 17: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Power Systems

Linear Program for (DC) Economic Dispatch

minx,p,θ

∑i∈G

cipi

s.t.∑

j:(i,j)∈E

xij −∑

j:(j,i)∈E

xji =

pi ∀i ∈ Gdi ∀i ∈ D0 ∀i ∈ N \G \D

−uij ≤ xij ≤ uij ∀(i, j) ∈ Epi≤ pi ≤ pi ∀i ∈ Gxij = αij(θi − θj) ∀(i, j) ∈ Exij ∈ R ∀(i, j) ∈ Epi ∈ R+ ∀i ∈ Gθi ∈ R ∀i ∈ N

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 8 / 45

Page 18: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Tradeoffs

MCNF++

This economic dispatch problem is just a min cost network flowproblem with some additional “potential” constraints

xij = αij(θi − θj)

Implication: The potential drop(θA − θD) must be the samealong the paths: A→ B → Dand A→ C → D

A

B C

D

“Braess Paradox”

If line (C,D) didn’t exist, I wouldn’t have to enforce this potentialbalance constraint.

Thus, removing lines of the transmission network may actuallyincrease the efficiency of delivery.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 9 / 45

Page 19: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Tradeoffs

MCNF++

This economic dispatch problem is just a min cost network flowproblem with some additional “potential” constraints

xij = αij(θi − θj)

Implication: The potential drop(θA − θD) must be the samealong the paths: A→ B → Dand A→ C → D

A

B C

D

“Braess Paradox”

If line (C,D) didn’t exist, I wouldn’t have to enforce this potentialbalance constraint.

Thus, removing lines of the transmission network may actuallyincrease the efficiency of delivery.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 9 / 45

Page 20: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Tradeoffs

MCNF++

This economic dispatch problem is just a min cost network flowproblem with some additional “potential” constraints

xij = αij(θi − θj)

Implication: The potential drop(θA − θD) must be the samealong the paths: A→ B → Dand A→ C → D

A

B C

D

“Braess Paradox”

If line (C,D) didn’t exist, I wouldn’t have to enforce this potentialbalance constraint.

Thus, removing lines of the transmission network may actuallyincrease the efficiency of delivery.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 9 / 45

Page 21: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Tradeoffs

Transmission SwitchingTradeoff

Good: Having Lines Allows You to Send Flow:

−Uij ≤ xij ≤ Uij ∀(i, j) ∈ E

Bad: Having Lines Induces Constraints in the Network:

xij = αij(θi − θj) ∀(i, j) ∈ E

Fisher et al. [2008] show that efficiency improved by switching offtransmission lines

Lines Off % Improvement

1 6.3%2 12.4%3 19.9%4 20.5%∞ 24.9%

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 10 / 45

Page 22: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Tradeoffs

Transmission SwitchingTradeoff

Good: Having Lines Allows You to Send Flow:

−Uij ≤ xij ≤ Uij ∀(i, j) ∈ E

Bad: Having Lines Induces Constraints in the Network:

xij = αij(θi − θj) ∀(i, j) ∈ E

Fisher et al. [2008] show that efficiency improved by switching offtransmission lines

Lines Off % Improvement

1 6.3%2 12.4%3 19.9%4 20.5%∞ 24.9%Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 10 / 45

Page 23: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Tradeoffs

Switching Off Lines

Regular Flow Constraints:

xij = αij(θi − θj) ∀(i, j) ∈ E−Uij ≤ xij ≤ Uij ∀(i, j) ∈ E

Let zij ∈ {0, 1} ∀(i, j) ∈ ASwitched Flow Constraints:

xij = αijzij(θi − θj) ∀(i, j) ∈ E

That is NOT a MILP!

If (and only if) θi have bounds then one can write an MILPformulation

zij = 1⇔ line (i, j) ∈ A is used

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 11 / 45

Page 24: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Tradeoffs

Switching Off Lines

Regular Flow Constraints:

xij = αij(θi − θj) ∀(i, j) ∈ E−Uij ≤ xij ≤ Uij ∀(i, j) ∈ E

Let zij ∈ {0, 1} ∀(i, j) ∈ ASwitched Flow Constraints:

xij = αijzij(θi − θj) ∀(i, j) ∈ E

That is NOT a MILP!

If (and only if) θi have bounds then one can write an MILPformulation

zij = 1⇔ line (i, j) ∈ A is used

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 11 / 45

Page 25: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Tradeoffs

Switching Off Lines

Regular Flow Constraints:

xij = αij(θi − θj) ∀(i, j) ∈ E−Uij ≤ xij ≤ Uij ∀(i, j) ∈ E

Let zij ∈ {0, 1} ∀(i, j) ∈ ASwitched Flow Constraints:

xij = αijzij(θi − θj) ∀(i, j) ∈ E

That is NOT a MILP!

If (and only if) θi have bounds then one can write an MILPformulation

zij = 1⇔ line (i, j) ∈ A is used

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 11 / 45

Page 26: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Tradeoffs

MILP Formulation

minx,p,θ,z

∑i∈G

cipi

s.t.∑

j:(i,j)∈E

xij −∑

j:(j,i)∈E

xij =

pi ∀i ∈ Gdi ∀i ∈ D0 ∀i ∈ N \G \D

−Uijzij ≤ xij ≤ Uijzij ∀(i, j) ∈ Eαij(θi − θj)− xij +M(1− zij) ≥ 0 ∀(i, j) ∈ Eαij(θi − θj)− xij −M(1− zij) ≤ 0 ∀(i, j) ∈ E

−Li ≤ θi ≤ Li ∀i ∈ Npi≤ pi ≤ pi ∀i ∈ Gzij ∈ {0, 1} ∀(i, j) ∈ E

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 12 / 45

Page 27: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Portfolio Management

Portfolio Management

N : Universe of asset to purchase

xi: Amount of asset i to hold

B: Budget

minx∈R|N|

+

{u(x) |

∑i∈N

xi = B

}

Markowitz: u(x)def= −αTx+ λxTQx

α: Expected returnsQ: Variance-covariance matrix of expected returnsλ: Risk aversion parameter

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 13 / 45

Page 28: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Portfolio Management

Portfolio Management

N : Universe of asset to purchase

xi: Amount of asset i to hold

B: Budget

minx∈R|N|

+

{u(x) |

∑i∈N

xi = B

}

Markowitz: u(x)def= −αTx+ λxTQx

α: Expected returnsQ: Variance-covariance matrix of expected returnsλ: Risk aversion parameter

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 13 / 45

Page 29: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Portfolio Management

More Realistic Models

b ∈ R|N | of “benchmark” holdings

Benchmark Tracking: u(x)def= (x− b)TQ(x− b)

Constraint on E[Return]: αTx ≥ r

Limit Names: |i ∈ N : xi > 0| ≤ KUse binary indicator variables to model the implication xi > 0⇒ yi = 1Implication modeled with variable upper bounds:

xi ≤ Byi ∀i ∈ N∑i∈N yi ≤ K

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 14 / 45

Page 30: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Portfolio Management

More Realistic Models

b ∈ R|N | of “benchmark” holdings

Benchmark Tracking: u(x)def= (x− b)TQ(x− b)

Constraint on E[Return]: αTx ≥ rLimit Names: |i ∈ N : xi > 0| ≤ K

Use binary indicator variables to model the implication xi > 0⇒ yi = 1Implication modeled with variable upper bounds:

xi ≤ Byi ∀i ∈ N∑i∈N yi ≤ K

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 14 / 45

Page 31: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Portfolio Management

Even More Models

Min Holdings: (xi = 0) ∨ (xi ≥ m)

Model implication: xi > 0⇒ xi ≥ mxi > 0⇒ yi = 1⇒ xi ≥ mxi ≤ Byi, xi ≥ myi ∀i ∈ N

Round Lots: xi ∈ {kLi, k = 1, 2, . . .}xi − ziLi = 0, zi ∈ Z+ ∀i ∈ N

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 15 / 45

Page 32: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

MIP Models Portfolio Management

Even More Models

Min Holdings: (xi = 0) ∨ (xi ≥ m)

Model implication: xi > 0⇒ xi ≥ mxi > 0⇒ yi = 1⇒ xi ≥ mxi ≤ Byi, xi ≥ myi ∀i ∈ N

Round Lots: xi ∈ {kLi, k = 1, 2, . . .}xi − ziLi = 0, zi ∈ Z+ ∀i ∈ N

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 15 / 45

Page 33: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Motivation

Modeling Complicated Logical Relationships

It is often quite difficult1 to quickly see how one can writecomplictaed logical conditions as algebraic conditions (that can thenbe implemented in an algebraic modeling language like AMPL)

What follows is the derivation of a kind of “calculus” for automaticallyconverting logical conditions into equivalent algebraic ones

Examples for UFL

1 If you open k or more facilities, then you must pay a penalty costof λ

2 If you open facility one or two, then you may not open both facility3 and 4

3 If facility 1 and 2 are both open, then customer 3 must get all ofhis demand from at most 1 facility

1At least for my puny brainJeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 16 / 45

Page 34: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Motivation

Modeling Complicated Logical Relationships

It is often quite difficult1 to quickly see how one can writecomplictaed logical conditions as algebraic conditions (that can thenbe implemented in an algebraic modeling language like AMPL)

What follows is the derivation of a kind of “calculus” for automaticallyconverting logical conditions into equivalent algebraic ones

Examples for UFL

1 If you open k or more facilities, then you must pay a penalty costof λ

2 If you open facility one or two, then you may not open both facility3 and 4

3 If facility 1 and 2 are both open, then customer 3 must get all ofhis demand from at most 1 facility

1At least for my puny brainJeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 16 / 45

Page 35: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Motivation

Modeling Complicated Logical Relationships

It is often quite difficult1 to quickly see how one can writecomplictaed logical conditions as algebraic conditions (that can thenbe implemented in an algebraic modeling language like AMPL)

What follows is the derivation of a kind of “calculus” for automaticallyconverting logical conditions into equivalent algebraic ones

Examples for UFL

1 If you open k or more facilities, then you must pay a penalty costof λ

2 If you open facility one or two, then you may not open both facility3 and 4

3 If facility 1 and 2 are both open, then customer 3 must get all ofhis demand from at most 1 facility

1At least for my puny brainJeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 16 / 45

Page 36: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Forcing Constraints to Hold

A “Calculus” for Logical Modeling

Variable = 1 ⇒ constraint must be satisfied

Suppose we wish to have a constraint hold if an associatedindicator variable δ is flipped to 1. That is...

δ = 1⇒∑

j∈N ajxj ≤ b

This can be represented by the constraint∑j∈N ajxj +Mδ ≤M + b

M is an upper bound for the expression∑

j∈N ajxj − b.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 17 / 45

Page 37: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Forcing Constraints to Hold

A “Calculus” for Logical Modeling

Variable = 1 ⇒ constraint must be satisfied

Suppose we wish to have a constraint hold if an associatedindicator variable δ is flipped to 1. That is...

δ = 1⇒∑

j∈N ajxj ≤ b

This can be represented by the constraint∑j∈N ajxj +Mδ ≤M + b

M is an upper bound for the expression∑

j∈N ajxj − b.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 17 / 45

Page 38: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Forcing Constraints to Hold

The Logic

δ = 1⇒∑

j∈N ajxj ≤ b⇔∑

j∈N ajxj +Mδ ≤M + b

Equivalent to∑

j∈N ajxj − b ≤M(1− δ)δ = 0⇒

∑j∈N ajxj − b ≤M

(true by definition of M)

δ = 1⇒∑

j∈N ajxj − b ≤ 0

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 18 / 45

Page 39: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

Modeling Trick #2: Converse of First

∑j∈N ajxj ≤ b⇒ δ = 1

δ = 0⇒∑

j∈N ajxj 6≤ bδ = 0⇒

∑j∈N ajxj > b

δ = 0⇒∑

j∈N ajxj ≥ b+ ε

If aj , xj are integer, we can choose ε = 1

Model as∑

j∈N ajxj − (m− ε)δ ≥ b+ ε

m is a lower bound for the expression∑

j∈N ajxj − bδ = 0 :

∑j∈N ajxj ≥ b+ ε

δ = 1 : m ≤∑

j∈N ajxj − b (nothing)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 19 / 45

Page 40: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

Modeling Trick #2: Converse of First

∑j∈N ajxj ≤ b⇒ δ = 1

δ = 0⇒∑

j∈N ajxj 6≤ bδ = 0⇒

∑j∈N ajxj > b

δ = 0⇒∑

j∈N ajxj ≥ b+ ε

If aj , xj are integer, we can choose ε = 1

Model as∑

j∈N ajxj − (m− ε)δ ≥ b+ ε

m is a lower bound for the expression∑

j∈N ajxj − bδ = 0 :

∑j∈N ajxj ≥ b+ ε

δ = 1 : m ≤∑

j∈N ajxj − b (nothing)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 19 / 45

Page 41: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

Modeling Trick #2: Converse of First

∑j∈N ajxj ≤ b⇒ δ = 1

δ = 0⇒∑

j∈N ajxj 6≤ bδ = 0⇒

∑j∈N ajxj > b

δ = 0⇒∑

j∈N ajxj ≥ b+ ε

If aj , xj are integer, we can choose ε = 1

Model as∑

j∈N ajxj − (m− ε)δ ≥ b+ ε

m is a lower bound for the expression∑

j∈N ajxj − bδ = 0 :

∑j∈N ajxj ≥ b+ ε

δ = 1 : m ≤∑

j∈N ajxj − b (nothing)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 19 / 45

Page 42: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

Some Last Modeling Tricks

δ = 1⇒∑

j∈N ajxj ≥ b

Model as∑

j∈N ajxj +mδ ≥ m+ b

∑j∈N ajxj ≥ b⇒ δ = 1

Model as∑

j∈N ajxj − (M + ε)δ ≤ b− ε

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 20 / 45

Page 43: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

The Slide of Tricks

δ = 1⇒∑

j∈N ajxj ≤ b∑j∈N ajxj +Mδ ≤M + b∑

j∈N ajxj ≤ b⇒ δ = 1∑j∈N ajxj − (m− ε)δ ≥ b+ ε

δ = 1⇒∑

j∈N ajxj ≥ b∑j∈N ajxj +mδ ≥ m+ b∑

j∈N ajxj ≥ b⇒ δ = 1∑j∈N ajxj − (M + ε)δ ≤ b− ε

∑j∈N ajxj : Constraint

LHS

b: Constraint RHS

M : Upper bound on∑j∈N ajxj − b

m: Lower bound on∑j∈N ajxj − b

ε: Constraint violationamount (ε = 0.01or1)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 21 / 45

Page 44: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

Simple Tricks

These two tricks are very common and can be derived from the “Slideof Tricks”

Variable Upper Bound: x > 0⇒ δ = 1

x ≤Mδ

Variable Lower Bound: δ = 1⇒ x ≥ mx ≥ mδ

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 22 / 45

Page 45: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

Recall UFL

min∑i∈I

fiyi +∑i∈I

∑j∈J

cijxij

subject to

xij ≤ yi ∀i ∈ I, ∀j ∈ J∑i∈I

xij = 1 ∀j ∈ J

xij ≥ 0 ∀i ∈ I, ∀j ∈ Jyi ∈ {0, 1} ∀i ∈ I

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 23 / 45

Page 46: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

UFL 1

If you open k or more facilities, then you must pay a penalty cost of λ

Need (earlier) “fixed cost” logic for yi : (xij ≤ yi)Model

∑i∈M yi ≥ k ⇒ δ1 = 1

Add λδ1 to objective function

Appropriate trick is∑j∈N

ajxj ≥ b⇒ δ = 1⇔∑j∈N

ajxj − (M + ε)δ ≤ b− ε

M = |I| − k. ε = 1:∑i∈I

yi − (|I| − k + 1)δ1 ≤ k − 1.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 24 / 45

Page 47: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

UFL 1

If you open k or more facilities, then you must pay a penalty cost of λ

Need (earlier) “fixed cost” logic for yi : (xij ≤ yi)Model

∑i∈M yi ≥ k ⇒ δ1 = 1

Add λδ1 to objective function

Appropriate trick is∑j∈N

ajxj ≥ b⇒ δ = 1⇔∑j∈N

ajxj − (M + ε)δ ≤ b− ε

M = |I| − k. ε = 1:∑i∈I

yi − (|I| − k + 1)δ1 ≤ k − 1.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 24 / 45

Page 48: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

UFL 1

If you open k or more facilities, then you must pay a penalty cost of λ

Need (earlier) “fixed cost” logic for yi : (xij ≤ yi)Model

∑i∈M yi ≥ k ⇒ δ1 = 1

Add λδ1 to objective function

Appropriate trick is∑j∈N

ajxj ≥ b⇒ δ = 1⇔∑j∈N

ajxj − (M + ε)δ ≤ b− ε

M = |I| − k. ε = 1:∑i∈I

yi − (|I| − k + 1)δ1 ≤ k − 1.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 24 / 45

Page 49: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

UFL 2

If you open facility one or two, then you may not open both facility 3and 4

Then need to model y1 + y2 ≥ 1⇒ y3 + y4 ≤ 1

y1 + y2 ≥ 1⇒ δ2 = 1δ2 = 1⇒ y3 + y4 ≤ 1

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 25 / 45

Page 50: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

UFL 2

If you open facility one or two, then you may not open both facility 3and 4

Then need to model y1 + y2 ≥ 1⇒ y3 + y4 ≤ 1

y1 + y2 ≥ 1⇒ δ2 = 1δ2 = 1⇒ y3 + y4 ≤ 1

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 25 / 45

Page 51: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

UFL 2, cont.

First trick is:∑j∈N

ajxj ≥ b⇒ δ = 1⇔∑j∈N

ajxj − (M + ε)δ ≤ b− ε

M = 1, ε = 1:y1 + y2 − 2δ2 ≤ 0.

(Note: could also model (better) as δ2 ≥ y1, δ2 ≥ y2)

Second trick is:

δ = 1⇒∑j∈N

ajxj ≤ b⇔∑j∈N

ajxj +Mδ ≤M + b

M = 1, ε = 1:y3 + y4 + δ2 ≤ 2.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 26 / 45

Page 52: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

UFL 3

If facility 1 and 2 are both open, then customer 3 must get all of hisdemand from at most 1 facility

Need indicator variables xij > 0⇒ zij = 1 (xij ≤ zij∀i ∈ I, j ∈ J)

Then model y1 + y2 ≥ 2⇒∑

i∈I zi3 ≤ 1

y1 + y2 ≥ 2⇒ δ3 = 1δ3 = 1⇒

∑i∈I zi3 ≤ 1

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 27 / 45

Page 53: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

UFL 3

If facility 1 and 2 are both open, then customer 3 must get all of hisdemand from at most 1 facility

Need indicator variables xij > 0⇒ zij = 1 (xij ≤ zij∀i ∈ I, j ∈ J)

Then model y1 + y2 ≥ 2⇒∑

i∈I zi3 ≤ 1

y1 + y2 ≥ 2⇒ δ3 = 1δ3 = 1⇒

∑i∈I zi3 ≤ 1

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 27 / 45

Page 54: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

A “Calculus” for MIP Modeling Constraint Holds Implies Variable = 1

UFL 3

First trick (for y1 + y2 ≥ 2⇒ δ3 = 1) is∑j∈N ajxj − (M + ε)δ ≤ b− ε

M = 0, ε = 1:y1 + y2 − δ3 ≤ 1

Second trick (for δ3 = 1⇒∑

i∈I zi3 ≤ 1) is∑j∈N ajxj +Mδ ≤M + b

M = |I| − 1 ∑i∈I

zi3 + (|I| − 1)δ3 ≤ |M |

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 28 / 45

Page 55: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

Piecewise Linear Functions

A very common structure used in modeling is a piecewise-linearfunction of a scalar variable x ∈ [B0, Bn]

f(x) = mix+ ci, x ∈ [Bi−1, Bi] ∀i = 1, . . . , n

Sample applications using PLFs

Gas network optimization [Martin et al.,2006]

Transmissions expansion planning[Alguacil et al., 2003]

Oil field development [Gupta andGrossmann, 2012]

Hydro Scheduling [Borghetti et al.,2008]

Thermal unit commitment [Carrion andArroyo, 2006]

Sales resource allocation [Lodish, 1971]

x

f(x)

F0

F1

F2 F3

B0 B1 B2 B3

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 29 / 45

Page 56: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

Modeling Piecewise-Linear Functions

There are many ways to model piecewise linear functions using integervariables. I really recommend Vielma et al. [2010], Vielma [2015] asreferences

Take Your Pick

Multiple Choice Model [Jeroslow and Lowe, 1984]

SOS2 Model [Beale and Tomlin, 1970, Beale and Forrest, 1976]

Incremental Model [Markowitz and Manne, 1957]

Convex Combination Model [Dantzig, 1960, Padberg, 2000]

Disaggregated Convex Combination Model [Meyer, 1976]

Logarithmic Model [Vielma et al., 2010]

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 30 / 45

Page 57: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

Multiple Choice Model

Want to model (∀i)

f(x) = mix+ci, x ∈ [Bi−1, Bi]

Introduce New Variables

bi: = 1 if x ∈ [Bi−1, Bi]

wi: = x if x ∈ [Bi−1, Bi]

t ≈ f(x)

x

f(x) ≈ sgn(x)|x|γ

B0 B1 B2

B3 B4

x =

n∑i=1

wi,

t =

n∑i=1

(miwi + cibi)

Bi−1bi ≤ wi ≤ Bibi ∀i ∈ [n]

1 =n∑i=1

bi

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 31 / 45

Page 58: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

Multiple Choice Model

Want to model (∀i)

f(x) = mix+ci, x ∈ [Bi−1, Bi]

Introduce New Variables

bi: = 1 if x ∈ [Bi−1, Bi]

wi: = x if x ∈ [Bi−1, Bi]

t ≈ f(x)

x

f(x) ≈ sgn(x)|x|γ

B0 B1 B2

B3 B4

x =

n∑i=1

wi,

t =

n∑i=1

(miwi + cibi)

Bi−1bi ≤ wi ≤ Bibi ∀i ∈ [n]

1 =n∑i=1

bi

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 31 / 45

Page 59: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

Multiple Choice Model

Want to model (∀i)

f(x) = mix+ci, x ∈ [Bi−1, Bi]

Introduce New Variables

bi: = 1 if x ∈ [Bi−1, Bi]

wi: = x if x ∈ [Bi−1, Bi]

t ≈ f(x)

x

f(x) ≈ sgn(x)|x|γ

B0 B1 B2

B3 B4

x =

n∑i=1

wi,

t =

n∑i=1

(miwi + cibi)

Bi−1bi ≤ wi ≤ Bibi ∀i ∈ [n]

1 =n∑i=1

bi

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 31 / 45

Page 60: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

But Wait, There’s More

In many applications mentioned there is an additional binary indicatorvariable

If y = 0, then x = 0, and we would like the relationship t = f(x)“turned off”

Specifically (assuming WLOG f(0) = 0)

y = 0⇒ x = 0, t = f(x) = 0

The standard way2 is to introduce a “big-M” constraint:

x ≤ Bny

2The way done in all the papersJeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 32 / 45

Page 61: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

But Wait, There’s More

In many applications mentioned there is an additional binary indicatorvariable

If y = 0, then x = 0, and we would like the relationship t = f(x)“turned off”

Specifically (assuming WLOG f(0) = 0)

y = 0⇒ x = 0, t = f(x) = 0

The standard way2 is to introduce a “big-M” constraint:

x ≤ Bny

2The way done in all the papersJeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 32 / 45

Page 62: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

But Wait, There’s More

In many applications mentioned there is an additional binary indicatorvariable

If y = 0, then x = 0, and we would like the relationship t = f(x)“turned off”

Specifically (assuming WLOG f(0) = 0)

y = 0⇒ x = 0, t = f(x) = 0

The standard way2 is to introduce a “big-M” constraint:

x ≤ Bny

2The way done in all the papersJeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 32 / 45

Page 63: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

A Simple Trick

Instead of modeling the piecewise-linear indicator in the standard way:

B0y ≤ x ≤ Bny, 1 =

n∑i=1

bi

Model it as

y =

n∑i=1

bi

Resulting formulation is provably stronger (locally-ideal)

All piecewise-linear functions turned on/off by an indicator have asimilar modeling trick Sridhar et al. [2013]

It is the exact extension of the “perspective reformulation” (whichyou will learn in Friday lecture) to this case

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 33 / 45

Page 64: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

A Simple Trick

Instead of modeling the piecewise-linear indicator in the standard way:

B0y ≤ x ≤ Bny, 1 =

n∑i=1

bi

Model it as

y =

n∑i=1

bi

Resulting formulation is provably stronger (locally-ideal)

All piecewise-linear functions turned on/off by an indicator have asimilar modeling trick Sridhar et al. [2013]

It is the exact extension of the “perspective reformulation” (whichyou will learn in Friday lecture) to this case

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 33 / 45

Page 65: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

A Simple Trick

Instead of modeling the piecewise-linear indicator in the standard way:

B0y ≤ x ≤ Bny, 1 =

n∑i=1

bi

Model it as

y =

n∑i=1

bi

Resulting formulation is provably stronger (locally-ideal)

All piecewise-linear functions turned on/off by an indicator have asimilar modeling trick Sridhar et al. [2013]

It is the exact extension of the “perspective reformulation” (whichyou will learn in Friday lecture) to this case

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 33 / 45

Page 66: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

Multiple Choice ModelNot “Locally ideal”

x =

n∑i=1

wi,

t =

n∑i=1

(miwi + cibi),

Bi−1bi ≤ wi ≤ Bibi, ∀i ∈ [n]

x ≤ Bny,

1 =

n∑i=1

bi

“Locally Ideal”

x =n∑i=1

wi,

t =n∑i=1

(miwi + cibi),

Bi−1bi ≤ wi ≤ Bibi, ∀i ∈ [n]

y =

n∑i=1

bi

A formulation is locally ideal if every extreme point of the LPrelaxation satisfies the discrete requirements

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 34 / 45

Page 67: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling

Multiple Choice ModelNot “Locally ideal”

x =

n∑i=1

wi,

t =

n∑i=1

(miwi + cibi),

Bi−1bi ≤ wi ≤ Bibi, ∀i ∈ [n]

x ≤ Bny,

1 =

n∑i=1

bi

“Locally Ideal”

x =

n∑i=1

wi,

t =

n∑i=1

(miwi + cibi),

Bi−1bi ≤ wi ≤ Bibi, ∀i ∈ [n]

y =

n∑i=1

bi

A formulation is locally ideal if every extreme point of the LPrelaxation satisfies the discrete requirements

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 34 / 45

Page 68: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling Computational Comparison

Ad Budget Allocation ([Zoltners and Sinha, 1980])

Allocate advertising budget Damong a set K of advertisingstrategies for a set of J products.

Fixed cost Gj for entering themarket with product j ∈ J .

Variable cost cjk for each unit ofthe resource allocated to strategyk ∈ K of product j ∈ J .

Return on investment fjk(xjk)having S-curve type shape Investment x

Retu

rn o

n invest

ment f(x)

Variables

xjk: advertising resource allocated to strategy k ∈ K for product j ∈ J .

tjk = fjk(xjk) ∀j ∈ K,∀k ∈ K, yj ∈ {0, 1}∀j ∈ J

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 35 / 45

Page 69: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling Computational Comparison

Ad Budget Allocation ([Zoltners and Sinha, 1980])

Allocate advertising budget Damong a set K of advertisingstrategies for a set of J products.

Fixed cost Gj for entering themarket with product j ∈ J .

Variable cost cjk for each unit ofthe resource allocated to strategyk ∈ K of product j ∈ J .

Return on investment fjk(xjk)having S-curve type shape Investment x

Retu

rn o

n invest

ment f(x)

Variables

xjk: advertising resource allocated to strategy k ∈ K for product j ∈ J .

tjk = fjk(xjk) ∀j ∈ K,∀k ∈ K, yj ∈ {0, 1}∀j ∈ J

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 35 / 45

Page 70: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling Computational Comparison

MIP Formulation

max∑i∈J

∑j∈K

tjk∑i∈J

∑j∈K

cjkxjk +∑i∈J

Gjyj ≤ D

(xjk, tjk, yj) ∈ Xjk ∀j ∈ J , k ∈ K.

You must model a PW-Linear function for each j ∈ J , k ∈ K

Xjk := {(x, t, y) ∈ R+ × R+ × {0, 1} |y = 1⇒ t = fjk(x), y = 0⇒ x = t = 0}

How well does it work, you ask?

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 36 / 45

Page 71: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling Computational Comparison

MIP Formulation

max∑i∈J

∑j∈K

tjk∑i∈J

∑j∈K

cjkxjk +∑i∈J

Gjyj ≤ D

(xjk, tjk, yj) ∈ Xjk ∀j ∈ J , k ∈ K.

You must model a PW-Linear function for each j ∈ J , k ∈ K

Xjk := {(x, t, y) ∈ R+ × R+ × {0, 1} |y = 1⇒ t = fjk(x), y = 0⇒ x = t = 0}

How well does it work, you ask?

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 36 / 45

Page 72: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling Computational Comparison

Ta Da!

Standard Formulation New FormulationAvg. Time 703 sec. 17 sec.Max Time >3600 sec. 509 sec.Avg. Nodes 402.9 26.3Max Nodes >1572 140

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 37 / 45

Page 73: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling Computational Comparison

CDFs of nodes/times

0 800 1600 2400 3200MIP Solve time (s)

0.0

0.2

0.4

0.6

0.8

1.0

Fract

ion o

f data

sets

P(S2 ) P(S1 )

0 400 800 1200 1600Nodes

0.0

0.2

0.4

0.6

0.8

1.0

Fract

ion o

f data

sets

P(S2 ) P(S1 )

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 38 / 45

Page 74: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Piecewise Linear Modeling SOS2

SOS2 formulation for t = f(x)

x =

n∑i=0

Bi λi

t =

n∑i=0

Fi λi

1 =

n∑i=0

λi

λ is SOS2

SOS2: Special Ordered Set of Type 2

At most two nonzeros, must beadjacent

(Some) solvers will enforce

x

f(x)

F0

F1

F2 F3

B0 B1 B2 B3

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 39 / 45

Page 75: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

SOS2 Formulation

Strengthening is Easy-Peasy

Standard Formulation

x =n∑i=0

Bi λi,

t =

n∑i=0

Fi λi

1 =n∑i=0

λi,

λ is SOS2

x ≤ Bny

Stronger and More Compact

x =

n∑i=0

Bi λi

t =

n∑i=0

Fi λi

y =

n∑i=0

λi,

λ is SOS2

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 40 / 45

Page 76: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

SOS2 Formulation

Strengthening is Easy-Peasy

Standard Formulation

x =n∑i=0

Bi λi,

t =

n∑i=0

Fi λi

1 =n∑i=0

λi,

λ is SOS2

x ≤ Bny

Stronger and More Compact

x =

n∑i=0

Bi λi

t =

n∑i=0

Fi λi

y =

n∑i=0

λi,

λ is SOS2

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 40 / 45

Page 77: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

SOS2 Formulation

Economies of Scale: Example

We need to buy b items from a set of suppliers I.

B: Set of Cost Breakpointscib: Per Units cost of item from supplier i ∈ I in cost region b ∈ Bvib: Maximum number of item from supplier i ∈ I to purchase inregion b ∈ Bαi: Maximum percentage to purchase from any supplier

The adjacency conditions of SOS2 are enforced by the solutionalgorithm

Commercial solvers allow you to specify SOS2.

In AMPL, the translation is done automatically for you if you use thespecial piecewise notation. (See Chapter 17 of AMPL Book)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 41 / 45

Page 78: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

SOS2 Formulation

Economies of Scale: Example

We need to buy b items from a set of suppliers I.

B: Set of Cost Breakpointscib: Per Units cost of item from supplier i ∈ I in cost region b ∈ Bvib: Maximum number of item from supplier i ∈ I to purchase inregion b ∈ Bαi: Maximum percentage to purchase from any supplier

The adjacency conditions of SOS2 are enforced by the solutionalgorithm

Commercial solvers allow you to specify SOS2.

In AMPL, the translation is done automatically for you if you use thespecial piecewise notation. (See Chapter 17 of AMPL Book)

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 41 / 45

Page 79: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

SOS2 Formulation

Example:

table COST()

COST 1 2 3

1 9.2 9 7

2 9 8.5 8.3

3 11 8.5 7.5

;

table BR()

BR 0 1 2 3

1 0 100 200 1000

2 0 50 250 2000

3 0 100 300 4000

;

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 42 / 45

Page 80: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

SOS2 Formulation

ModelVariables

xi: Amount to purchase from supplier i ∈ Iλib: Convex combination multipliers for each xi ∈ I

min∑i∈I

∑b∈B

γibλib

∑b∈B

vibλib = xi ∀i ∈ I∑b∈B

λib = 1 ∀i ∈ I

xi ≤ αib ∀i ∈ I∑i∈I

xi ≥ b

λib SOS2 ∀i ∈ I xi ≥ 0 ∀i ∈ I

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 43 / 45

Page 81: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

SOS2 Formulation

ModelVariables

xi: Amount to purchase from supplier i ∈ Iλib: Convex combination multipliers for each xi ∈ I

min∑i∈I

∑b∈B

γibλib

∑b∈B

vibλib = xi ∀i ∈ I∑b∈B

λib = 1 ∀i ∈ I

xi ≤ αib ∀i ∈ I∑i∈I

xi ≥ b

λib SOS2 ∀i ∈ I xi ≥ 0 ∀i ∈ IJeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 43 / 45

Page 82: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

SOS2 Formulation

AMPL Code

1 set I;

2

3 param cost1{i in I} >= 0;

4 param cost2{i in I} >= 0;

5 param cost3{i in I} >= 0;

6

7 param limit1{i in I};

8 param limit2{i in I} >= limit1[i];

9 param b;

10 param alpha{I} >= 0;

11

12 var x{i in I} >= 0, <= alpha[i] * b;

13

14 minimize Cost: sum{i in I} << limit1[i], limit2[i];

15 cost1[i], cost2[i], cost3[i]>> x[i];

16

17 subject to BuyEnough:

18 sum{i in I} x[i] >= b;

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 44 / 45

Page 83: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

SOS2 Formulation

Conclusions

Integer programming is everywhere!

Learned a “calculus” for turning logical restrictions into algebraicdecriptions

Introduction to modeling piecewise linear functions.

Including how to strengthen PW-linear with “on off” constraints

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 45 / 45

Page 84: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

References

Natalia Alguacil, Alexis L. Motto, and Antonio J. Conejo. Transmission expansion planning: amixed-integer LP approach. IEEE Trans. Power Systems, 18:1070–1077, 2003.

E. M. L. Beale and J. J. H. Forrest. Global optimization using special ordered sets.Mathematical Programming, 10:52–69, 1976.

E. W. L. Beale and J. A. Tomlin. Special facilities in a general mathematical programmingsystem for non-convex problems using ordered sets of variables. In J. Lawrence, editor,Proceedings of the 5th International Conference on Operations Research, pages 447–454,1970.

Alberto Borghetti, Senior Member, Claudia D Ambrosio, Andrea Lodi, and Silvano Martello. AnMILP Approach for Short-Term Hydro Scheduling and Unit Commitment WithHead-Dependent Reservoir. IEEE Trans. Power Systems, 23(3):1115–1124, 2008.

M Carrion and J M Arroyo. A Computationally Efficient Mixed-Integer Linear Formulation forthe Thermal Unit Commitment Problem. IEEE Trans. Power Systems, 21(3):1371–1378,2006. ISSN 08858950. doi: 10.1109/TPWRS.2006.876672. URLhttp://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?arnumber=1664974.

George Bernard Dantzig. On the significance of solving linear programming problems with someinteger variables. Econometrica, 28:30–44, 1960.

E. B. Fisher, R. P. O’Neill, and M.C. Ferris. Optimal transmission switching. IEEE Transactionson Power Systems, pages 1346–1355, 2008.

Vijay Gupta and Ignacio E. Grossmann. An Efficient Multiperiod MINLP Model for OptimalPlanning of Offshore Oil and Gas Field Infrastructure. Ind. & Eng. Chem. Res., 51(19):6823–6840, May 2012. ISSN 0888-5885. doi: 10.1021/ie202959w. URLhttp://pubs.acs.org/doi/abs/10.1021/ie202959w.

R. G. Jeroslow and J. K. Lowe. Modeling with integer variables. Mathematical ProgrammingStudies, 22:167–184, 1984.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 45 / 45

Page 85: Integer Programming Modeling › materials › 2015-2016 › ND8.1-12.16 › ... · 2016-08-22 · Integer Programming Modeling IMA New Directions Short Course on Mathematical Optimization

Bibliography

LM Lodish. CALLPLAN: An interactive salesman’s call planning system. Manag. Sci., 18(4),1971. URL http://mansci.journal.informs.org/content/18/4-Part-II/P-25.short.

Harry M. Markowitz and Alan S. Manne. On the solution of discrete programming problems.Econometrica, 25(1):84–110, 1957.

Alexander Martin, Markus Moller, and Susanne Moritz. Mixed Integer Models for the StationaryCase of Gas Network Optimization. Math. Program., 105:563–582, 2006.

R. R. Meyer. Integer and mixed-integer programming models: General properties. Journal ofOptimization Theory and Applications, 16:191–206, 1976.

M. Padberg. Approximating separable nonlinear functions via mixed zero-one programs.Operations Research Letters, 27(1):1–5, 2000.

S. Sridhar, J. Linderoth, and J. Luedtke. Locally ideal formulations for piecewise linear functionswith indicator variables. Operations Research Letters, 41:627–632, 2013.

J. P. Vielma. Mixed integer linear programming formulation techniques. SIAM Review, 57:3–57,2015.

J. P. Vielma, S. Ahmed, and G. Nemhauser. Mixed-integer models for nonseparable piecewiselinear optimization: Unifying framework and extensions. Operations Research, 58:303–315,2010.

AA Zoltners and Prabhakant Sinha. Integer programming models for sales resource allocation.Manag. Sci., 26(3):242–260, 1980. URLhttp://mansci.journal.informs.org/content/26/3/242.short.

Jeff Linderoth (UW-Madison) Integer Programming Modeling Lecture Notes 45 / 45