Lecture 2 - LP Modeling (Annotated 2023)
Lecture 2 - LP Modeling (Annotated 2023)
LP Modeling
1. Review and basics
2. Some LP modeling techniques
3. More LP modeling techniques
4. More LP modeling examples
1. Review and basics
Linear optimization models
Basics of LP modeling:
Modeling constraints
a. Percentages/proportions.
b. Simple averages.
c. Weighted averages.
d. Variable weighted averages.
e. Absolute value
Notation
} will denote
variables.
} will denote
constants.
a. Percentages/proportions
Percentage
is percent of .
Proportion
b. Simple averages
are linear
expressions:
Examples of constraints using simple average
c. Weighted averages
is nonlinear.
But in general, we can write
We obtain two equivalent linear constraints
3. More LP modeling techniques
Modeling different
objective functions
Some objective functions we can model linearly
• Linear
• Absolute value
• Maximum
We will learn how to model these
objective functions by modelling
them in the special case of the
Assignment Problem.
Each worker must be assigned to exactly one job and vice versa
The classic assignment problem: variables
1
1 ..
.. .
n . xij j n
workers i jobs
.. (Binary ..
. variable) .
n n
Linear Objective Function: the model
We already
know how to
model this
case
Linear Absolute value Objective Function: the model?
How to
model it?
A simpler example
Linear Absolute value Objective Function: the model
Linear Absolute value Objective Function: an application
How to
model it?
Exercise
Maximum of Linear Objective Functions: the model?
How to
model it?
A simpler example
Maximum of Linear Objective Functions: the model
A comment
This other model does
not model the
Maximum of (two) Linear
Objective Functions
It models a worse case cost
for every ij pair.
Summary
More LP modeling:
Nonlinear!!!
} These constraints
“represent” the
maximum.
Maximum in general (nonlinear)
Maximum in general (linear)
Example: Absolute value as objective function
Nonlinear!!!
But we can use
1.
2. The technique we used to linearize the
maximum of two linear functions.
Done!!!
b. Minimum in general (nonlinear)
Minimum in general (linear)
4. More LP modeling examples:
a.Production planning
b.Network flow models
a.Production planning
(http://cdn.wonderfulengineering.com/wp-
Example: Production planning + fixed cost
Data:
• T: number of periods • pt: unit production cost in t
• dt: demand in t • ft: setup cost in t
• s0: initial inventory
1 2 … t … T-1 T
inventory at the
t demand in t
beginning of t
inventory at the
end of t
Data:
Variables
On each period t we will have:
(Production
in t)
(Production cost)
t (Demand in t)
(Holding cost)
(Holding cost)
(Production (Inventory
cost) cost)
Constraints
1. Nonnegativity:
2. Balance equation:
} Bounds on variables
General transportation problem (data)
General transportation problem
(illustration)
1 d1
s1 1
.. ..
. .. .
cij . j dj
si i
.. uij ..
. .. .
sn n . m dm
General transportation problem (variables)
General transportation problem (LP model)
}
} Demand must be satisfied
exactly.
Bounds on
variables
Remark about feasibility
Feasibility requires:
Demand
Costs
Upper bounds
Example
Application of the previous technique to
1 5
2 1 1, 15
3 2 2, 19
4 3, 17
3
Notation: uij, cij.
What to do if that requirement is not satisfied?
(2)
2. If we have:
Source
Costs
Upper bounds
Special case: the assignment problem.
Example: FIFA World Cup 2014
1
1 ..
Soccer .. Assignment? .
matches . Stadiums
i j
.. ..
. .
Cost: cij
n n
The assignment problem (as transportation
problem).
The model:
(uij= 1, for all i,j)
1 1
1 1 ..
.. .. .
. cij .
1 i j 1
.. ..
. .. .
1 n .
n 1
General assignment problem (variables)
} j
i is assigned to exactly one
}
} j is assigned to exactly
one i
Bounds on
variables
The assignment problem is a nice LP
We would require
(Fractional
solution does not
make sense!)
House 1
40, 15
.
40, 5
Demand
Supply
100
Georgia
Power 40, 8
. N1
40, 8
40, 13
N2 40, 7 30
40, 26
N3 40, 10
House 2
Network flow problem (variables)
Set of arcs:
A={(GP,N1),(GP,H1),(GP,N3),(N1,H1),
(N1,N2),(N1,N3),(H1,N2),(N2,H2),(N3,H2)}
Network flow problem (objective function)
1. Bounds on variables:
Network flow problem (constraints)
2. Flow conservation:
“OUTPUT - INPUT = 0”
Flow conservation at node GP