Notes 6 IE312 1 Knapsack Model Intuitive idea: what is the most valuable collection of items that can be fit into a backpack?
Notes 6 IE312 1
Knapsack Model Intuitive idea: what is the most
valuable collection of items that can be fit into a backpack?
Notes 6 IE312 2
Race Car Features
1 2 3 4 5 6Cost (thousand) 10.2$ 6.0$ 23.0$ 11.1$ 9.8$ 31.6$ Speed increase (mph) 8 3 15 7 10 12
Proposed Feature (j )
Budget of $35,000
Which features should be added?
Notes 6 IE312 3
Decision variables
ILP
Formulation
otherwise0
added is feature if1 jx j
1 2 3 4 5 6
1 2 3 4 5 6
max 8 3 15 7 10 12
10.2 6.0 23.0 11.1 9.8 31.6 35s.t
0 or 1j
x x x x x x
x x x x x x
x
Notes 6 IE312 4
LINGO FormulationMODEL:
SETS:
FEATURES /F1,F2,F3,F4,F5,F6/: INCLUDE,SPEED_INC,COST;
ENDSETS
DATA:
SPEED_INC = 8 3 15 7 10 12;
COST = 10.2 6.0 23.0 11.1 9.8 31.6;
BUDGET = 35;
ENDDATA
MAX = @SUM( FEATURES: SPEED_INC * INCLUDE);
@SUM( FEATURES: COST * INCLUDE) <= BUDGET;
@FOR( FEATURES: @BIN( INCLUDE));
END
Specifyindex sets
All theconstants
Objective
Constraints
Variables indexed bythis set
Decision variablesare binary
Note ; to end command: to begin an environment
Notes 6 IE312 5
Solve using Branch & Bound
5 0x 5 1x
1 2 3 4 6
1 2 3 4 6
max 8 3 15 7 12
10.2 6.0 23.0 11.1 31.6 35s.t
0 or 1j
x x x x x
x x x x x
x
1 2 3 4 6
1 2 3 4 6
max 8 3 15 7 12
10.2 6.0 23.0 11.1 31.6 35s.t
[0,1]j
x x x x x
x x x x x
x
Solution?
Candidate Problem
Relaxed Problem
Notes 6 IE312 6
What is the Relative Worth?
1
2
3
4
5
6
8: 0.7810.23: 0.5615: 0.65237: 0.6311.110: 1.029.812: 0.3831.6
x
x
x
x
x
x
Want to add thisfeature first
Want to add thisfeature second
Notes 6 IE312 7
Solve Relaxed Problem
5 0x 5 1x
1 2 3 4 6
1 2 3 4 6
max 8 3 15 7 12
10.2 6.0 23.0 11.1 31.6 35s.t
[0,1]j
x x x x x
x x x x x
x
Solution:
Relaxed Problem
1
3
4
1 Still have $35 $10.2 $24.8
1 Still have $24.8 $23.0 $1.8
1.8 0.2577
x
x
x
Objective 24.8
8 1 15 1 7 0.257
Notes 6 IE312 8
Now the other node…
5 0x 5 1x
1 2 3 4 6
1 2 3 4 6
max 8 3 15 7 12 10
10.2 6.0 23.0 11.1 31.6 35 9.8s.t
[0,1]j
x x x x x
x x x x x
x
Relaxed Problem
Solution:
1
3
1 Still have $25.2 $10.2 $15
15 0.65223
x
x
Objective 27.8
Notes 6 IE312 10
Rule of Thumb: Better Value
5 0x 5 1x
Obj 24.8
1 0x 1 1x
2 3 4 6
2 3 4 6
max 3 15 7 12 18
6.0 23.0 11.1 31.6 15s.t
[0,1]j
x x x x
x x x x
x
Relaxed Problem
Solution:
315 0.65223x
2 3 4 6
2 3 4 6
max 3 15 7 12 10
6.0 23.0 11.1 31.6 25.2s.t
[0,1]j
x x x x
x x x x
x
Relaxed Problem
3
4
1 Still have $25.2 $23 $2.2
2.2 0.19811.1
x
x
Obj. 26.4 Obj. 27.8
Solution:
Notes 6 IE312 11
Next Level
5 0x 5 1x
Obj 24.8
1 0x 1 1x
Obj. 26.4
3 0x 3 1x
Infeasible
2 4 6
2 4 6
max 3 7 12 18
6.0 11.1 31.6 15s.t
0,1j
x x x
x x x
x
Candidate Problem
4 2 61, 0x x x Solution:
Obj. = 25
(This turns out to be true.)
Now What?
Notes 6 IE312 12
Next Steps …
5 0x 5 1x
Obj 24.8
1 0x 1 1x
Obj. 26.43 0x 3 1x
InfeasibleObj. = 25
Obj 25
Still need to continue branching here.
Finally we will have
accounted for every solution!
Notes 6 IE312 13
Capital Budgeting Multidimensional knapsack
problems are often called capital budgeting problems
Idea: select collection of projects, investments, etc, so that the value is maximized (subject to some resource constraints)
Notes 6 IE312 14
NASA Capital Budgeting2000- 2005- 2010- 2015- 2020- Not Depends
j Mission 2004 2009 2014 2019 2024 Value With On1 Communication satellite 6 2002 Orbital microwave 2 3 33 Io lander 3 5 204 Uranus orbiter 2020 10 50 5 35 Uranus orbiter 2010 5 8 70 4 36 Mercury probe 1 8 4 20 37 Saturn probe 1 8 5 38 Infrared imaging 5 10 119 Ground-based SETI 4 5 200 14
10 Large orbital structures 8 4 15011 Color imaging 2 7 18 8 212 Medical technology 5 7 813 Polar orbital platform 1 4 1 1 30014 Geosynchronous SETI 4 5 3 3 185 9
Budget 10 12 14 14 14
Budget Requirements
Notes 6 IE312 15
Formulation Decision variables
Budget constraints
otherwise0
chosen is mission if1 jx j
1 2 3 7 9 126 2 3 1 4 5 10 (year 1)x x x x x x
Notes 6 IE312 16
Formulation Mutually exclusive choices
Dependencies
1
1
1
149
118
54
xx
xx
xx
34
211
xx
xx
Notes 6 IE312 19
Ways of Splitting the Set Set covering constraints
Set packing constraints
Set partitioning constraints
Jj
jx 1
Jj
jx 1
Jj
jx 1
Notes 6 IE312 20
Example: Choosing OR Software
Algorithm 1 2 3 4LP Yes Yes Yes YesIP Yes YesNLP Yes YesCost 3 4 6 14
Software Package (j )
Formulate a set covering problem to acquire the minimum costsoftware with LP, IP, and NLP capabilities.
Formulate set partitioning and set packing problems. What goalsdo they meet?
Notes 6 IE312 21
Maximum Coverage Perhaps the budget only allows $9000 What can we then do
Maximum coverage How do we now formulate the
problem? Need new variables
otherwise0
providednot ALG if1ALGy
Notes 6 IE312 22
Travelling Salesman Problem (TSP)
Ames
Fort Dodge
BooneCarrollMarshalltown
West Des Moines
Waterloo
What is the shortest route,starting in Ames, that visitseach city exactly ones?
Notes 6 IE312 24
Not a TSP Solution
Ames
Fort Dodge
BooneCarrollMarshalltown
West Des Moines
Waterloo
Notes 6 IE312 25
Applications
Routing of vehicles (planes, trucks,
etc.)
Routing of postal workers
Drilling holes on printed circuit boards
Routing robots through a warehouse,
etc.
Notes 6 IE312 26
Formulating TSP A TSP is symmetric if you can go
both ways on every arc
otherwise0
and between leg includes route theif1,
jix ji
i ij
jiji xc ,,min
2, ij
jix
Notes 6 IE312 28
Subtours It is not sufficient to have two arcs
connected to each node Why?
Must eliminate all subtours Every subset of points must be
exited
Notes 6 IE312 30
Asymmetric TSP Now we have decision variables
Constraints
otherwise0
to from goes route theif1,
jix ji
)(enter 1
) (leave 1
,
,
ix
ix
ijij
ijji
Notes 6 IE312 31
Asymmetric TSP (cont.) Each tour must enter and leave
every subset of points
Along with all variables being 0 or 1, this is a complete formulation
1, Si Sj
jix
Notes 6 IE312 32
Example1
5
2
6
3 4
10
10
10
11
1
1
1 1
Assume a two unit penalty for passing from a high to lowernumbered node.
This is now an asymmetric TSP. Why?
Notes 6 IE312 33
Subtour Elimination Making sure there are no subtours
involves a very large number of constraints
Can obtain simpler constraints if we go with a nonlinear objective function
otherwise0
is tedpoint visith theif1,
iky ik
Notes 6 IE312 34
Quadratic Assignment Formulation
1,0
1
1
min
,
,
,
,1,,
ik
kik
iik
i j kjkikji
y
y
y
yyd