1.225J 1.225J (ESD 205) Transportation Flow Systems Lecture 6 Introduction to Optimization Prof. Ismail Chabini and Prof. Amedeo R. Odoni Lecture 6 Outline Mathematical programs (MPs) Formulation of shortest path problems as MPs Formulation of U.O. traffic assignment as an MP Relationship between U.O. and S.O. traffic assignment Solving S.O. traffic assignment by hand Lecture summary 1.225, 11/19/02 Lecture 6, Page 2 1 Optimization: Mathematical Programs General formulation (n variables, m constraints): min z ( x1 , x2 ,..., xn ) Objective function Subject to (s.t.): g1 ( x1 , x2 ,..., xn ) ≥ b1 g 2 ( x1 , x2 ,..., xn ) ≥ b2 Feasible set M g m ( x1 , x2 ,..., xn ) ≥ bm ( x1 , x2 ,..., xn ) g j ( x1 , x2 ,..., xn ) ≥ b j Notes: : decision variables : A constraint Max f ( x1 , x2 ,..., xn ) = Min z(x) = − f ( x1 , x2 ,..., xn ) g ( x1 , x2 ,..., xn ) ≤ b ⇔ − g ( x1 , x2 ,..., xn ) ≥ −b g ( x1 , x2 ,..., xn ) = b ⇔ g ( x1, x2 ,..., xn ) ≥ b and − g ( x1 , x2 ,..., xn ) ≥ −b 1.225, 11/19/02 Lecture 6, Page 3 Types of Mathematical Programs (MPs) Linear programs (LPs): objective function is linear, and constraints are linear Non-linear programs (NLPs): objective function is linear. (constraints are usually linear. Otherwise, there might be more than one optimal solution (finding such a solution can be a very time consuming task)) If decision variables are further constrained to take integer values, a linear program is an integer program If decision variables are constrained to take 0/1 values: an integer program is an 0/1 integer program If some, but not all, variables are constrained to take integer values: a linear program is called a mixed integer program 1.225, 11/19/02 Lecture 6, Page 4 2 MPs Are Tools for Transportation Analysts Various models and quantitative analysis questions in transportation can be formulated as minimization (or maximization) problems: • Shortest path problems • Traffic assignment models in congested networks • Signal setting problems • Ramp-metering optimization Examples of questions related to modeling: • Formulate a model as a mathematical program (MP) (there might be more than one model for the same modeling question) • Study the properties of the model (i.e. does the model possess one or multiple solutions? Is it easy to find a solution? • Find a “solution” to the model (One may settle for an approximate reasonable solution, as it is not always possible (desirable) to find an optimal solution in a reasonable amount of time) 1.225, 11/19/02 Lecture 6, Page 5 How to Solve Mathematical Programs? Graphically: This gives you a feel of what is happening By hand using a systematic analytical method Use your software such as Xpress-MP, GAMES, LINDO, CPLEX, Excel: • Software tools are computer implementations of systematic methods There are also specialized software for some transportation applications • Examples: TRANSCAD and EMME/2 for static traffic assignment (We have licenses of these software systems in the CTS Computing lab) 1.225, 11/19/02 Lecture 6, Page 6 3 Shortest Path Problems As An LP: Example We want to find shortest paths from all nodes to Node 5 Decision variables: 1, if arc (i, j ) is used xij = otherwise 0, cij , (i, j ) ∈ A is the cost of each arc 1 2 2 4 1 1 1 1 8 2 3 1 4 4 5 4 6 3 1.225, 11/19/02 Lecture 6, Page 7 AllAll-toto-One Shortest Path Problem As An LP Formulation: min 4 x12 + 3 x13 + x24 + 2 x25 + 8 x32 + 2 x34 + 6 x35 + 4 x45 s.t. x12 + x13 = 1 x24 + x25 − x12 − x32 = 1 x32 + x34 + x35 − x13 = 1 x45 − x24 − x34 = 1 − x25 − x35 − x45 = −4 xij ≥ 0, (i, j ) ∈ A Note: constraints “the decision variables must be integers” should have been added. However, it is known theoretically that the above LP possesses an integer solution, and tools exist to it. 1.225, 11/19/02 Lecture 6, Page 8 4 OneOne-toto-One Shortest Path Problem As An LP Formulation: min 4 x12 + 3 x13 + x24 + 2 x25 + 8 x32 + 2 x34 + 6 x35 + 4 x45 s.t. x12 + x13 = 1 x24 + x25 − x12 − x32 = 0 x32 + x34 + x35 − x13 = 0 x45 − x24 − x34 = 0 − x25 − x35 − x45 = −1 xij ≥ 0, (i, j ) ∈ A Note: we could have added the fact that the decision variables are either 0 or 1. However, it is known theoretically that the above LP possesses a 0-1 solution, and tools exist that provide such solution 1.225, 11/19/02 Lecture 6, Page 9 SO Static Traffic Assignment as an MP: Example min x1t1 (x1 ) + x2t2 (x2 ) + x3t3 (x3 ) f1ac = qac s.t . bc 1 f +f bc 2 Demand = qbc f1ac ≥ 0, f1bc ≥ 0, f 2bc ≥ 0 Non - negativity x1 = f1ac + f 2bc x2 = f1bc x3 = f Definition of link flows bc 2 x1 x2 x3 0 0 0 min x1t1 ( x1 ) + x2t 2 (x2 ) + x3t3 (x3 ) = min ∫ m1 (x1 )dx1 + ∫ m2 ( x2 )dx2 + ∫ m3 (x3 )dx3 where m1 (x1 ) = 1.225, 11/19/02 d ( x1t1 (x1 )) d (x2t2 ( x2 )) d (x3t3 ( x3 )) , m2 (x2 ) = , m3 ( x3 ) = dx1 dx2 dx3 Lecture 6, Page 10 5 Objective Function For U.O. Traffic Assignment t 2 ( x2 ) = 1 + 2 x2 Link 2, x2 5 5 D O t1 ( x1 ) = 2 + x1 Link 1, x1 t2 t1 t2 ( x2 ) Minimum of ( ∫ t1 ( w) dw + ∫ t 2 ( w) dw) x1 x2 0 0 t1 ( x1 ) x2 5 4 3 2 1 0 0 1 2 3 4 5 x1 1.225, 11/19/02 Lecture 6, Page 11 UO & SO Traffic Assignment As MPs: R7 Example x1 x2 x3 x1 0 0 0 x2 x3 0 0 min ∫ t1(x1 )dx1 + ∫ t2 (x2 )dx2 + ∫ t3 (x3 )dx3 min ∫ m1 ( x1 )dx1 + ∫ m2 ( x2 )dx2 + ∫ m3 (x3 )dx3 0 ac 1 s.t. f = qac f +f bc 1 bc 2 s.t. = qbc ac 1 f bc 1 f = qac + f 2bc = qbc f1ac ≥ 0, f1bc ≥ 0, f2bc ≥ 0 f1ac ≥ 0, f1bc ≥ 0, f 2bc ≥ 0 x1 = f1ac + f2bc x1 = f1ac + f 2bc x2 = f1bc x2 = f1bc x3 = f 2bc x3 = f 2bc U.O.: All used paths have, between S.O.: All used paths have, any O-D pair, equal and minimum between any O-D pair, equal and travel time minimum marginal travel times 1.225, 11/19/02 Lecture 6, Page 12 6 Solving SO Static Traffic Assignment: Examples Link 2, x2 5 D O 5 Link 1, x1 1 a 3 b t1 ( x1 ) = 2 + x1 t1 ( x1 ) = 10 + x1 c 2 t 2 ( x2 ) = 1 + 2 x2 t 2 (x2 ) = 90 + x2 t3 ( x3 ) = 0 (qac , qbc ) = (80,10) 1.225, 11/19/02 Lecture 6, Page 13 Solving SO Static Traffic Assignment: Examples Link 2, x2 q D O Link 1, x1 q t2 ( x2 ) = 1 + 2 x2 t1 ( x1 ) = 2 + x1 UO solutions for three values of q: • q=1/8: x1=0, x2=q • q=1/2: x1=0, x2=q • q=5: x1=3, x2=2 SO solutions for three values of q: • m1(x1)=2+2x1; m2(x2)=1+4x2 • q=1/8: x1=0, x2=q • q=1/4: x1=0, x2=q • q=5: x1=(-1+4q)/6, x2=(1+2q)/6 1.225, 11/19/02 Lecture 6, Page 14 7 SO Static Traffic Assignment: Example min x1t1 (x1 ) + x2t 2 (x2 ) + x3t3 (x3 ) s.t . f1ac = qac bc 1 f +f bc 2 Demand = qbc f1ac ≥ 0, f1bc ≥ 0, f 2bc ≥ 0 Non - negativity x1 = f1ac + f 2bc x2 = f1bc x3 = f ( Definition of link flows bc 2 ) * * * S.O. solution: x1 , x2 , x3 = (80,10,0x ) x x min x1t1 ( x1 ) + x2t 2 (x2 ) + x3t3 (x3 ) = min ∫ m1 (x1 )dx1 + ∫ m2 ( x2 )dx2 + ∫ m3 (x3 )dx3 1 2 3 0 0 0 d (x3t3 ( x3 )) d (x2t 2 ( x2 )) d ( x1t1 (x1 )) , m2 ( x 2 ) = , m3 ( x3 ) = where m1 (x1 ) = dx3 dx2 dx1 1.225, 11/19/02 Lecture 6, Page 15 Lecture 6 Outline Mathematical programs (MPs) Formulation of shortest path problems as MPs Formulation of U.O. traffic assignment as an MP Relationship between U.O. and S.O. traffic assignment Solving S.O. traffic assignment by hand 1.225, 11/19/02 Lecture 6, Page 16 8