Lecture7-IE122 - IE 122 Lecture 7 Maximum Flow model: What...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
IE 122 Lecture 7
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Maximum Flow model: What is the maximum traffic flow that can enter the network at a and leave at g?
Background image of page 2
Amplcml/MODELS/netmax.mod set INTER; # intersections param entr symbolic in INTER; # entrance to road network param exit symbolic in INTER, <> entr; # exit from road network set ROADS within (INTER diff {exit}) cross (INTER diff {entr}); param cap {ROADS} >= 0; # capacities of roads var Traff {(i,j) in ROADS} >= 0, <= cap[i,j]; # traffic loads maximize Entering_Traff: sum {(entr,j) in ROADS} Traff[entr,j]; # or maximize Entering_Traff: sum {(j,exit) in ROADS} Traff[j,exit]; subject to Balance {k in INTER diff {entr,exit}}: sum {(i,k) in ROADS} Traff[i,k] = sum {(k,j) in ROADS} Traff[k,j];
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Amplcml/MODELS/ set INTER := a b c d e f g ; param entr := a ; param exit := g ; param: ROADS: cap := a b 50 a c 100 b d 40 b e 20 c d 60 c f 20 d e 50 d f 60 e g 70 f g 70 ;
Background image of page 4
We will learn: How to change model and data without changing the model and data files. We use commands to change the model and data. We will restore the changes using commands.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Changing the Model To drop (ignore) one of the constraints in your model: In ampl window, type: drop nameofcons; To add the dropped constraint: In ampl window, type restore nameofcons; -drop diet_min; -drop diet_min [“CAL”]; -drop {j in SET1} diet_min[j]; -restore diet_min; - restore diet_min[“CAL”]; -restore {j in SET1} diet_min[j];
Background image of page 6
Example: ampl: model MODELS/dietu.mod; ampl: data MODELS/dietu.dat; ampl: solve; MINOS 5.5: optimal solution found. 5 iterations, objective 74.27382022 ampl: drop diet_min; ampl: solve; MINOS 5.5: optimal solution found. 3 iterations, objective 38.64 ampl: restore diet_min; ampl: solve; MINOS 5.5: optimal solution found. 6 iterations, objective 74.27382022 ampl: I did not open model file and delete constraint diet_min!
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon