New Stage zCourse Phases yDescription of Systems and Issues yPrescriptive tools and modeling yInternational Aspects
Prescriptive Tools & Models zNetwork Flows yPrincipally Transportation yLimited direct applications yGood start on modeling yInteger answers for free zAdded realism yWeight and cube -- conveyance capacity yFrequency and Schedule Driven systems yInventory and Load Driven systems yTrailer fill and customer service yLocation models yRouting
No Text zThere is no text for this portion of the course zBe sure to ask questions in class zWork on your case! The issues in the case parallel those covered in class zKeep up. Attend help sessions with Manu. zThe Case is excellent preparation for the exam.
Transportation/Network Models zSingle Commodity yRoute Selection (Shortest Path) yBasic Network Design (Spanning Tree) yBasic Transportation (Transportation Model) yCross Docking (Transshipment Models) zMultiple Commodities
Route Selection zGetting From A to B zUnderlying Network yRoads yAirports yTelecommunication links zCosts of using each link zFind the cheapest (shortest) path
Example A E D C B J H G F I Directed Edges
Shortest Path Model zAn introduction to AMPL and review of modeling zSets yDefine entities and index data yThe Nodes of the Graph set NODES; yThe Edges of the Graph set EDGES within NODES cross NODES;
Shortest Path Model zParameters yHold data yThe Cost on each Edge param Cost{EDGES}; yThe Origin and Destination param Origin symbolic; param Destination symbolic;
Shortest Path Model zThe Variables yThe decisions the model should make yWhich edges to use var UseEdge{EDGES} >= 0; /* The number of times we use each edge */
Shortest Path Model zThe Objective yHow we distinguish which solution is better minimize PathCost: sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t];
Shortest Path Model zConstraints yEliminate what is not feasible yFlow Conservation at each node s.t. ConserveFlow{node in NODES}: sum{(f, node) in EDGES} UseEdge[f,node] - sum{(node, t) in EDGES} UseEdge[node, t] = (if node = Origin then -1 else if node = Destination then 1 else 0);
Rules of the Game zTo be a linear program yvariables can only be of the form xvar UseEdge{EDGES} >= lower bound, <= upper bound; zOther possibilities (for later) yvar UseEdge{EDGES} binary (meaning 0 or 1) yvar UseEdge{EDGES} integer >= 0; yCalled Integer Programming
More Rules of the Game zThe Objective must be of the form: yminimize ObjectiveName: y sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t]; ymaximize ObjectiveName: y sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t]; yWhat’s relevant: xminimize or maximize xsum of known constant * variable yWhat’s not allowed xvariable*variable, |variable - constant|, variable 2...
More Rules of the Game zThe Constraints must be of the form: ys.t ConstraintName: y sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t] y<= Constant ys.t. ConstraintName: y sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t] y>= Constant ys.t. ConstraintName: y sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t] y= Constant
More Rules of the Game zWhat’s relevant: yLeft-hand-side: xsum of known constant * variable yRight-hand-side xknown constant ySense of constraint x>=, <=, = yWhat’s not allowed xvariable*variable, |variable - constant|, variable 2...
Network Flow Problems zSpecial Case of Linear Programs zIf the data are integral, the solutions will be integral zNot generally true of Linear Programs, just of Network Flow Problems
To Be a Network Flow Problem zConstraints must be of the form sum{(f, node) in EDGES} UseEdge[f,node] - sum{(node, t) in EDGES} UseEdge[node, t] = or = constant zAnd Each variable can appear in at most two constraints, once as a flow in, e.g., as part of the sum sum{(f, node) in EDGES} UseEdge[f,node] once as a flow out, e.g., as part of the sum - sum{(node, t) in EDGES} UseEdge[node, t]
The Data zThe Nodes zA named region called Nodes in the spreadsheet d:\personal\3101\ShortPathData.xls table NodesTable IN "ODBC" "d:\personal\3101\ShortPathData.xls" "SQL=SELECT Nodes FROM Nodes": NODES <- [Nodes]; read table NodesTable;
More Data zThe Edges and Costs zNamed region called Costs table CostsTable IN "ODBC" "d:\personal\3101\ShortPathData.xls" "Costs": EDGES <- [FromNode, ToNode], Cost; read table CostsTable;
More Data zThe Origin and Destination zA Named Region called OriginDest table OriginDestTable IN "ODBC" "d:\personal\3101\ShortPathData.xls" "SQL=SELECT Origin, Destination FROM OriginDest": [], Origin, Destination; read table OriginDestTable;
Getting Answers Out table ExportSol OUT "ODBC" "DSN=ShortPathSol" "Solution": {(f,t) in EDGES: UseEdge[f,t] > 0} -> [f~FromNode,t~ToNode], UseEdge[f,t]~UseEdge, UseEdge[f,t]*Cost[f,t]~TotalCost; write table ExportSol;
Running the Model zFrom a DOS prompt in..\ilog Launch AMPL by typing ampl zAt the AMPL: prompt type model d:\….\shortpath.mod; include d:\…\shortpath.run;
What’s in the.RUN file /* Read the data */ read table NodesTable; read table CostsTable; read table OriginDestTable; /* Solve the problem You may need a command like option solver cplex; */ solve;
The rest of the.RUN File /* Write the solution out: May encounter write access error */ table UseEdgeOutTable OUT "ODBC" "d:\personal\3101\ShortPathData.xls": {(f,t) in EDGES} -> [FromNode, ToNode], UseEdge[f, t]~UseEdge, UseEdge[f,t]*Cost[f,t]~TotalCost; write table UseEdgeOutTable;
Applicability zSingle Origin zSingle Destination zNo requirement to visit intermediate nodes zNo “negative cycles” zAnswer will always be either ya simple path yinfeasible yunbounded
Tree of Shortest Paths zFind shortest paths from Origin to each node zSend n-1 units from origin zGet 1 unit to each destination
Shortest Path Problem Just change the Conservation Constraints... s.t. ConserveFlow{thenode in NODES}: sum{(f, thenode) in EDGES} UseEdge[f, thenode] - sum{(thenode, t) in EDGES} UseEdge[thenode, t] = (if thenode = Origin then -(card(NODES)-1) else 1);
Use Some Care zThe Answer is how many paths the edge is in. Not whether or not it is in a path.
Minimum Spanning Tree zFind the cheapest total cost of edges required to tie all the nodes together A E D C B J H G F I
Greedy Algorithm zConsider links from cheapest to most expensive zAdd a link if it does not create a cycle with already chosen links zReject the link if it creates a cycle.
What’s the difference zShortest Path Problem yRider’s version yConsider the number of riders who will use it zSpanning Tree Problem yBuilder’s version yConsider only the cost of construction yNOT A NETWORK FLOW PROBLEM
Transportation Problem zSources with limited supply zDestinations with requirements zCost proportional to volume zMultiple sourcing allowed
PROTRAC Engine Distribution * * * * * * * Belgium Germany Netherlands The Hague Amsterdam Antwer p Nancy Liege Tilburg Leipzig Miles
Transportation Costs Unit transportation costs from harbors to plants Minimize the transportation costs involved in moving the engines from the harbors to the plants
A Transportation Model zThe Sets yThe set of Ports set PORTS; yThe set of Plants set PLANTS; yThe set of Edges is assumed to be all port-plant pairs. If it is not, we should define the set of edges.
A Transportation Model zThe Parameters ySupply at the Ports param Supply{PORTS}; yDemand at the Plants param Demand{PLANTS}; yCost per unit to ship param Cost{PORTS,PLANTS};
Transportation Model zThe Variables yHow much to ship from each port to each plant var Ship{PORTS, PLANTS} >= 0; zThe Objective yMinimize the total cost of shipping minimize TotalCost: sum {port in PORTS, plant in PLANTS} Cost[port, plant]*Ship[port, plant];
Transportation Model zThe Constraints yDo not exceed supply at any port s.t. RespectSupply {port in PORTS}: sum{plant in PLANTS} Ship[port, plant] <= Supply[port]; yMeet Demand at each plant s.t. MeetDemand {plant in PLANTS}: sum{port in PORTS} Ship[port, plant] >= Demand[plant];
Observations zIf Supply and Demand are integral then the answer Ship will be integral as well. zSingle Commodity -- doesn’t matter where it came from. zProportional Costs.
Crossdocking z3 plants z2 distribution centers z2 customers zMinimize shipping costs yDirect from plant to customer yVia DC
A Transshipment Model zThe Sets yThe Plants set PLANTS; yThe Distribution Centers set DCS; yThe Customers set CUSTS;
Transshipment Model zThe Set of Edges zWe assume all Plant-DC, Plant-Customer, DC-Customer edges are possible. zConvenient to define a set of Edges set EDGES := (PLANTS cross DCS) union (PLANTS cross CUSTS) union (DCS cross CUSTS); z
A Transshipment Model zThe Parameters yThe Supply at each plant param Supply{PLANTS}; yThe Demand at each Customer param Demand{CUSTS}; yThe Cost on each edge. param Cost{EDGES}; xSee the convenience of defining EDGES?
A Transshipment Model zThe Variables yThe volume shipped on each edge var Ship{EDGES} >= 0; zThe Constraints zCombine ideas of Shortest paths (flow conservation) with Transportation (meet supply and demand)
A Transshipment Model zFor each Plant s.t. RespectSupply {plant in PLANTS}: sum{(plant, t) in EDGES} Ship[plant,t] <= Supply[plant]; zFor each Customer s.t. MeetDemand {cust in CUSTS}: sum{(f, cust) in EDGES} Ship[f, cust] >= Demand[cust];
A Transshipment Model zFor each DC: Conserve flow s.t. ConserveFlow {dc in DCS}: sum{(f, dc) in EDGES} Ship[f,dc] = sum{(dc, t) in EDGES} Ship[dc,t]; zFlow into the DC = Flow out of the DC
Good News zLots of applications zSimple Model zOptimal Solutions Quickly zIntegral Data, Integral Answers
Bad News zWhat’s Missing? ySingle Homogenous Product yLinear Costs yNo conversions or losses y...
Homogenous Product
Linear Costs zNo Fixed Charges zNo Volume Discounts zNo Economies of Scale