02a - Optimasi II - Modeling Techniques - 2024 - Ver2
02a - Optimasi II - Modeling Techniques - 2024 - Ver2
– Maximizing minimum constraints (and vice versa), in which we find the largest
value of a “min” function (taking the minimum value from a set), or find the
smallest value of a “max” function (taking the maximum value from a set)
3
Absolute constraint (1)
Problem Statement
• A marketing problem, plus an absolute value constraint:
Task
• Solve with the added absolute value constraint (total number of ads in
electronic media is within 5 of the number in paper-based media), and solve
Absolute constraint (2)
• There is a “trick” we can use to change the constraint |x1 + x2 – x3 – x4| ≤ 5
into a linear constraint
• |x1 + x2 – x3 – x4| ≤ 5 is equivalent to a combination of the following two
constraints:
• x1 + x 2 – x3 – x4 ≤ 5 and –x1 – x2 + x3 + x4 ≤ 5
• The new problem is linear, and still equivalent to the original non-linear
program:
• min 500 x1 + 200 x2 + 250 x3 + 125 x4
s.t. 50,000 x1 + 25,000 x2 + 20,000 x3 + 15,000 x4 ≥ 1,500,000
0 ≤ x1 ≤ 20, 0 ≤ x2 ≤ 15, 0 ≤ x3 ≤ 10, 0 ≤ x4 ≤ 15
x1 + x2 – x3 – x4 ≤ 5
–x1 – x2 + x3 + x4 ≤ 5
What do you
mean by The problems are equivalent I’m extinct… The set
equivalent? in the sense that any feasible of living dinosaurs is
The two solution for the non-linear equivalent to a linear
problems program is feasible for the program with no
look different linear program, and vice feasible solutions!
to me… versa. That is, the feasible
regions are exactly the
same 5
Absolute Value Constraints – later on EITHER OR
• We now know how to transform constraints of the form | ax1 +bx2 | ≤ c
• However, our trick will not work on absolute value constraints of the form
| ax1 +bx2 | ≥ c
– We can still transform this into two equivalent constraints, but the feasible region
will no longer be convex, meaning we can’t solve the LP by traditional methods
– For example, try out | x1 - x2 | ≥ 2:
• This is equivalent to x1 - x2 ≥ 2 OR -x1 + x2 ≥ 2, which can’t be made linear:
x1
6
Maximin Problem (1)
• The next constraint we will make linear appears when we maximize the
value of a min function, which looks like min {3x - 2, -2x + 2}
2 -2x + 2
Problem Statement
1
• maximize min {3x - 2, -2x + 2}
s.t. 0≤x≤4 x
0
1
Task -1 3x - 2
-2 7
Maximin Problem (2)
• Looking at these minimum values, we then find the maximum value of the
blue line (shown as a yellow dot) to solve the problem
2 -2x + 2
0 x
1
-1 3x - 2
-2
8
Maximin objective function (1)
Problem Statement
• Begin with the same marketing problem as seen in Tutorial 02, but with a
new objective function:
• max min {50x1, 25x2, 20x3, 15x4}
s.t. 50,000 x1 + 25,000 x2 + 20,000 x3 + 15,000 x4 ≥ 1,500,000
0 ≤ x1 ≤ 20
0 ≤ x2 ≤ 15
0 ≤ x3 ≤ 10
0 ≤ x4 ≤ 15
• The minimum of {50x1, 25x2, 50x3, 15x4} is the smallest number of persons
reached by one of the four media (in 1000’s)
Task
Try to figure this out
• Formulate this as an LP whose
yourself before looking at
solution will find the maximum the answer!
value of z such that each medium
reaches at least 1000z people
9
Maximin objective function (2)
• Now, we want to maximize z subject to the constraint that z is at most the
number of ads seen for each media
• z is upper bounded by each expression in the min function, which we can
represent with the constraints:
• z ≤ 50x1
z ≤ 25x2
z ≤ 20x3
z ≤ 15x4
• Then, we can maximize z to get our final LP:
• max z
s.t. 50 x1 + 25 x2 + 20 x3 + 15 x4 ≥ 1,500
0 ≤ x1 ≤ 20, 0 ≤ x2 ≤ 15, 0 ≤ x3 ≤ 10, 0 ≤ x4 ≤ 15
z ≤ 50x1, z ≤ 25x2, z ≤ 20x3, z ≤ 15x4
• Note: This technique works whenever you need to maximize the minimum
(“maximin”) of linear functions. A similar trick works whenever you want to
minimize the maximum (“minimax”) of linear functions
10
Ratio Constraints
Problem Statement
• Consider the Marketing Problem again
• Suppose that we wanted to add the ratio constraint that at least 20% of all
ads had to be by mail:
• x1 / (x1 + x2 + x3 + x4) ≥ .2
Task
• Formulate this as an LP
• Note: You can only do this if you know that the denominator’s value is
positive for all possible x
– If you multiply both sides of an inequality by a negative number, the direction of
the inequality reverses
– The new constraint is valid if x = 0, so we don’t need to consider that case 11
Yes or No decisions – binary variable
1 if item 𝑗 is chosen
Decision variable: 𝑥𝑗 = ቊ
0 otherwise
Consider an IP in which one and only one of the following two constraints
holds
σ𝑗 𝑎1𝑗 𝑥𝑗 ≤ 𝑏1 or σ𝑗 𝑎2𝑗 𝑥𝑗 ≤ 𝑏2
𝑔𝑖 𝑥 ≤ 𝑀𝑦𝑖 (𝑖 = 1,2, … , 𝑚)
𝑦1 + 𝑦2 +. . +𝑦𝑚 = 𝑚 − 𝑘
𝑦𝑖 = 0 or 1 (𝑖 = 1,2, … , 𝑚)
Modeling OR: 2 possible values
A variable takes on one of two values.
OR Constraint: x1 = 5 OR 8
6
Modeling OR: 3 or more possible values
A variable takes on one of 3 or more values.
OR Constraint: x1 = 5 OR 8 OR 17 OR 99
MIP Constraints: x1 = 5 w1 + 8 w2 + 17 w3 + 99 w4
w1 + w2 + w3 + w4 = 1
wj ∈ {0, 1} for j = 1, 2, 3, 4
7
Modeling OR: x = 0 OR L ≤ x ≤ U
A variable is 0 or it is between two bounds.
“OR Constraint”: x2 = 0 OR 4 ≤ x2 ≤ 9 .
MIP Constraints: 4 w5 ≤ x2 ≤ 9 w5
w5 ∈ {0, 1}
8
Sequencing Problem
Introduce a very large number 𝑀 and 0-1 variables 𝑦𝑖𝑗 in which 𝑦𝑖𝑗 =
1 if job 𝑖 is processed before job 𝑗, 𝑦𝑖𝑗 = 0 otherwise. The above
options can be described as follows:
𝑀𝑦𝑖𝑗 + 𝑡𝑖 − 𝑡𝑗 ≥ 𝑝𝑗
𝑀 1 − 𝑦𝑖𝑗 + 𝑡𝑗 − 𝑡𝑖 ≥ 𝑝𝑖
𝑦𝑖𝑗 = 0 or 1
Fixed charge - Warehouse Location Problem
Min Cost = σ𝑚 𝑛 𝑚
𝑖=1 σ𝑗=1 𝑐𝑖𝑗 𝑥𝑖𝑗 + σ𝑖=1 𝑓𝑖 𝑦𝑖
s.t. σ𝑛𝑗=1 𝑥𝑖𝑗 ≤ 𝑠𝑖 𝑦𝑖 ∀𝑖
σ𝑚
𝑖=1 𝑥𝑖𝑗 ≥ 𝑑𝑗 ∀𝑗
𝑥𝑖𝑗 ≥ 0 ∀𝑖, 𝑗
Fixed charge problems
• In a fixed charge problem, in order to produce a
positive amount, the production process must be
set up first at a fixed cost.
• After the setup, the cost of production is linear.
• Note: you are permitted to pay for the setup even
if production is 0, even though this would not be
optimal.
22
Modeling fixed charges
cost
y1 = 0 if x1 = 0
24
20 y1 = 4 + 4x1 if x1 > 0
16
12 Assume 0 ≤ x1 ≤ 100
8
4
0 x1
0 2 4 6 8 10
Investment 1 2 3 4 5 6
Cash Required
(1000s) $5 $7 $4 $3 $4 $6
NPV added
(1000s) $16 $22 $12 $8 $11 $19
How to model (additional) “logical” constraints
5 6
7
4 Minimize the number of
8 9 fire stations needed.
11 12 13
10
14 15 16
Optimization II