0% found this document useful (0 votes)
10 views132 pages

Optimiztion

Uploaded by

dhanush.shriram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views132 pages

Optimiztion

Uploaded by

dhanush.shriram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 132

Classical Optimization:

Unconstrained Optimization

MIT Center for


Transportation & Logistics ctl.mit.edu
1
Three Motivating Problems

• Profit Maximization - iWidget


n Given cost and demand functions, find the price for the iWidget that
produces maximum profit.

• Inventory Replenishment Policy – Gears Unlimited


n Given annual demand and transportation and holding costs, calculate
the re-order quantity that minimizes total cost.

• Package Optimization – boxy.com


n Calculate the package dimensions that maximize total usable volume
given a specific cardboard sheet.

2
Common Features
• Each of these problems . . .
n Requires the use of a Prescriptive Model,
n Utilizes a math function to make the decision,
n Looks for an “extreme point” solution, and
n Are unconstrained in that there is not a resource limit.
• What is an extreme point of a function?
n The point, or points, where the function takes on an
extreme value, typically either a minimum or a maximum.
n The point(s) where the slope or “rate of change” of the
function is equal to zero.

3
Extreme Points
• Types of Extreme points
n Minimum, Maximum, or Inflection Points
n The minimum and maximum points are either global or local

Inflection
y Point Global
Local Maximum Maximum

Local Minimum x
Global Minimum

How do we find these “extreme point” solutions?


We’ll use differential calculus to find where the slope is equal to zero!
(relax – it really is easier than you might think!)
4
Classical Optimization

5
Classical Optimization
• Use differential calculus to find extreme solutions
n Look for where the rate of change, the slope, goes to zero
n Check for sufficiency conditions
n Continuity and convexity come into play

• Example: iWidget
n We are manufacturing a product where we know:
w The cost function = f(# made) = 500,000 + 75x
w The demand function = f(price) = 20,000 – 80p
w And therefore the profit function = -80p2 + 26,000p – 2,000,000
n We want to find the price, p, that maximizes profits.

6
iWidget Approximate slope from price=$170 to p=$171
the profit decreases from $108,000 to $106,720
Profit = -80p2 +26,000p – 2,000,000 Slope = rise/run = -$1,280 / $1 = -1,280
$125,000

$100,000

$75,000

$50,000 At the extreme point, “instantaneous” slope = 0


$25,000 1. How do I calculate “instantaneous” slope?
2. How do I find this point besides creating a graph?
Total Profit ($)

$-
$100 $110 $120 $130 $140 $150 $160 $170 $180 $190 $200 $210 $220
$(25,000)

$(50,000) Approximate slope from price=$140 to p=$145


the profit increases from $72,000 to $88,000
$(75,000)
Slope = rise/run = $16,000 / $5 = 3,200
$(100,000)

$(125,000)

$(150,000) Approximate slope from price=$110 to p=$115


the profit increases from -$108,000 to -$68,000
$(175,000)
Slope = rise/run = $40,000 / $5 = 8,000
$(200,000)
Price of iWidget ($/item)

7
Finding the Instantaneous Slope:
The First Derivative

8
Calculating Instantaneous Slope
Different nomenclature
• Given any function, y=f(x), we define y’=f’(x) as is often used, but they
all mean the same thing
the instantaneous rate of change at point x. – the instantaneous rate
of change of function f
⎛ f ( x + δ ) − f ( x) ⎞ with respect to x.
f '( x) = lim ⎜ ⎟
δ →0 δ
⎝ ⎠ dy
y' = f '(x) =
• Example: Suppose we have f(x) = -4x2 + 5x. dx

⎛⎡ 2 ⎤ ⎡ 2 ⎤⎞
⎜ ⎢⎣(
−4 x +)δ (
+5 x +δ ) −
⎥⎦ ⎣−4x + 5x ⎦⎟ ⎛ −4 x 2 + 2δ x + δ 2 + 5x + 5δ + 4x 2 − 5x ⎞
( )
f '(x) = ⎜ ⎟ =⎜ ⎟
⎜ δ ⎟ ⎜ δ ⎟
⎝ ⎠
⎝ ⎠
⎛ −4x 2 − 8δ x − 4δ 2 + 5x + 5δ + 4x 2 − 5x ⎞ ⎛ −4x 2 + 4x 2 + 5x − 5x − 8δ x + 5δ − 4δ 2 ⎞
=⎜ ⎟ =⎜ ⎟
⎝ δ ⎠ ⎝ δ ⎠
But, as δ approaches zero, this becomes:
⎛ −8δ x + 5δ − 4δ 2 ⎞
=⎜ ⎟ = −8x + 5− 4δ ()
y ' = f ' x = −8x + 5
⎝ δ ⎠
Which is the function that gives me
the instantaneous slope at any point! 9
y=f(x) = -4x^2 + 5x
$4

$2

$-
-1 -0.75 -0.5 -0.25 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2
$(2)

$(4)
The extreme point occurs where slope = 0!
$(6) So, to find the extreme point, simply:
1. Take the first derivative of your function,
$(8) 2. Set it equal to zero, and
3. Solve for x*, the value of x at extreme point.
$(10)
This is called the First Order Condition!

y'=f'(x)=-8x+5 The instantaneous slope at x


15

10
f'(x) Slope at Point x

0
-1 -0.75 -0.5 -0.25 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2
-5

-10

-15

10
Rule for Differentiation
• Luckily, we have some simple rules for finding derivatives!
y = f (x) = a è y ' = f '(x) = 0
y = f (x) = ax n è y ' = f '(x) = anx n−1
It is a linear function! The slope of a
y=3x + 12 = 3x1 + 12 y’=3(1)x(1-1) + 0 = 3 linear function does not change!

y=-4x2 +5x y’=-4(2)x(2-1) +5(1)x(1-1) = -8x + 5 Finding x* => -8x+5 = 0 or -8x=-5


so x*=5/8 = 0.625

y=4/x + 3x y’=4(-1)x(-1-1) +3(1)x(1-1) = -4x-2 + 3 Finding x* => -4x-2+3 = 0


= 4x-1+3x1 or -4x-2= -3 or 4 = 3x2
so x*=√(4/3) = 1.15

There are many different shortcuts and rules for finding derivatives of more
complex functions – but we will use the Power Rule almost all of the time.
11
Solving the iWidget Problem

12
iWidget Solution
• Find the price, p, that maximizes the profit function:
y = -80p2 + 26,000p – 2,000,000
• Solution
1. Take the first derivative:
y’ = dy/dp = -80(2)p(2-1) + 26,000(1)p(1-1) = -160p + 26,000
2. Set the first derivative equal to zero:
-160p + 26,000 = 0
3. Solve for p*:
-160p = -26,000 so that p*= 26,000 / 160
p* = $162.50

Set price at $162.50 in order to maximize profit.


Expected profit will be $112,500.
profit = (-80)(162.5)2 +(26,000)(162.5) – 2,000,000
13
Two Questions . . .
1. How do I know this is a maximum and not a minimum?
2. How do I know whether this is global or local?

Necessary and Sufficient Conditions


• In order to determine x* at the max/min of an unconstrained function:
• Necessary Condition – the slope has to be zero, that is, f’(x*)=0
• Sufficient Conditions – determines whether extreme point is min or max
by taking the Second Derivative, f’’(x).
n If f’’(x) > 0 then the extreme point is a local minimum
n If f’’(x) < 0 then the extreme point is a local maximum
n If f’’(x) = 0 then it is inconclusive
• Special Cases (yea!)
n If f(x) is convex then f(x*) is a global minimum
n If f(x) is concave then f(x*) is global maximum

14
iWidget Solved
• By observation, we know that p*=162.50 is a global optimal,
but lets do it formally.

• Checking Second Order Conditions


n y = f(p) = -80p2 + 26,000p – 2,000,000
n y’ = f’(p) = -160p + 26,000
n y’’ = f’’(p) = (-160)(1)p(1-1) = -160

• Because -160 < 0 , this is local maximum

• But, since f(p) is a concave function, we know that it is a


global maximum!

15
Example: Gears Unlimited

16
Gears Unlimited
Inventory Replenishment Policy
Gears Unlimited distributes specialty gears, derailleurs, and brakes for high-end
mountain and BMX bikes. One of their most steady selling items is the PK35
derailleur. They sell about 1500 of the PK35’s a year. They cost $75 each to procure
from a supplier and Gears Unlimited assumes that the cost of capital is 20% a year. It
costs about $350 to place and receive an order of the PK35s, regardless of the
quantity of the order.
How many PK35s should Gears Unlimited order at a time to minimize the average
annual cost in terms of purchase cost, ordering costs, and holding costs?
1. What do we know? 3. What is my objective function?
D = Demand = 1,500 items/year TotalCost = PurchaseCost + OrderCost + HoldingCost
c = Unit cost = 75 $/item Purchase Cost = cD = (75)(1500) = 112,500 $/yr
A = Ordering cost = 350 $/order OrderCost = A(D/Q) = (350)(1500)/Q = 525,000/Q $/yr
r = Cost of capital = 0.20 $/$/year HoldingCost = rc(Q/2) = (.20)(75)(Q/2) = 7.5Q $/yr

2. What do we want to find? Q


Q/2
Q = Order Quantity (items/order)
Find Q* that minimizes Total Cost TC(Q) = cD +A(D/Q) + rc(Q/2)
TC(Q) = 112,500 + 525,000/Q + 7.5Q
Image CC0 Public Domain from pixabay.com 17
Gears Unlimited Solution
1. Determine the Objective Function
TC = f(Q) = cD +A(D/Q) + rc(Q/2)
= 112,500 + 525,000/Q + 7.5Q
2. Take first derivative
f’(Q) = 0 + (525,000)(-1)Q(-1-1) + (7.5)(1)Q(1-1)
= -525,000/Q2 + 7.5
3. Set 1st derivative equal to zero and solve for Q*
f’(Q*) = -525,000/Q*2 + 7.5 = 0
-525,000/Q*2 = -7.5
Q*2 = 525,000/7.5 = 70,000
Q* = √(70,000) = 264.6 ≅ 265 items/order
4. Check 2nd order conditions
f’’(Q*) = -525,000(-2)/Q*3 = (1,050,000)/Q*3 > 0
Because Q* will always be greater than zero,
we know that this Q* is a local minimum.

18
Gears Unlimited – Total Cost Function
Total Cost (Q)
$160,000 TC(Q) = 112,500 + 525,000/Q + 7.5Q
$150,000
Optimal Order Quantity, Q*
$140,000 Q* = 265 items/order
Total Cost (Q*) = 116,469 $/year
$130,000

$120,000

$110,000

$100,000 Things to Note:


• The function is asymptotic to 0, so it is not
$90,000
globally convex or concave!
• However, for all practical values of Q, that
$80,000
is, >0, we are actually convex! Let’s zoom in!
$70,000

$60,000
-500 -450 -400 -350 -300 -250 -200 -150 -100 -50 0 50 100 150 200 250 300 350 400 450 500
Order Quantity (Q)

19
Gears Unlimited – Total Cost Function
$126,000

$125,000 Things to Note:


• It is easier to see that the function is convex for Q>0
$124,000 when we zoom in.
• Note that the curve is not symmetric – it is much
$123,000 steeper as Q decreases, then if Q increases!

$122,000

$121,000

$120,000
Optimal Order Quantity, Q*
Q* = 265 items/order
$119,000
Total Cost (Q*) = 116,469 $/year
$118,000

$117,000

$116,000
0 25 50 75 100 125 150 175 200 225 250 275 300 325 350 375 400 425 450 475 500
Order Quantity (Q)

20
Example: boxy.com

21
boxy.com
Optimal Design
You are consulting with boxy.com, the premier online corrugated packaging company.
They just received a large quantity of heavy duty cardboard from a third party at an
extremely low cost. All of the sheets are 1 meter by 1.5 meters in dimension. You
have been asked to come up with the design that maximizes the total volume of a box
made from this sheet. The only cutting that can be made, however, are equal-sized
squares from each of the four corners. The edges then fold up to form the box.
How big should the square cut-outs be to maximize the box’s volume?
x
1. What do we know?
W= Width = 1 m

1.0 m
L = Length = 1.5 m
x = Height of box (also the amount cut)

2. What do we want to find? 1.5 m


Find x* that maximizes Volume
V = Volume = (Width)(Length)(Height) 3. What is my objective function?
= (W-2x)(L-2x)(x) max V = (W-2x)(L-2x)(x)
= (WL-2xL-2Wx+4x2)x = 4x3-2Wx2-2Lx2+WLx
= 4x3 – 2x2 – 3x2+1.5x = 4x3-5x2+1.5x
Image CC0 Public Domain from pixabay.com. Problem adapted from www.math.ucdavis.edu 22
x

boxy.com Solution

1.0 m
1. Determine the Objective Function
V = f(x) = = 4x3-2Wx2-2Lx2+WLx
1.5 m
= 4x3-5x2+1.5x
2. Take first derivative
f’(x) = (4)(3)x(3-1) – (5)(2)x(2-1) +1.5(1)x(1-1) Recall . . .
= 12x2 – 10x +1.5 y = ax 2 + bx + c
− b ± b 2 − 4ac
3. Set 1st derivative equal to zero and solve for x* r1 ,r2 =
2a
f’(x*) = 12x2 – 10x +1.5 = 0

= 0.637m ✗
10 + 28
2
−(−10)± (−10) − 4 (12) (1.5) 10 ± 100 − 72 10 ± 28 r1 =
r1, r2 = = = 24
2 (12) 24 24 10 − 28
r2 = = 0.196m ✔
4. Check 2nd order conditions 24
f’’(x*) = 12 (2)x* - 10(1) = 24x* - 10 < 0
The function at x*=0.196 is a local maximum.
Maximum volume = 0.132 m3

23
boxy.com Optimal Cut-Out, x* = 0.196 m
Max Volume (x*) = 0.132 m3
Things to Note:
0.14 • As x increases beyond .5m, the volume
increases dramatically – but we cannot
cut out more than 0.5 m!
0.12 • Within the “feasible region” of 0<x<0.5
the volume function is concave
• The second root (x=0.637) is not feasible
0.10
Box Volume (cubic meters)

0.08

0.196
0.06
0.608 m

0.04

0.02 1.108 m

-
- 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50
Size of corner cut-out (meters)

24
Key Points from Lesson

25
Key Points from Lesson
Power Rule
• Unconstrained Optimization
y = f (x) = ax n ⇒ y ' = f '(x) = anx n−1
n Extreme points of a function
n Typically minimums or maximums
n Extreme points occur where slope = 0
• To Find Extreme Point Solutions, f(x*)
n First Order (Necessary) Condition
w f’(x*) = 0
w First derivative used to find instantaneous rate of change
n Second Order (Sufficiency) Condition
w If f’’(x) > 0 then the extreme point is a local minimum
w If f’’(x) < 0 then the extreme point is a local maximum
w If f’’(x) = 0 then it is inconclusive
w If f(x) is convex then f(x*) is a global minimum
w If f(x) is concave then f(x*) is global maximum

26
Questions, Comments, Suggestions?
Use the Discussion Forum!

“Griffin and Cody wish they were unconstrained”


Yankee Golden Retriever Rescued Dogs
(www.ygrr.org)
MIT Center for [email protected]
Transportation & Logistics ctl.mit.edu
Constrained Optimization

MIT Center for


Transportation & Logistics ctl.mit.edu
1
Motivating Problem – Banner Chemicals
• Situation
n Banner Chemicals manufactures specialty chemicals. One of their products
comes in two grades, high and supreme. The capacity at the plant is 110
barrels per week.
n The high and supreme grade products use the same basic raw materials but
require different ratios of additives. The high grade requires 3 gallons of
additive A and 1 gallon of additive B per barrel while the supreme grade
requires 2 gallons of additive A and 3 gallons of additive B per barrel.
n The supply of both of these additives is quite limited. Each week, this product
line is allocated only 300 gallons of additive A per week and 280 gallons of
additive B.
n A barrel of the high grade has a profit margin of $80 per barrel while the
supreme grade has a profit margin of $200 per barrel.
• Question
n How many barrels of High and Supreme grade should Banner Chemicals
produce each week?

2
How does this differ from our earlier problems?

n Similarities
w Requires a prescriptive model
w Uses an objective function
w Solution is an extreme value

n Differences
w Multiple decision variables
w Constraints on resources

3
• What approach will we take?
n Math Programming
w Powerful family of optimization methods
w Different techniques and methodologies
§ Linear Programming (LPs)
§ Integer Programming (IPs)
§ Mixed Integer and Linear Programming (MILPs)
§ Non-linear Programming (NLPs)
n Why?
w The most widely used approach in Supply Chains
§ Designing networks, planning production, selecting transportation providers,
allocating inventory, scheduling port and terminal operations, fulfilling orders,
etc. etc. etc.
w Readily available
§ Embedded into most all supply chain decision support software tools
§ Included in most spreadsheet and other tools
w Best way to identify the “best” solution under limited resources

4
What will we do in this lesson?
• Problem Formulation
• Graphical Representation
• Sensitivity Analysis
• Formal Notation
• Anomalies

• What will we not cover?


n How to Solve Using Software (recitations)

5
Problem Formulation

6
Simple Problem Formulation Process
1. Determine the decision variables
n What are you trying to decide?
n What are their upper or lower bounds?
2. Formulate the objective function
n What are we trying to minimize or maximize?
n Must include the decision variables and the form of the
function determines approach (linear for LP)
3. Formulate each constraint
n What is my feasible region? What are my limits?
n Must include the decision variables and will almost
always be linear functions
7
Formulating – Banner Chemicals
• Situation
n Banner Chemicals manufactures specialty chemicals. One of their products comes in two
grades, high and supreme. The capacity at the plant is 110 barrels per week.
n The high and supreme grade products use the same basic raw materials but require different
ratios of additives. The high grade requires 3 gallons of additive A and 1 gallon of additive B
per barrel while the supreme grade requires 2 gallons of additive A and 3 gallons of additive B
per barrel.
n The supply of both of these additives is quite limited. Each week, this product line is allocated
only 300 gallons of additive A per week and 280 gallons of additive B.
n A barrel of the high grade has a profit margin of $80 per barrel while the supreme grade has a
profit margin of $200 per barrel.
• Question
n How many barrels of High and Supreme grade should Banner Chemicals produce each week?

XS
Step 1. Determine Decision Variables
XH = Number of High grade barrels to produce per week
XS = Number of Supreme grade barrels to produce per week

Bounds XH ≥ 0 XS ≥ 0 XH

8
Formulating – Banner Chemicals
• Situation
n Banner Chemicals manufactures specialty chemicals. One of their products comes in two
grades, high and supreme. The capacity at the plant is 110 barrels per week.
n The high and supreme grade products use the same basic raw materials but require different
ratios of additives. The high grade requires 3 gallons of additive A and 1 gallon of additive B
per barrel while the supreme grade requires 2 gallons of additive A and 3 gallons of additive B
per barrel.
n The supply of both of these additives is quite limited. Each week, this product line is allocated
only 300 gallons of additive A per week and 280 gallons of additive B.
n A barrel of the high grade has a profit margin of $80 per barrel while the supreme grade has a
profit margin of $200 per barrel.
• Question
n How many barrels of High and Supreme grade should Banner Chemicals produce each week?

XS
Step 2. Formulate Objective Function
(0,12) pro
Profit = 80XH + 200XS fit
=2
40
pro 0 (20,4)
(0,5) fit
=1
Maximize z(XH, XS) = 80XH + 200XS 00
0

(12.5,0) (30,0) XH

9
Formulating – Banner Chemicals
• Situation
n Banner Chemicals manufactures specialty chemicals. One of their products comes in two
grades, high and supreme. The capacity at the plant is 110 barrels per week.
n The high and supreme grade products use the same basic raw materials but require different
ratios of additives. The high grade requires 3 gallons of additive A and 1 gallon of additive B
per barrel while the supreme grade requires 2 gallons of additive A and 3 gallons of additive B
per barrel.
n The supply of both of these additives is quite limited. Each week, this product line is allocated
only 300 gallons of additive A per week and 280 gallons of additive B.
n A barrel of the high grade has a profit margin of $80 per barrel while the supreme grade has a
profit margin of $200 per barrel.
• Question
n How many barrels of High and Supreme grade should Banner Chemicals produce each week?

XS
Step 3. Formulate Constraints
Plant Capacity is 110 barrels XH + XS ≤ 110
High Supreme Available Feasible
Region
Additive A 3 gal 2 gal 300 gal 3XH + 2XS ≤ 300
XH

Additive B 1 gal 3 gal 280 gal XH + 3XS ≤ 280 10


Problem Formulation – Banner Chemicals

Objective Function - The thing you


Max z(XH, XS) = 80XH + 200XS are trying to maximize or minimize

subject to
XH + XS ≤ 110 Constraints - Limits to resources or
requirements of the system that must be
3XH + 2XS ≤ 300 adhered to absolutely. Consists of a Left
Hand Side (LHS) function, that has some
XH + 3XS ≤ 280 relationship (≤,=,≥) to a Right Hand Side
(RHS) that must be satisfied.
XH ≥0
Bounds or Non-Negativity Conditions
XS ≥ 0 Decision variables typically can’t be negative.

Decision Variables
The unknowns in the problem whose values you are trying to determine.
XH = Number of High grade barrels to produce per week
XS = Number of Supreme grade barrels to produce per week
11
Graphical Representation

12
Graphical Representation – Banner Chemicals
Max z(XH, XS) = 80XH + 200XS
s.t.
Plant XH + XS ≤ 110
Add. A 3XH + 2XS ≤ 300
XS

Add. B XH + 3XS ≤ 280


XH ≥ 0
XS ≥ 0

XH
The Feasible Region is defined by the constraints
and the bounds on the Decision Variables
13
Graphical Representation – Banner Chemicals
Max z(XH, XS) = 80XH + 200XS
s.t.
Plant XH + XS ≤ 110
Add. A 3XH + 2XS ≤ 300
XS

Add. B XH + 3XS ≤ 280


XH ≥ 0
XS ≥ 0

XH
The Feasible Region is defined by the constraints
and the bounds on the Decision Variables
14
Graphical Representation – Banner Chemicals
Max z(XH, XS) = 80XH + 200XS
s.t.
Plant XH + XS ≤ 110
Add. A 3XH + 2XS ≤ 300
XS

Add. B XH + 3XS ≤ 280


XH ≥ 0
XS ≥ 0

XH
The Feasible Region is defined by the constraints
and the bounds on the Decision Variables
15
Graphical Representation – Banner Chemicals
Max z(XH, XS) = 80XH + 200XS
s.t.
Plant XH + XS ≤ 110
Add. A 3XH + 2XS ≤ 300
XS

Add. B XH + 3XS ≤ 280


XH ≥ 0
XS ≥ 0

XH
The Feasible Region is defined by the constraints
and the bounds on the Decision Variables
16
Graphical Representation – Banner Chemicals
Max z(XH, XS) = 80XH + 200XS
s.t.
Optimal Solution Plant XH + XS ≤ 110
XH= 25 barrels Add. A 3XH + 2XS ≤ 300
XS = 85 barrels
XS

Add. B XH + 3XS ≤ 280


Max Profit = 19,000
XH ≥ 0
XS ≥ 0

Objective Function @ Profit = 19,000

XH
Objective Function @ Profit = 16,000
Objective Function @ Profit = 10,000 17
Graphical Representation – Banner Chemicals
What if the objective function changed?
Max
Max z(X
z(XHH,, X
XSS)) == 80X
200XH ++200X
80XSS
H
s.t.
Plant XH + XS ≤ 110
Optimal Solution Add. A 3XH + 2XS ≤ 300
XH= 100 barrels
XS

Add. B XH + 3XS ≤ 280


XS = 0 barrels
Max Profit = 20,000 XH ≥ 0
XS ≥ 0

XH

18
Graphical Representation – Banner Chemicals
The solution of a Linear Program will always be in a
“corner” of the Feasible Region due to: Max z(XH, XS) = 80XH + 200XS
- Linear objective function s.t.
- Linear constraints that form a convex feasible region Plant XH + XS ≤ 110
Add. A 3XH + 2XS ≤ 300
XH= 0 barrels
XS

XS = 93.3 barrels Add. B XH + 3XS ≤ 280


XH ≥ 0
XH= 25 barrels XS ≥ 0
XS = 85 barrels

XH= 80 barrels
XS = 30 barrels

XH= 100 barrels


XS = 0 barrels

XH
XH= 0 barrels
XS = 0 barrels The objective function determines
inwhich corner is the solution.
19
Interpreting Results
and Sensitivity Analysis

20
OK, so I got an answer, now what?
• Sometimes the original question is the least
interesting one!

• Other Questions to Ask .. . .


n Am I using all of my resources?
n Where do I have slack?
n Where am I constrained?
n Should I acquire more resources?
n If so, which and how much should I pay?
n How robust is my solution?
n What if something (prices, margins, etc.) changes?
21
Sensitivity Analysis – Banner Chemicals
Slack Constraint: Additive A
300 – 3(25) – 2(85) = 55 gallons left Max z(XH, XS) = 80XH + 200XS
s.t.
Plant XH + XS ≤ 110
Ad

Binding Constraints:
di t

3XH + 2XS ≤ 300


ive

Additive B & Plant Capacity Add. A


A

- How much would you pay for more?


XS

Add. B XH + 3XS ≤ 280


- This value is known as the shadow price,
dual price, or marginal value etc. XH ≥ 0
XS ≥ 0

Addi t
Optimal Solution ive B
XH= 25 barrels
XS = 85 barrels Obje
Max Profit = 19,000 ctive
Func
t ion
Pl a
nt

XH
Software packages will provide you with details on shadow prices of
binding constraints, slack constraint ranges, and other features.
22
Formal Notation

23
Problem Formulation – Banner Chemicals
Max z(XH, XS) = 80XH + 200XS Max z =∑ pi xi
i∈M Summation
s.t. s.t. from i to M
XH + XS ≤ 110
3XH + 2XS ≤ 300 xi ≤ C
XH + 3XS ≤ 280
∑ i∈M for all

XH ≥0 ∑ aij xi ≤ A j ∀j ∈ N
i∈M
XS ≥ 0
xi ≥ 0 ∀i ∈ M
is a
Indices member of
Products i in M
Max z = f (x) Additives j in N
Input Data
pi = Profit margin for product i ($/barrel)
s.t. C = Plant capacity (barrels/week)
Aj = Additive j available (gallons/week)
g(x) ≤ b aij = Quantity of additive j required per
barrel of product i (gallons/barrel)
x≥0 Decision Variables
xi = Quantity of product i to produce (barrels)

24
Anomalies

25
Special Cases in Math Programming Models

• A number of anomalies can occur in LPs:


n Alternate Optimal Solutions
n Redundant Constraints

n Infeasibility

26
Anomalies – Banner Chemicals
Alternate or Multiple Optimal Solutions
• When the objective function is identical to a constraint
• There can be more than one optimal solution!
Ad

• Same obj. function value, different ways to get there!


di t
ive
A
XS

Ob
je
cti
ve
Fu
ctin
on

Addi t
ive B

Optimal Solutions

Pl a
nt

XH

27
Anomalies – Banner Chemicals
Redundant Constraints
• Suppose I have new constraint that I cannot produce more
than 100 barrels of Supreme grade a week.
Ad

• It does not effect the Feasible Region – so it is redundant.


di t
ive
A
XS

XS ≤ 100 barrels

Addi t
Optimal Solution ive B
XH= 25 barrels
XS = 85 barrels Obje
Max Profit = 19,000 ctive
Func
t ion
Pl a
nt

XH

28
Anomalies – Banner Chemicals
Infeasibility
• Suppose I have new constraint that I MUST produce at least
100 barrels of Supreme grade a week.
Ad

• There are no points in the Feasible Region – this constraint


di t
ive

makes the problem infeasible.


A
XS

XS ≥ 100 barrels

Addi t
Optimal Solution ive B
XH= 25 barrels
XS = 85 barrels Obje
Max Profit = 19,000 ctive
Func
t ion
Pl a
nt

XH

29
Special Cases in Math Programming Models

• A number of anomalies can occur in LPs:


n Alternate Optimal Solutions
n Redundant Constraints

n Infeasibility

30
Key Points

31
Key Points from Lesson
• Constrained Optimization
• Formulate Linear Program (Practice This!)
n Decisions Variables – things you are deciding
n Objective Function – to minimize or maximize
n Constraints – define feasible regions
• Solution always occurs at a ‘corner’
• Analysis of the Results – (software output)
n Shadow Prices – the marginal value of a scarce resource
• Anomalies to be aware of
n Alternate or Multiple Optimal Solutions
n Redundant Constraints
n Infeasibility
32
Questions, Comments, Suggestions?
Use the Discussion Forum!

“Wilson & Dexter – constrained on the beach by a gate”


Yankee Golden Retriever Rescued Dog (www.ygrr.org)

MIT Center for [email protected]


Transportation & Logistics ctl.mit.edu
Integer and Mixed Integer
Linear Programs

MIT Center for


Transportation & Logistics ctl.mit.edu
1
Numbers, Numbers, Everywhere!
N = Natural, Whole, or Counting Numbers = 0, 1, 2, 3, . . .

Z = Integers = . . . -3, -2, -1, 0, 1, 2, 3, . . .

Q = Rational Numbers = any fraction of Integers, 1/2 , -5/9, 0/22, . . . etc.

R = Real Numbers = all Rational and Irrational numbers, i.e, π, √2, e, . . . etc.

B = Binary Integers = {0,1}

Why the heck do we care?


MIT Center for
By Mortalmoth (Own work) [Public domain], via Wikimedia Commons 2
Transportation & Logistics
Integer Variables
• Why use them?
n When its physically impossible to have fractional solutions
w For example; number of people to hire, number of ships to make
w However, if dealing with large numbers, continuous is fine
n Allows for modeling logical conditions (Binary)
w If Then:
If we have product leaving plant A then we must open it
w Either Or:
We can either produce ≥1000 units or none at all.
w Select From:
We must select ≥4 DCs to open from the 10 possible
We must select ≤5 products to make from the 15 available
• Why do we have to treat them differently?
MIT Center for
3
Transportation & Logistics
Banner Chemicals II: IP Example

MIT Center for


4
Transportation & Logistics
Motivating Problem – Banner Chemicals II
• Situation
n Banner Chemicals manufactures specialty chemicals. One of their products
comes in two grades, high and supreme. The capacity at the plant is 110
barrels per week.
n The high and supreme grade products use the same basic raw materials but
require different ratios of additives. The high grade requires 3 gallons of
additive A and 1 gallon of additive B per barrel while the supreme grade
requires 2 gallons of additive A and 3 gallons of additive B per barrel.
n The supply of both of these additives is quite limited. Each week, this product
line is allocated only 300 gallons of additive A per week and 280 gallons of
additive B.
n A barrel of the high grade has a profit margin of $80 per barrel while the
supreme grade has a profit margin of $200 per barrel.
• Question
n How many barrels of High and Supreme grade should Banner Chemicals
produce each week assuming you can only produce in 10 barrel lots?

MIT Center for


5
Transportation & Logistics
Banner Chemicals Max z(XH, XS) = 80XH + 200XS
s.t.
Plant XH + XS ≤ 110
Optimal LP Solution 3XH + 2XS ≤ 300
Add. A
XH= 25 barrels
XS = 85 barrels XH + 3XS ≤ 280
Ad

Add. B
di t

Max Profit = 19,000


XH ≥ 0
ive
A
XS

XS ≥ 0
What is the optimal solution
with 10 barrel lots?

Addi t
ive B

Obje
ctive
Func
t ion
Pl a
nt

XH
Notes:
• Feasible region becomes a collection of points, no longer a convex hull
• We cannot rely on “corner” solutions anymore – solution space is much bigger!
MIT Center for
Transportation & Logistics
6
Max z(XH, XS) = 80XH + 200XS

How to find solution to IP? s.t.


Plant XH + XS ≤ 110
3XH + 2XS ≤ 300
• Let’s try “rounding” the solution to Add. A

XH + 3XS ≤ 280
the closest acceptable integer values? Add. B
XH ≥ 0
n LP Solution: XS ≥ 0
w XH=25 barrels XS= 85 barrels
n Rounding to closest “10 barrel” solution for (XH, XS):
1. zLOT(30, 90) = $20,400 but it is infeasible (Plant constraint)
2. zLOT(30, 80) = $18,400 feasible
3. zLOT(20, 90) = $19,600 but it is infeasible (Additive B constraint)
n So, using this approach z*LOT= $18,400 with XH=30, XS=80
n But, is it the best?
• Let’s solve all of the points to make sure!
This approach is called Mass Enumeration.
MIT Center for
7
Transportation & Logistics
Mass Enumeration Max z(XH, XS) = 80XH + 200XS
s.t.
of Banner Chemical Plant XH + XS ≤ 110
Add. A 3XH + 2XS ≤ 300
Optimal IP Solution Optimal LP Solution Closest “rounded” XH + 3XS ≤ 280
Add. B
XH= 10 barrels XH= 25 barrels LP Solution
XS = 90 barrels XS = 85 barrels XH= 30 barrels XH ≥ 0
Max Profit = 18,800 Max Profit = 19,000 XS = 80 barrels
Max Profit = 18,400 XS ≥ 0

Each cell shows z = 80XH + 200XS


x indicates infeasible solution

Notes:
• Rounding the optimal LP solution will not always lead to an optimal IP solution
• Mass enumeration is very time consuming – not always possible for real problems!
• IP solution can never be better than the LP solution!
MIT IPsforare much, much, much harder to solve than LPs!
• Center
Transportation & Logistics
8
Formulation Changes . . . not much!
Max z(XH, XS) = 80XH + 200XS • In order to solve in integer values of
s.t. “lots of ten”, we need to:
Plant XH + XS ≤ 110
n Convert Decision Variables
Add. A 3XH + 2XS ≤ 300
w XHL = XH/10 XSL = XS/10
XH + 3XS ≤ 280
Add. B n Scale the coefficients and constraint RHS
XH ≥ 0 w e.g. 110 barrels becomes 11 lots of ten
XS ≥ 0 n Indicate that the new DVs are Integers

Max z(XHL, XSL) = 800XHL + 2000XSL


s.t.
Plant XHL + XSL ≤ 11
Add. A 3XHL + 2XSL ≤ 30

Add. B XHL + 3XSL ≤ 28


XHL, XSL ≥ 0 Integers

MIT Center for


9
Transportation & Logistics
1

GoNuts Juice Company: Model 1

MIT Center for


10
Transportation & Logistics
GoNuts Juice Company 1

GoNuts manufactures different juices made entirely of various exotic nuts. Their
primary market is China and they operate three plants located in Ethiopia,
Tanzania, and Nigeria. You have been asked to help them determine where to
manufacture the two newest juices they offer, Gingko Nut and Kola Nut. Each
plant has a different variable cost structure and capacity for manufacturing the
different juices. Also, each juice has an expected demand.

Cost/Unit Ginko Kola Capacity Units/Month Demand Units/Month


Ethiopia ¥21.00 ¥22.50 Ethiopia 425 Ginko 550
Tanzania ¥22.50 ¥24.50 Tanzania 400 Kola 450
Nigeria ¥23.00 ¥25.50 Nigeria 750

How much of each juice should be made at each plant in order to minimize total
cost while meeting demand and adhering to plant capacity?

MIT Center for


Image CC0 Public Domain from https://pixabay.com 11
Transportation & Logistics
Formulating GoNuts 1

Step 1. Determine Decision Variables


xG,E = Number of Ginko Juice units made in Ethiopia plant
xK,E = Number of Kola Juice units made in Ethiopia plant
xG,T = Number of Ginko Juice units made in Tanzania plant
xK,T = Number of Kola Juice units made in Tanzania plant
xG,N = Number of Ginko Juice units made in Nigeria plant
xK,N = Number of Kola Juice units made in Nigeria plant

xij = Number of units of product i made in plant j


xij ≥ 0 for all i,j

Step 2. Formulate Objective Function


Minimize z = Cost = 21xG,E + 22.5xK,E + 22.5xG,T + 24.5xK,T + 23xG,N + 25.5xK,N

Min z =∑ ∑ cij xij


i j
where:
xij = Number of units of product i made in plant j
MIT Center for
cij = Cost per unit of product i made at plant j
12
Transportation & Logistics
Formulating GoNuts 1

Step 3. Formulate Constraints


Plant Capacity

xG,E + xK,E ≤ 425 ∑x i ij


≤Cj ∀j
xG,T + xK,T ≤ 400 where:
xG,N + xK,N ≤ 750 xij = Number of units of product i made in plant j
Cj = Capacity in units at plant j

Product Demand

xG,E + xG,T + xG,N ≥ 550


xK,E + xK,T + xK,N ≥ 450

∑ xij ≥ Di ∀i
j
where:
xij = Number of units of product i made in plant j
Di = Demand for product i in units
MIT Center for
13
Transportation & Logistics
Formulating GoNuts 1

Minimize z = Cost = 21xG,E + 22.5xK,E + 22.5xG,T + 24.5xK,T + 23xG,N + 25.5xK,N


subject
to xG,E + xK,E ≤ 425
xG,T + xK,T ≤ 400 Capacity Cj
xG,N + xK,N ≤ 750 cij i=1 i=2 j=1 425
xG,E + xG,T + xG,N ≥ 550 j=1 ¥21.00 ¥22.50 j=2 400
xK,E + xK,T + xK,N ≥ 450 j=2 ¥22.50 ¥24.50 j=3 750
xG,E, xK,E, xG,T, xK,T, xG,N, xK,N ≥ 0 j=3 ¥23.00 ¥25.50 Demand Di
i=1 550
Min z =∑ ∑ cij xij i=2 450
i j

s.t.
∑x ij
≤Cj ∀j Optimal Solution
i

∑x ≥ Di ∀i Ginko Kola
j ij
Ethiopia 0 425
xij ≥ 0 ∀ij Tanzania 375 25
where: Nigeria 175 0
xij = Number of units of product i made in plant j
cij = Cost per unit of product i made at plant j Total min cost = ¥ 22,637.50
Cj = Capacity in units at plant j
Di = Demand for product i in units
MIT Center for
Transportation & Logistics
14
2

GoNuts Juice Company: Model 2

MIT Center for


15
Transportation & Logistics
GoNuts Juice Company: Model 2 2

GoNuts manufactures different juices made entirely of various exotic nuts. Their
primary market is China and they operate three plants located in Ethiopia,
Tanzania, and Nigeria. You have been asked to help them determine where to
manufacture the two newest juices they offer, Gingko Nut and Kola Nut. Each
plant has a different fixed and variable cost structure and capacity for
manufacturing the different juices. The fixed cost only applies if the plant
produces any juice. Also, each juice has an expected demand.
Cost/Unit Ginko Kola Capacity Units/Month Fixed (¥/Month)
Ethiopia ¥21.00 ¥22.50 Ethiopia 425 ¥1,500
Tanzania ¥22.50 ¥24.50 Tanzania 400 ¥2,000
Nigeria ¥23.00 ¥25.50 Nigeria 750 ¥3,000
Demand Units/Month
Ginko 550
Kola 450

How much of each juice should be made at each plant in order to minimize total
cost while meeting demand and adhering to plant capacity?
MIT Center for
Image CC0 Public Domain from https://pixabay.com 16
Transportation & Logistics
Formulating GoNuts 2 2

Step 1. Determine Decision Variables


xij = Number of units of product i made in plant j
yj = 1 if plant j is opened; = 0 otherwise

Step 2. Formulate Objective Function


Min z = 21xG,E + 22.5xK,E + 22.5xG,T + 24.5xK,T + 23xG,N + 25.5xK,N + 1500yE + 2000yT + 3000yN

Min z =∑ ∑ cij xij + ∑ f j y j


i j j
where:
xij = Number of units of product i made in plant j
yj = 1 if plant j is opened; = 0 o.w.
cij = Cost per unit of product i made at plant j
fj = Fixed cost per month if plant j is used

MIT Center for


17
Transportation & Logistics
Formulating GoNuts 2 2

Step 3. Formulate Constraints


xG,E + xK,E ≤ 425
Demand Capacity

xG,T + xK,T ≤ 400


∑x i ij
≤Cj ∀j
xG,N + xK,N ≤ 750
∑x j ij
≥ Di ∀i
xG,E + xG,T + xG,N ≥ 550 where:
xK,E + xK,T + xK,N ≥ 450 xij = Number of units of product i made in plant j
Cj = Capacity in units at plant j
Di = Demand for product i in units

• Is this enough? Try solving it!


n You need to ensure that if a plant produces product, then
it is actually opened!
n If Then conditions require both a
w Binary Variable
w Linking Constraint
MIT Center for
18
Transportation & Logistics
If Then Conditions

MIT Center for


19
Transportation & Logistics
If-Then Condition yN

Feasible Values
Looking at the Nigeria Plant . . . 1

• How do yN, xGN and xKN interact?


0
0 CN xGN + xKN
IF . . . THEN
xGN+xKN yN = 0 yN = 1
=0 YES YES
xGN + xKN ≤ 750 yN
>0 and ≤ CN NO YES IF xGN+xKN = THEN yN =

0 0 or 1 0 ≤ 750 yN

99 1 99 ≤ 750 yN
∑x i ij
≤ My j ∀j
where: 1 1 1 ≤ 750 yN
xij = Number of units of product i made in plant j
yj = 1 if plant j is opened; = 0 o.w.
M = a big number (such as Cj in this case) If the X values >0, then Y MUST be
equal to 1! Otherwise, it would
violate the constraint.
MIT Center for
20
Transportation & Logistics
Formulating GoNuts 2 2

Step 3. Formulate Constraints


xG,E + xK,E ≤ 425
Linking Demand Capacity

xG,T + xK,T ≤ 400


xG,N + xK,N ≤ 750
∑ x ≤C
i ij j
∀j
xG,E + xG,T + xG,N ≥ 550
xK,E + xK,T + xK,N ≥ 450 ∑ x ≥D
j ij i
∀i

xG,E + xK,E - 425yE ≤ 0 ∑ x − My


i ij j
≤ 0 ∀j
xG,T + xK,T - 400yT ≤ 0 where:
xG,N + xK,N - 750yN ≤ 0 xij = Number of units of product i made in plant j
yj = 1 if plant j is opened; = 0 o.w.
M = a big number (such as Cj in this case)
Cj = Capacity in units at plant j
Di = Demand for product i in units

MIT Center for


21
Transportation & Logistics
2

GoNuts Juice Company Model 2:


With If Then Conditions

MIT Center for


22
Transportation & Logistics
Formulation of GoNuts Model 2 2

Min z = 21xG,E + 22.5xK,E + 22.5xG,T + 24.5xK,T + 23xG,N + 25.5xK,N + 1500yE + 2000yT + 3000yN
subject to
xG,E + xK,E ≤ 425 Min z = ∑ ∑ cij xij + ∑ f j y j
i j j
xG,T + xK,T ≤ 400
xG,N + xK,N ≤ 750 s.t.
xG,E + xG,T + xG,N ≥ 550 ∑x ij
≤Cj ∀j
i
xK,E + xK,T + xK,N ≥ 450
xG,E + xK,E - 425yE ≤ 0 ∑x j ij
≥ Di ∀i
xG,T + xK,T - 400yT ≤ 0
xG,N + xK,N - 750yN ≤ 0
∑x i ij
− My j ≤ 0 ∀j
xG,E, xK,E, xG,T, xK,T, xG,N, xK,N ≥ 0 xij ≥ 0 ∀ij
yE, yT, yN = {0, 1} y = {0,1}
where: j

xij = Number of units of product i made in plant j


Demand Di
yj = 1 if plant j is opened; = 0 o.w.
i=1 550 cij = Cost per unit of product i made at plant j
i=2 450 Cj = Capacity in units at plant j
Di = Demand for product i in units
Capacity Cj fj cij i=1 i=2
M = a big number (such as Cj in this case)
j=1 425 1500 j=1 ¥21.00 ¥22.50
j=2 400 2000 j=2 ¥22.50 ¥24.50
MIT Center for
j=3 750 &3000
Transportation Logistics j=3 ¥23.00 ¥25.50 23
Solution: GoNuts Models 1 & 2
Model 1 – only variable costs Model 2 – with fixed plant costs
z*= ¥ 22,637.50 z*= ¥ 27,350.00
Ginko Kola Ginko Kola
Ethiopia 0 425 Ethiopia 0 425
Tanzania 375 25 Tanzania 0 0
Nigeria 175 0 Nigeria 550 25

MIT Center for


24
Transportation & Logistics
3

GoNuts Juice Company: Model 3


Adding Either Or Conditions

MIT Center for


25
Transportation & Logistics
GoNuts Juice Company: Model 3 3

GoNuts manufactures different juices made entirely of various exotic nuts. Their
primary market is China and they operate three plants located in Ethiopia,
Tanzania, and Nigeria. You have been asked to help them determine where to
manufacture the two newest juices they offer, Gingko Nut and Kola Nut. Each
plant has a different fixed and variable cost structure and both minimum and
maximum capacities for manufacturing the different juices if the plant opens.
The fixed cost only applies if the plant produces any juice. Also, each juice has
an expected demand.
Capacity Max Min Fixed
Cost/Unit Ginko Kola (units/Month) Capacity Capacity (¥/Month)
Ethiopia ¥21.00 ¥22.50 Ethiopia 425 100 ¥1,500
Tanzania ¥22.50 ¥24.50 Tanzania 400 250 ¥2,000
Nigeria ¥23.00 ¥25.50 Nigeria 750 600 ¥3,000

Demand Units/Month
If the Nigeria plant opens, it
Ginko 550 must produce at least 600 units
Kola 450
How much of each juice should be made at each plant in order to minimize total
cost while meeting demand and adhering to plant capacity?
MIT Center for
Image CC0 Public Domain from https://pixabay.com 26
Transportation & Logistics
Formulating GoNuts 3 3

Step 1. Determine Decision Variables No Change!


xij = Number of units of product i made in plant j
yj = 1 if plant j is opened; = 0 otherwise

Step 2. Formulate Objective Function No Change!


Min z = 21xG,E + 22.5xK,E + 22.5xG,T + 24.5xK,T + 23xG,N + 25.5xK,N + 1500yE + 2000yT + 3000yN

Min z =∑ ∑ cij xij + ∑ f j y j


i j j
where:
xij = Number of units of product i made in plant j
yj = 1 if plant j is opened; = 0 o.w.
cij = Cost per unit of product i made at plant j
fj = Fixed cost per month if plant j is used

MIT Center for


27
Transportation & Logistics
Formulating GoNuts 3 3

Step 3. Formulate Constraints


xG,E + xK,E ≤ 425
∑ x ≤C
Linking Demand Capacity

ij j
∀j
xG,T + xK,T ≤ 400 i

xG,N + xK,N ≤ 750 ∑ x ≥D ∀i


j ij i
xG,E + xG,T + xG,N ≥ 550
xK,E + xK,T + xK,N ≥ 450 ∑ x − My
i ij j
≤ 0 ∀j
where:
xG,E + xK,E - 425yE ≤ 0 xij = Number of units of product i made in plant j
xG,T + xK,T - 400yT ≤ 0 yj = 1 if plant j is opened; = 0 o.w.
xG,N + xK,N - 750yN ≤ 0 M = a big number (such as Cj in this case)
Cj = Maximum capacity in units at plant j
Lj = Minimum level of production at plant j
Di = Demand for product i in units

We need to add a constraint that ensures that if we DO use plant j, that


the volume is between the minimum allowable level, Lj, and the maximum
capacity, Cj. This is sometimes called an Either-Or condition.

MIT Center for


28
Transportation & Logistics
Either Or Condition yN
Feasible
Values

Looking at the Nigeria Plant . . . 1

• How do yN, xGN and xKN interact?


0
IF . . . THEN 0 LN CN xGN + xKN
600 750
xGN+xKN yN = 0 yN = 1
=0 YES NO
IF THEN yN THEN yN
>0 and < LN NO NO xGN+xKN ≤750yN ≥600yN
≥ LN and ≤CN NO YES
0 0 or 1 0

200 1 0
∑x i ij
≤ My j ∀j
600 1 0 or 1
∑x i ij
≥ Lj y j ∀j
where:
xij = Number of units of product i made in plant j If the X values >0, then they must be
yj = 1 if plant j is opened; = 0 o.w. ≥L, the lower limit, and ≤C, the
M = a big number (such as Cj in this case) maximum capacity!
Lj = Minimum
MIT Center for level of production at plant j
Transportation & Logistics
29
Formulating GoNuts 3 3

Min z = 21xG,E + 22.5xK,E + 22.5xG,T + 24.5xK,T + 23xG,N + 25.5xK,N + 1500yE + 2000yT + 3000yN
subject to
xG,E + xK,E ≤ 425 Min z = ∑ ∑ cij xij + ∑ f j y j
i j j
xG,T + xK,T ≤ 400 s.t.
xG,N + xK,N ≤ 750
xG,E + xG,T + xG,N ≥ 550
∑x i ij
≤Cj ∀j

xK,E + xK,T + xK,N ≥ 450 ∑x j ij


≥ Di ∀i

xG,E + xK,E - 425yE ≤ 0 ∑x i ij


− My j ≤ 0 ∀j
xG,T + xK,T - 400yT ≤ 0
xG,N + xK,N - 750yN ≤ 0
∑x i ij
− Lj y j ≥ 0 ∀j
xij ≥ 0 ∀ij
xG,E + xK,E - 100yE ≥ 0
y j = {0,1}
xG,T + xK,T - 250yT ≥ 0
xG,N + xK,N - 600yN ≥ 0 where:
xij = Number of units of product i made in plant j
Products Di xG,E, xK,E, xG,T, xK,T , yj = 1 if plant j is opened; = 0 o.w.
i=1 550 xG,N, xK,N ≥ 0 cij = Cost per unit of product i made at plant j
i=2 450 yE, yT, yN = {0, 1} Cj = Maximum capacity in units at plant j
Lj = Minimum level of production at plant j
cij i=1 i=2 Plants Cj Lj fj
Di = Demand for product i in units
j=1 ¥21.00 ¥22.50 j=1 425 100 1500 M = a big number (such as C in this case)
j
j=2 ¥22.50 ¥24.50 j=2 400 250 2000
MIT Center for
j=3 ¥23.00Transportation
¥25.50 & Logistics j=3 750 600 3000 30
Solution: GoNuts Models 1, 2, & 3
Model 1 – only variable costs Model 2 – with fixed plant costs
z*= ¥ 22,637.50 z*= ¥ 27,350.00
Ginko Kola Ginko Kola
Ethiopia 0 425 Ethiopia 0 425
Tanzania 375 25 Tanzania 0 0
Nigeria 175 0 Nigeria 550 25

Model 3 – with fixed plant costs


and minimum production levels
z*= ¥ 27,425.00
Ginko Kola
Ethiopia 0 400
Tanzania 0 0
Nigeria 550 50

MIT Center for


31
Transportation & Logistics
4

GoNuts Juice Company: Model 4


Adding Select From Conditions

MIT Center for


32
Transportation & Logistics
GoNuts Juice Company: Model 4 4

GoNuts manufactures different juices made entirely of various exotic nuts. Their
primary market is China and they operate three plants located in Ethiopia,
Tanzania, and Nigeria. You have been asked to help them determine where to
manufacture the two newest juices they offer, Gingko Nut and Kola Nut. Each
plant has a different variable cost structure and a maximum capacity. GoNuts
can only operate 2 plants at a maximum. Also, each juice has an expected
demand.

Cost/Unit Ginko Kola Capacity Max Demand Units/Month


Ethiopia ¥21.00 ¥22.50 (units/Month) Capacity Ginko 550
Tanzania ¥22.50 ¥24.50 Ethiopia 425 Kola 450
Nigeria ¥23.00 ¥25.50 Tanzania 400
Nigeria 750

How much of each juice should be made at each plant in order to minimize total
cost while meeting demand and adhering to plant capacity?
MIT Center for
Image CC0 Public Domain from https://pixabay.com 33
Transportation & Logistics
Formulating GoNuts 4 4

Step 1. Determine Decision Variables No Change!


xij = Number of units of product i made in plant j
yj = 1 if plant j is opened; = 0 otherwise

Step 2. Formulate Objective Function Slight Change!


Min z = 21xG,E + 22.5xK,E + 22.5xG,T + 24.5xK,T + 23xG,N + 25.5xK,N

Min z =∑ ∑ cij xij


i j
where:
xij = Number of units of product i made in plant j
yj = 1 if plant j is opened; = 0 o.w.
cij = Cost per unit of product i made at plant j

MIT Center for


34
Transportation & Logistics
Formulating GoNuts 4 4

Step 3. Formulate Constraints


xG,E + xK,E ≤ 425
∑ x ≤C
Linking Demand Capacity

ij j
∀j
xG,T + xK,T ≤ 400 i
xG,N + xK,N ≤ 750 ∑ x ≥D ∀i
j ij i
xG,E + xG,T + xG,N ≥ 550
xK,E + xK,T + xK,N ≥ 450 ∑ x − My
i ij j
≤ 0 ∀j

xG,E + xK,E - 425yE ≤ 0 ∑ y ≤N


j j
xG,T + xK,T - 400yT ≤ 0 where:
xG,N + xK,N - 750yN ≤ 0 xij = Number of units of product i made in plant j
yj = 1 if plant j is opened; = 0 o.w.
Plants

M = a big number (such as Cj in this case)


Max

yE + yT + yN ≤ 2
Cj = Maximum capacity in units at plant j
N = Number of plants allowed to be opened
Di = Demand for product i in units

We need to add a constraint that ensures that only N plants are used! We will use the
Binary Variables, yj, the Linking Constraints, and a new constraint that says the sum of the
Binary Variables must not exceed N. This is sometimes called an Select-From condition.
MIT Center for
Transportation & Logistics
35
Formulating GoNuts 4 4

Min z = 21xG,E + 22.5xK,E + 22.5xG,T + 24.5xK,T + 23xG,N + 25.5xK,N


subject to
xG,E + xK,E ≤ 425 Min z = ∑ ∑ cij xij
i j
xG,T + xK,T ≤ 400
s.t.
xG,N + xK,N ≤ 750
xG,E + xG,T + xG,N ≥ 550 ∑ x ≤C
i ij j
∀j
xK,E + xK,T + xK,N ≥ 450
∑ x ≥D
j ij i
∀i
xG,E + xK,E - 425yE ≤ 0
xG,T + xK,T - 400yT ≤ 0 ∑ x − My
i ij j
≤0 ∀j
xG,N + xK,N - 750yN ≤ 0
yE + yT + yN ≤ 2
∑ y ≤N
j j

xG,E, xK,E, xG,T, xK,T , xG,N, xK,N ≥ 0 xij ≥ 0 ∀ij


yE, yT, yN = {0, 1} y = {0,1}
j
where:
Products Di xij = Number of units of product i made in plant j
i=1 550 yj = 1 if plant j is opened; = 0 o.w.
N=2
i=2 450 cij = Cost per unit of product i made at plant j
Cj = Maximum capacity in units at plant j
cij i=1 i=2 Plants Cj
Di = Demand for product i in units
j=1 ¥21.00 ¥22.50 j=1 425 M = a big number (such as Cj in this case)
j=2 ¥22.50 ¥24.50 j=2 400 N = Number of plants allowed to be opened
MIT Center for
j=3 ¥23.00Transportation
¥25.50 & Logistics j=3 750 36
Solution: GoNuts All Models
Model 1 – only variable costs Model 2 – with fixed plant costs
z*= ¥ 22,637.50 z*= ¥ 27,350.00
Ginko Kola Ginko Kola
Ethiopia 0 425 Ethiopia 0 425
Tanzania 375 25 Tanzania 0 0
Nigeria 175 0 Nigeria 550 25

Model 3 – with fixed plant costs Model 4 – only variable costs but
and minimum production levels with maximum number of plants allowed
z*= ¥ 27,425.00 z*= ¥ 22,850.00
Ginko Kola Ginko Kola
Ethiopia 0 400 Ethiopia 0 425
Tanzania 0 0 Tanzania 0 0
Nigeria 550 50 Nigeria 550 25

MIT Center for


37
Transportation & Logistics
Key Points from Lesson

MIT Center for


38
Transportation & Logistics
Key Points from Lesson (1/2)
• IPs and MILPs are different from LPs
n Much harder to solve since solution space expands!
n Formulations
w LPs a correct formulation is generally a good formulation
w For IPs a correct formulation is necessary but not sufficient to
guarantee solvability
n IPs require solving multiple LPs to establish bounds –
relaxing the Integer constraints
n Can’t just “round” the LP solution – might not be feasible
• When using integer (not binary) variables, solve the
LP first to see if it is sufficient.

MIT Center for


39
Transportation & Logistics
Key Points from Lesson (2/2)
• Binary variables are very powerful and can be used for
modeling logical conditions
n If Then – links continuous to binary variables
∑xi ij
− My j ≤ 0 ∀j

n Either Or – ensures a minimum level if used at all

∑x i ij
− My j ≤ 0 ∀j ∑xi ij
− L j y j ≥ 0 ∀j

n Select From – picks the best X of Y choices (min or max)

∑x i ij
− My j ≤ 0 ∀j ∑ j
yj ≤ N

MIT Center for


40
Transportation & Logistics
Questions, Comments, Suggestions?
Use the Discussion Forum!

“Athena – before and after completing the MITx MicroMasters Credential.


(photos courtesy of Lana Scott)

MIT Center for [email protected]


MIT Center for Transportation & Logistics ctl.mit.edu
Transportation & Logistics
Advanced Optimization

MIT Center for


Transportation & Logistics ctl.mit.edu
Agenda for Lesson

• Network Models
• Non-Linear Optimization
• Tips on Optimization in Practice

MIT Center for


2
Transportation & Logistics
Networks

MIT Center for


3
Transportation & Logistics
Network Representation
• Network Terminology
n Node or vertices – a point (facility, DC, plant, region)
n Arc or edge – link between two nodes (roads, flows, etc.), may be directional
n Network or graph – a collection of nodes and arcs

1
6

14
3 7 i j
11
2 8 15
12
4 9 Arcs
16 xij = flow on arc from node i to node j
cij = per unit cost for arc i to j

5 13 Nodes:
10
yj = 1 if node j is used, =0 otherwise
fj = cost of opening node j
hj = unit cost for any flow through node j
MIT Center for 4
Transportation & Logistics
Distance/Connectivity Matrix

Washington DC
Morgantown
Indianapolis

Greensboro
Charleston

Harrisburg
Cincinnati
Columbus

Richmond
Lexington
Cleveland
Louisville

Nashville

Knoxville
St. Louis
Chicago

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 Chicago - 300 201 362
2 St. Louis 300 - 245 263 312
3 Indianapolis 201 245 - 114 176 112
4 Louisville 263 114 - 175 86
5 Nashville 312 175 - 180
6 Cleveland 362 - 142 201 251 332
7 Columbus 176 142 - 105
8 Cincinnati 112 105 - 95 204
9 Lexington 86 95 - 170 177
10 Knoxville 180 170 - 299
11 Morgantown 201 - 157 213 209
12 Charleston 251 204 177 157 - 244 318
13 Greensboro 299 244 - 205
14 Harrisburg 332 213 - 120
Washington
15 DC 209 120 - 111
16 Richmond 318 205 111 -

MIT Center for 5


Transportation & Logistics
Three Network Problems
• Shortest Path Problem
n Given: One origin, one destination
n Find: Shortest path from single origin to single destination

• Traveling Salesman Problem


n Given: One origin, many destinations, sequential stops, one vehicle
n Find: Shortest tour connecting each stop once and only once and
returning to the origin

• Transportation & Transshipment Problems


n Given: Multiple supply and demand nodes with fixed and/or variable
costs and capacities on nodes and/or arcs
n Find: Minimum cost flow of product from origins to destinations

MIT Center for 6


Transportation & Logistics
Shortest Path Problem

MIT Center for


7
Transportation & Logistics
Shortest Path Problem (SPP)
• What is the objective?
n Find the shortest path in a network between two nodes
• Why is it important?
n Result is used as base for other analysis
n Connects physical to operational network
• What are the challenges?
n What route in practice is used? Shortest? Fastest? Un-restricted?
n How frequently should we update the network?
n Should we use time or distance?
n What is the impact of real-time changes due to congestion or weather?
n Speed of calculating versus looking up in a table
• What are the primary approaches?
n Standard Linear Programming (LP) Formulation
n Specialized Algorithms (e.g., Network Simplex, Dijkstra’s)
MIT Center for 8
Transportation & Logistics
LP Formulation for Shortest Path
Find shortest path from 1 to 5 Min z = 3x12 +4x13 +5x14 +7x25 +2x34 +4x35 + x45
2
3 7 s.t. x12 + x13 +x14 =1
4
x12 – x25 =0
3 4
1 5 x13 – x34 – x35 =0
2
1
x14 +x34 – x45 = 0
5
4 x25 +x35 +x45 = 1
x12, x13, x14, x25, x34, x35, x45 ≥ 0

Minimize: ∑ ∑ cij xij


i j
Note:
Subject to: • Note that integrality is guaranteed
∑ x =1
i ji
∀ j=s • Other specialized algorithms leverage the
network structure to solve much faster.
∑ x −∑ x
i ji i ij
= 0 ∀ j ≠ s, j ≠ t

∑ x =1
i ij
∀ j=t
3
2
7
xij ≥ 0 4
where: 3 4
1 5
xij = Number of units flowing from node i to node j 2
cij = Cost per unit for flow from node i to node j 5 1
4
s = Source node – where flow starts
t = terminalMIT node
Center for– where flow ends
Transportation & Logistics
9
Traveling Salesman Problem

MIT Center for


10
Transportation & Logistics
Traveling Salesman Problem (TSP)
• What is the objective?
n Starting from an origin node, find the minimum distance required to visit
each node once and only once and return to the origin.
• Why is it important?
n TSP is at core of all vehicle routing problems
n Local routing and last mile deliveries are both common and important
• What are the challenges?
n It is exceptionally hard to solve exactly, due to its size
n Possible solutions increase exponentially with number of nodes
• What are the primary approaches?
n Special algorithms for exact solutions (smaller problems)
n Heuristics – many available
w Nearest Neighbor
w Cheapest Insertion

MIT Center for 11


Transportation & Logistics
Finding TSP using Nearest Neighbor Heuristic
1. Select any node to be the active node
2. Connect the active node to the closest unconnected
node, make that the new active node
3. If there are more unconnected nodes go to step 2,
1 otherwise connect to the origin and end.

14

7
3
11

8
2 15

12
4
9

16

5
13
10

MIT Center for 12


Transportation & Logistics
Finding TSP using Cheapest Insertion Heuristic
1. Form a sub tour from the convex hull
2. Add the to the tour the unconnected node
that increases the cost the least, continue until
1 all nodes are connected.

14

7
3
11

8
2 15

12
4
9

16

5
13
10

MIT Center for 13


Transportation & Logistics
Transportation & Transshipment
Problems

MIT Center for


14
Transportation & Logistics
Transportation & Transshipment Problems
• What is the objective?
n Given a network of nodes and arcs, find the minimum cost flow of
product from supply nodes that satisfy demand at destination nodes
• Why is it important?
n Transportation problems are everywhere (see Banner Chemical)
n Transshipment problems are at the heart of larger supply chain network
design models
• What are the challenges?
n Data requirements can be extensive
n Where to draw the line on “realism” versus “practicality”
w Cost structure: variable and/or fixed on arcs and/or nodes? Concave costs?
w Single or multiple commodities? Are products fungible?
w Is there any variability of demand, supply or flows considered?
w Are there any capacity (min or mx) on arcs or transshipment nodes?
• What are the primary approaches?
n Mixed Integer Linear Programs
n Some simulation – usually after optimization
MIT Center for 15
Transportation & Logistics
R1

Network Flow Models P1 A


R2

R3
R1 B
P1 P2
R2

R3
Transshipment Problem
Min z = ∑ ∑ cij xij
P2 i j

s.t.
Transportation Problem
Min z =∑ ∑ cij xij ∑ x ≤ S ∀i ∈ S
j ij i
i j

s.t. ∑ x ≥ D ∀j ∈ D
i ij j

∑x ij
≤ Si ∀i ∈ S ∑ x − ∑ x = 0 ∀j ∉ D,∉ S
i ij i ji
j
xij ≥ 0 ∀ij
∑x i ij
≥ Dj ∀j ∈ D
xij ≥ 0 ∀ij Conservation of Flow Constraints

xij xji
j
The inbound flow must equal the
outbound flow at transshipment points,
cross-docks, mixing centers, etc.
Σi xij = Σi xji
MIT Center for
Transportation & Logistics 16
Non-Linear Programs (NLP)

MIT Center for


17
Transportation & Logistics
Non Linear Optimization
Optimal Cut-Out, x* = 0.196 m
0.14 Max Volume (x*) = 0.132 m3

0.12

0.10
Box Volume (cubic meters)

0.08

0.196
0.06
0.608 m

0.04

0.02 1.108 m

-
- 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50
Size of corner cut-out (meters)

MIT Center for


18
Transportation & Logistics
Example of NLP: Ace Ice Carvers
• Ace Ice Carvers creates ice sculptures for parties and
special occasions. The number of sculptures
produced is the product of the two inputs, ice and
labor. Ice can be purchased at $80 per unit and
labor is $20 per hour. A total of $160 is available.

• How much labor and how much ice should be


procured in order to maximize the output?

MIT Center for


Image CC0 Public Domain from pixabay.com. Problem adapted from Winston (1994) 19
Transportation & Logistics
Formulating Ace Ice Carvers 1

Step 1. Determine Decision Variables


x = Number of units of ice to acquire, ≥0
y = Number of hours of labor to acquire ≥0
Step 2. Formulate Objective Function
Maximize = z = xy
Step 3. Formulate Constraints
80x + 20y ≤ 160
Max z = ∏ xi
i

s.t.
Max z = xy ∑cx i i
≤B
i

80x + 20y ≤ 160 xi ≥ 0 ∀i


x≥0 where:
xi = Number of units of input i to acquire
y≥0 ci = Cost per unit of input i
B = Budget for input
MIT Center for
20
Transportation & Logistics
Ace Ice Carvers

Y labor hours
Feasible
Region

X units of ice

MIT Center for


21
Transportation & Logistics
Ace Ice Carvers

Y labor hours
Feasible
Region

z= xy = 1
X units of ice

MIT Center for


22
Transportation & Logistics
Ace Ice Carvers

Y labor hours
Feasible
Region

z= xy = 2
z= xy = 1
X units of ice

MIT Center for


23
Transportation & Logistics
Ace Ice Carvers

Y labor hours
Feasible
Region

z= xy = 3
z= xy = 2
z= xy = 1
X units of ice

MIT Center for


24
Transportation & Logistics
Ace Ice Carvers

Y labor hours
Optimal NLP Solution
x = 1 unit of ice
Feasible y = 4 labor hours
Max Production = 4 sculptures
Region

Things to Note:
• Optimal solution is no
longer in a corner!
• NLPs require different
solution techniques and z= xy = 4
tools
• Shape of objective function z= xy = 3
and constraints determine z= xy = 2
whether solution is local or z= xy = 1
global
• Convex Min - Global X units of ice
• Concave Max - Global

MIT Center for


25
Transportation & Logistics
Practical Tips for Optimization

MIT Center for


26
Transportation & Logistics
Optimization Models in Practice (1/2)
• What are we here for?
n Determining what to solve is rarely readily apparent or agreed upon
by all stakeholders.
n Establish and document the over-riding objective of a project early on.
• Level of Detail & Scope of the Model
n Models cannot fully represent reality (caricature vs. portrait)
n Models will NEVER consider all factors
n Determine problem boundaries and data aggregation levels
• Input Data
n Collecting data is hardest, least appreciated, and most time
consuming task in an optimization project.
n Data are never complete, clean, or totally correct.
n Every extra hour spent on data collection, cleaning, and verification
saves days later on in the project.
MIT Center for
27
Transportation & Logistics
Optimization Models in Practice (2/2)
• Sensitivity and Robustness Analysis
n These are all deterministic models – data assumed perfect & unchanging!
n Optimization models will do anything for a dollar, yuan, peso, euro, etc.
n Run multiple “what-if” scenarios changing uncertain input values and
testing different conditions.
• Models versus People (Models don’t make decisions, People do!)
n Optimization models are good at . . .
w Making trade-offs between complicated options and
w Uncovering unexpected insights and solutions.
n People are good at . . .
w Considering intangible and non-quantifiable factors,
w Identifying underlying patterns, and
w Mining previous experience and insights.
n Models should be used for Decision Support not for the Decision itself

MIT Center for


Transportation & Logistics 28
Key Points from Lesson

MIT Center for


29
Transportation & Logistics
Key Points from Lesson
• Network Optimization
n Shortest Path – Easy & fast to solve (LP or special algorithms)
n Traveling Salesman Problem – Hard to solve (heuristics)
n Flow Problems (Transportation & Transshipment) – Widely used (MILPs)
• Non-Linear Programs
n Harder to solve than LPs – lose “corner” solutions
n Shape of objective function and constraints dictate approach and
difficulty
• Practical Tips for Optimization in Practice
n Know your problem
n Know your team
n Know your tool

MIT Center for


30
Transportation & Logistics
Questions, Comments, Suggestions?
Use the Discussion Forum!

“Daisy – ready to get optimal”


(photos courtesy of Lana Scott)
MIT Center for [email protected]
MIT Center for Transportation & Logistics ctl.mit.edu
Transportation & Logistics

You might also like