New Stage zCourse Phases yDescription of Systems and Issues yPrescriptive tools and modeling...

Post on 03-Jan-2016

215 views 2 download

Transcript of New Stage zCourse Phases yDescription of Systems and Issues yPrescriptive tools and modeling...

New Stage

Course Phases Description of Systems and Issues Prescriptive tools and modeling International Aspects

Prescriptive Tools & ModelsNetwork Flows

Principally Transportation Limited direct applications Good start on modeling Integer answers for free

Added realism Weight and cube -- conveyance capacity Frequency and Schedule Driven systems Inventory and Load Driven systems Trailer fill and customer service Location models Routing

No Text

There is no text for this portion of the course

Be sure to ask questions in classWork on your case! The issues in the case

parallel those covered in classKeep up. Attend help sessions with Manu.The Case is excellent preparation for the

exam.

Transportation/Network Models

Single Commodity Route Selection (Shortest Path) Basic Network Design (Spanning Tree) Basic Transportation (Transportation

Model) Cross Docking (Transshipment Models)

Multiple Commodities

Route Selection

Getting From A to BUnderlying Network

Roads Airports Telecommunication links

Costs of using each linkFind the cheapest (shortest) path

Example

9084 84

126

15048

348

66138

90120

132

126

60

13248

156

A

E

D

C

B

J

H

G

F

I

Directed Edges

Shortest Path Model

An introduction to AMPL and review of modeling

Sets Define entities and index data The Nodes of the Graph

set NODES;

The Edges of the Graphset EDGES within NODES cross NODES;

Shortest Path Model

Parameters Hold data The Cost on each Edge

param Cost{EDGES};

The Origin and Destinationparam Origin symbolic;param Destination symbolic;

Shortest Path Model

The Variables The decisions the model should make Which edges to use

var UseEdge{EDGES} >= 0;/* The number of times we use each edge */

Shortest Path Model

The Objective How we distinguish which solution is

better minimize PathCost:

sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t];

Shortest Path ModelConstraints

Eliminate what is not feasible Flow 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

To be a linear program variables can only be of the form

var UseEdge{EDGES} >= lower bound, <= upper bound;

Other possibilities (for later) var UseEdge{EDGES} binary (meaning 0

or 1) var UseEdge{EDGES} integer >= 0; Called Integer Programming

More Rules of the Game

The Objective must be of the form: minimize ObjectiveName: sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t]; maximize ObjectiveName: sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t]; What’s relevant:

minimize or maximizesum of known constant * variable

What’s not allowedvariable*variable , |variable - constant|, variable2...

More Rules of the Game

The Constraints must be of the form: s.t ConstraintName: sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t] <= Constant s.t. ConstraintName: sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t] >= Constant s.t. ConstraintName: sum{(f,t) in EDGES} Cost[f,t]*UseEdge[f,t] = Constant

More Rules of the GameWhat’s relevant:

Left-hand-side:sum of known constant * variable

Right-hand-sideknown constant

Sense of constraint>=, <=, =

What’s not allowedvariable*variable , |variable - constant|, variable2...

Network Flow Problems

Special Case of Linear ProgramsIf the data are integral, the solutions

will be integralNot generally true of Linear

Programs, just of Network Flow Problems

To Be a Network Flow Problem

Constraints must be of the form sum{(f, node) in EDGES} UseEdge[f,node] - sum{(node, t) in EDGES} UseEdge[node, t]= or <= or >= constant

And Each variable can appear in at most two constraints, once as a flow in, e.g., as part of the sumsum{(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 DataThe NodesA 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;

NodesABCDEFGHIJ

More Data

The Edges and CostsNamed region called Costs table CostsTable IN "ODBC" "d:\personal\3101\ShortPathData.xls" "Costs": EDGES <- [FromNode, ToNode], Cost;

read table CostsTable;

FromNode ToNode CostA B 90A C 138A D 348B C 66B E 84C D 156C F 90D G 48E F 120E I 84F G 132F H 60G H 48G J 150H I 132H J 126I J 126

More Data

The Origin and DestinationA Named Region called OriginDest

table OriginDestTable IN "ODBC" "d:\personal\3101\ShortPathData.xls" "SQL=SELECT Origin, Destination FROM OriginDest":

[], Origin, Destination;

read table OriginDestTable;

Origin DestinationA J

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

From a DOS prompt in ..\ilogLaunch AMPL by typing amplAt 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

Single OriginSingle DestinationNo requirement to visit intermediate nodesNo “negative cycles”Answer will always be either

a simple path infeasible unbounded

Tree of Shortest Paths

Find shortest paths from Origin to each node

Send n-1 units from origin Get 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

The Answer is how many paths the edge is in. Not whether or not it is in a path.

Minimum Spanning Tree

Find the cheapest total cost of edges required to tie all the nodes together

9084 84

126

15048

348

66138

90120

132

126

60

13248

156

A

E

D

C

B

J

H

G

F

I

Greedy Algorithm

Consider links from cheapest to most expensive

Add a link if it does not create a cycle with already chosen links

Reject the link if it creates a cycle.

What’s the difference

Shortest Path Problem Rider’s version Consider the number of riders who will

use itSpanning Tree Problem

Builder’s version Consider only the cost of construction NOT A NETWORK FLOW PROBLEM

Transportation Problem

Sources with limited supplyDestinations with requirementsCost proportional to volumeMultiple sourcing allowed

PROTRAC Engine Distribution

500

800 700

500

400

900

200

*

*

*

*

*

*

*

Belgium

Germany

Netherlands

The Hague

Amsterdam

Antwerp

Nancy

Liege

Tilburg

Leipzig

Miles

100500

500

800

700

500

200

400

900

Transportation CostsTo Destination

From Origin Leipzig Nancy Liege TilburgAmsterdam 120 130 41 62Antwerp 61 40 100 110The Hague 102.5 90 122 42

Unit transportation costs from harbors to plants

Minimize the transportation costs involved in

moving the engines from the harbors to the

plants

A Transportation ModelThe Sets

The set of Portsset PORTS; The set of Plantsset PLANTS; The set of Edges is assumed

to be all port-plant pairs. If it is not, we should define the set of edges.

A Transportation ModelThe Parameters

Supply at the Portsparam Supply{PORTS}; Demand at the Plantsparam Demand{PLANTS}; Cost per unit to shipparam Cost{PORTS,PLANTS};

Transportation Model

The Variables How much to ship from each port to each plantvar Ship{PORTS, PLANTS} >= 0;

The Objective Minimize the total cost of shippingminimize TotalCost: sum {port in PORTS, plant in PLANTS} Cost[port, plant]*Ship[port, plant];

Transportation Model

The Constraints Do not exceed supply at any ports.t. RespectSupply {port in PORTS}: sum{plant in PLANTS} Ship[port, plant]<= Supply[port]; Meet Demand at each plants.t. MeetDemand {plant in PLANTS}: sum{port in PORTS} Ship[port, plant]>= Demand[plant];

Observations

If Supply and Demand are integral then the answer Ship will be integral as well.

Single Commodity -- doesn’t matter where it came from.

Proportional Costs.

Crossdocking

3 plants2 distribution centers2 customersMinimize shipping costs

Direct from plant to customer

Via DC

A Transshipment Model

The Sets The Plants set PLANTS; The Distribution Centers set DCS; The Customers set CUSTS;

Transshipment Model

The Set of EdgesWe assume all Plant-DC, Plant-Customer,

DC-Customer edges are possible. Convenient to define a set of Edgesset EDGES := (PLANTS cross DCS) union (PLANTS cross CUSTS) union (DCS cross CUSTS);

A Transshipment Model

The Parameters The Supply at each plant

param Supply{PLANTS};

The Demand at each Customerparam Demand{CUSTS};

The Cost on each edge. param Cost{EDGES};See the convenience of defining EDGES?

A Transshipment Model

The Variables The volume shipped on each edge var Ship{EDGES} >= 0;

The ConstraintsCombine ideas of Shortest paths (flow

conservation) with Transportation (meet supply and demand)

A Transshipment ModelFor each Plants.t. RespectSupply {plant in PLANTS}: sum{(plant, t) in EDGES} Ship[plant,t]<= Supply[plant];For each Customers.t. MeetDemand {cust in CUSTS}: sum{(f, cust) in EDGES} Ship[f, cust]>= Demand[cust];

A Transshipment Model

For each DC: Conserve flows.t. ConserveFlow {dc in DCS}: sum{(f, dc) in EDGES} Ship[f,dc]

= sum{(dc, t) in EDGES} Ship[dc,t];

Flow into the DC = Flow out of the DC

Good News

Lots of applicationsSimple ModelOptimal Solutions QuicklyIntegral Data, Integral Answers

Bad News

What’s Missing? Single Homogenous Product Linear Costs No conversions or losses ...

Homogenous Product

Linear Costs

No Fixed ChargesNo Volume DiscountsNo Economies of Scale