Transportation

Download Report

Transcript Transportation

New Stage
 Course Phases
 Description of Systems and Issues
 Prescriptive tools and modeling
 International Aspects
Prescriptive Tools & Models
 Network 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 class
 Work on your case! The issues in the case
parallel those covered in class
 Keep 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 B
 Underlying Network
 Roads
 Airports
 Telecommunication links
 Costs of using each link
 Find the cheapest (shortest) path
Example
B
A
90
138 66
C
348
84
Directed Edges
I
84
132
120
90
F
156
D
E
60
132
48
G
126
H
126
48
J
150
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 Graph
 set EDGES within NODES cross NODES;
Shortest Path Model
 Parameters
 Hold data
 The Cost on each Edge
 param Cost{EDGES};
 The Origin and Destination
 param 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 Model
 Constraints
 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
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 maximize
 sum of known constant * variable
 What’s not allowed
 variable*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 Game
 What’s relevant:
 Left-hand-side:
 sum of known constant * variable
 Right-hand-side
 known constant
 Sense of constraint
 >=, <=, =
 What’s not allowed
 variable*variable , |variable - constant|, variable2...
Network Flow Problems
 Special Case of Linear Programs
 If the data are integral, the solutions will
be integral
 Not 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 sum
sum{(f, node) in EDGES}
UseEdge[f,node]
The Data
 The Nodes
 A 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;
Nodes
A
B
C
D
E
F
G
H
I
J
More Data
 The Edges and Costs
 Named region called Costs
FromNode ToNode
A
B
A
C
A
D
B
C
B
E
C
D
C
F
D
G
E
F
E
I
F
G
F
H
G
H
G
J
H
I
H
J
I
J
table CostsTable IN "ODBC"
"d:\personal\3101\ShortPathData.xls"
"Costs":
EDGES <- [FromNode, ToNode], Cost;
read table CostsTable;
Cost
90
138
348
66
84
156
90
48
120
84
132
60
48
150
132
126
126
More Data
 The Origin and Destination
 A Named Region called OriginDest
Origin
"ODBC"A
table OriginDestTable IN
"d:\personal\3101\ShortPathData.xls"
"SQL=SELECT Origin, Destination FROM
OriginDest":
[], Origin, Destination;
read table OriginDestTable;
Destination
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 ..\ilog
 Launch AMPL by typing ampl
 At 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 Origin
 Single Destination
 No requirement to visit intermediate
nodes
 No “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, the
sum{(thenode, t) in EDGES} UseEdge[thenod
= (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
B
A
90
138 66
C
348
84
I
84
132
120
90
F
156
D
E
60
132
48
G
126
H
126
48
J
150
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 it
 Spanning Tree Problem
 Builder’s version
 Consider only the cost of construction
 NOT A NETWORK FLOW PROBLEM
Transportation Problem




Sources with limited supply
Destinations with requirements
Cost proportional to volume
Multiple sourcing allowed
PROTRAC
Engine Distribution
Netherlands
500
Amsterdam
*
500
* Tilburg
800500
500
Antwer *
700
p
700
*
Belgium Liege
200
200
The Hague
*
800
*
900
900
Miles
0
50
Nancy
100
Germany
400
*
Leipzig
400
Transportation Costs
From Origin
Amsterdam
Antwerp
The Hague
Leipzig
120
61
102.5
To Destination
Nancy
Liege
130
41
40
100
90
122
Tilburg
62
110
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 Model
 The Sets
 The set of Ports
set PORTS;
 The set of Plants
set 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 Model
 The Parameters
 Supply at the Ports
param Supply{PORTS};
 Demand at the Plants
param Demand{PLANTS};
 Cost per unit to ship
param Cost{PORTS,PLANTS};
Transportation Model
 The Variables
 How much to ship from each port to each
plant
var Ship{PORTS, PLANTS} >= 0;
 The Objective
 Minimize the total cost of shipping
minimize TotalCost:
sum {port in PORTS, plant in
PLANTS}
Cost[port, plant]*Ship[port,
Transportation Model
 The Constraints
 Do not exceed supply at any port
s.t. RespectSupply {port in PORTS}:
sum{plant in PLANTS} Ship[port,
plant]
<= Supply[port];
 Meet Demand at each plant
s.t. MeetDemand {plant in PLANTS}:
sum{port in PORTS} Ship[port,
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 plants
2 distribution centers
2 customers
Minimize 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 Edges
 We assume all Plant-DC, Plant-Customer,
DC-Customer edges are possible.
 Convenient to define a set of Edges
 set 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 Customer
 param 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 Constraints
 Combine ideas of Shortest paths (flow
conservation) with Transportation (meet
supply and demand)
A Transshipment Model
 For each Plant
s.t. RespectSupply {plant in
PLANTS}:
sum{(plant, t) in EDGES}
Ship[plant,t]
<= Supply[plant];
 For each Customer
s.t. MeetDemand {cust in CUSTS}:
sum{(f, cust) in EDGES} Ship[f,
A Transshipment Model
 For 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];
 Flow into the DC = Flow out of the DC
Good News




Lots of applications
Simple Model
Optimal Solutions Quickly
Integral Data, Integral Answers
Bad News
 What’s Missing?




Single Homogenous Product
Linear Costs
No conversions or losses
...
Homogenous Product
Linear Costs
 No Fixed Charges
 No Volume Discounts
 No Economies of Scale