Академический Документы
Профессиональный Документы
Культура Документы
Linear Programming
Linear Programming
LP Models
LP Model
An optimization model is a linear
program (or LP) if it has continuous
variables, a single linear objective
function, and all constraints are
linear equalities or inequalities.
LP Model
Linearity
Divisibility (Continuous)
Assumption of Certainty
LP Model
Maximize : 20 x1 24 x2
s.t. 3x1 6 x2 60
4 x1 2 x2 32
NNC : x1 0; x2 0;
6
Standard Form
Min : 20 x1 24 x2 0 x3 0 x4
s.t. 3x1 6 x2 x3
4 x1 2 x2
60
x4 32
NNC : x1 0; x2 0;
x3 0; x4 0;
7
Linear Programming
For purposes of describing and analyzing algorithms, the
problem is often stated in the standard form
T
min{c x : Ax b, x 0}
where x is the vector of n unknowns, c is the n dimensional
cost vector, and A the constraint matrix (m rows and n
columns).
Linear Programming
10
Linear Programming
Each constraint (equation) defines a straight line in
the space of the unknowns x
The feasible region described by the constraints
is a polytope, or simplex, and at least one
member of the solution set lies at a vertex of this
polytope
11
Ways of Solving an LP
Graphical Method
Enumerating all extreme points
Simplex method invented by G. Dantzig
Specialized software such as LINDO
General software such as Excel solver
Sensitivity Analysis of
LPs
Simplex Method is a standard way to solve linear
programs
Its solution yields a simplex tableau with dual
variables which solve a closely related dual problem
& which contain sensitivity analysis information for
original problem concerning
How much could obj. fn. coefficients change without changing
optimal solution?
How would changing RHS values affect value of optimal
solution?
By how much could one change the RHS values without
changing the pattern (nature) of optimal solution?
Would it be optimal to produce a new product if it were
available?
13
Simplex-Based Sensitivity
Analysis is Very Limited
Cant see around corners
Only relevant for linear programs
Was more relevant before CPU cycles
became cheap
Now more convenient to solve
iteratively and plot results, e.g., with
Spider Table
Solver Table
14
Linear Programming
15
Review of
Types of
Common
LP Pbs.
Review of
Types of
Common
LP Pbs.
Typical Constraints
Nonnegative production
Production capacity constraints (i.e, limits on
resources which are consumed in the process of
producing products)
Review of
Types of
Common
LP Pbs.
Constraints
Review of
Types of
Common
LP Pbs.
#3: Investment/Portfolio
Allocation
Pool of resources (e.g., money or
workers) needs to be allocated across a
number of available instruments
Decision: how much to put (e.g., invest)
in each instrument, so ...
Decision variables
for each product i:
Xi = amount of invested in instrument i
25
Investment/Portfolio
Allocation Decisions
Constraints
All resources allocated
Diversity constraints on amount invested in any
one instrument or type of instrument
Nonnegativity
Review of
Types of
Common
LP Pbs.
Scheduling Example:
Police Shift Assignment
Demand for police is defined for four hour
blocks throughout a 24 hour day
(Typically would really look at 168 hour week and
pay attention to # of consecutive days officers
worked too.)
Times
Officers Needed
11 pm - 3 am
30
3 am - 7 am
12
7 am - 11 am
16
11 am - 3 pm
20
3 pm - 7 pm
36
7 pm - 11 pm
34
31
Algebraic Formulation of
Police Scheduling Example
Decision Variables
Xi = officers starting 8 hour shift in period i
Yi = officers starting 12 hour shift in period i
Algebraic Formulation
(cont.)
Constraints
X6 + X1 + Y5 + Y6 + Y1 >= 30
X1 + X2 + Y6 + Y1 + Y2 >= 12
X2 + X3 + Y1 + Y2 + Y3 >= 16
X3 + X4 + Y2 + Y3 + Y4 >= 20
X4 + X5 + Y3 + Y4 + Y5 >= 36
X5 + X6 + Y4 + Y5 + Y6 >= 34
Xi, Yi >= 0 for all i
(Period 1)
(Period 2)
(Period 3)
(Period 4)
(Period 5)
(Period 6)
33
Review of
Types of
Common
LP Pbs.
#5: Transportation/
Assignment Problems
Have various quantities of a commodity at
multiple sources. Need to meet demand for
that commodity at sinks (destinations). How
much should you move that from each source
to each sink in order to minimize the cost of
meeting demand at each destination.
Decision variables
Xij = amount sent from source i to sink j
Cost parameters
cij = cost per unit of shipping from source i to sink j
35
Review of
Types of
Common
LP Pbs.
oil refining
producing animal feed mixes
production of dairy products
allocation of coal to power plants
37
Blending Problems
Decision Variables
Xij =units of ingredient i used in product j
units could be pounds, tons, gallons, etc.
Objective
Minimize cost of producing required
amounts of each product (typically driven
by cost of ingredients)
38
Blending Problems:
Constraint Formulation
Demand constraint example
Need at least 8,000 pounds of product 1
X11 + X21 >= 8,000
Review of
Types of
Common
LP Pbs.
Key characteristics
decisions about multiple time periods
some quantity is conserved over time, creating
constraints that span or link different time periods
41
Typical objectives
Maximize value in last period or
Minimize amount needed in first period
42
Multi-period Planning
Constraints
Mass balance constraint on money for each
time period
Revenue at time t + $ maturing at time t =
amount invested at time t + payments
due at time t (for every period t)
43
Notation
Decision variables
Xi = regular production in period i
Yi = OT production in period i
Zi = shortage in period i
Ii = inventory carried into period i
Parameters
Di = demand in period i
I1 = initial inventory
Cost parameters
45
Formulation
Minimize weighted sum of Xs, Ys, Zs,
and Is
Subject to
Xi <= regular production capacity
Yi <= OT production capacity
Ii <= storage capacity
Ii + Xi + Yi + Zi = Di + Ii+1
mass balance constraint
46
Notation
Decision variables
Wi = # of contractors hired in period i
Xi = # employees hired & trained in period i
Yi = # of experienced workers in period i
Zi = # layed off at beginning of period i
Parameters
Di = demand for exp. workers in period i
Y0 = initial number of experienced workers
Cost parameters
48
Formulation
Min weighted sum of Ws, Xs, Ys, &Zs
Suppose
One exp worker can train four new hires
95% retention of experienced workers
50% retention of trainees
mass balance
49
Review of
Types of
Common
LP Pbs.
Suppose
Sheets are 36 feet wide and
Customers want 8, 12, and 16 foot strips
52
Waste
4
0
4
4
0
0
4
53
Cutting Stock
Problem Constraints
Meet demand for 8 foot strips
4 X1 + 3 X2 + 2 X3 + X4 + X5 >= b1
Nonnegativity
Xi >= 0 for all i
54
Linear Programming
55
Label everything!
56
Maximize Z = 3 X1 + 2 X2
s.t.
X1 + 2 X2 <= 34
(faculty time)
X2 <= 10 (lecture rooms)
X1 <= 20 (seminar rooms)
25 X1 + 100 X2 >= 800
(enrollment)
X1, X2 >= 0
(non-negativity)
57
X2 = # of
Lectures
0
2
0
<= constraints
1
0
1
2
1
0
>= constraints
25
100
# offered
Unit Variety Score
Variety Total
Course
Variety
Index
0
Used
0
0
0
Available
34
Faculty Time
10
Lecture Halls
20
Seminar Rooms
Available
0
Needed
800
Enrollment
58
# offered
Variety
2
Unit Variety Score
=B3*B4 Variety Total
Index
=A5+B5
<= constraints
1
2
0
1
1
0
>= constraints
25
Course
Used
=A$3*A8+B$3*B8
=A$3*A9+B$3*B9
=A$3*A10+B$3*B10
Available
100
=A$3*A13+B$3*B13
Available
34
10
20
Faculty Time
Lecture Halls
Seminar Rooms
Needed
800
Enrollment
59
Spreadsheet Solution:
Cells Specified to Solver
X1 = # of X2 = # of
Seminars Lectures
0
0
# offered
3
2
Unit Variety Score
0
0
Variety Total
Course
Variety
Index
0
<= constraints
1
2
0
1
1
0
Used
0
0
0
Available
34
Faculty Time
10
Lecture Halls
20
Seminar Rooms
>= constraints
25
100
Available
0
Needed
800
Enrollment
60
Under options
Check Assume linear model
All other defaults should be fine
61
Spreadsheet Solution:
Obtained by Solver
X1 = # of X2 = # of
Seminars Lectures
20
7
3
2
60
14
# offered
Unit Variety Score
Variety Total
<= constraints
1
2
0
1
1
0
Used
34
7
20
Available
34
Faculty Time
10
Lecture Halls
20
Seminar Rooms
>= constraints
25
100
Available
1200
Needed
800
Course
Variety
Index
74
Enrollment
62
# offered
Unit Variety Score
Variety Total
<= constraints
1
2
0
1
1
0
Used
34
7
20
Available
35
Faculty Time
10
Lecture Halls
20
Seminar Rooms
>= constraints
25
100
Available
1200
Needed
800
Course
Variety
Index
74
Enrollment
63
# offered
Unit Variety Score
Variety Total
<= constraints
1
2
0
1
1
0
Used
35
7.5
20
Available
35
Faculty Time
10
Lecture Halls
20
Seminar Rooms
>= constraints
25
100
Available
1250
Needed
800
Course
Variety
Index
75
Enrollment
64
Spreadsheet Design
Guidelines
Build model around display of data
Dont bury constants in formulas
Logically close quantities should be
physically close
Design so formulas can be copied
Use color, shading, borders, and
protection
Document with text boxes & cell notes
65
Mathematical Programming
Linear Programming
MS Excel Solver
Cases
68
Linear Programming
Homework
69
Break
70