180 likes | 195 Views
Review Single Commodity Network Flows. John H. Vande Vate Spring, 2001. Specially Structured Linear Programs Each variable appears in at most two constraints At most one constraint with a +1 coefficient At most one constraint with a -1 coefficient Each variable may be constrained by bounds
E N D
ReviewSingle Commodity Network Flows John H. Vande Vate Spring, 2001 1
Specially Structured Linear Programs Each variable appears in at most two constraints At most one constraint with a +1 coefficient At most one constraint with a -1 coefficient Each variable may be constrained by bounds Integer Data => Integer Solutions What Are They? 2
Bipartite Matching Assign Workers to Jobs Assign Available Vehicles to Awaiting Loads …. Objective: Minimize Cost Variables: x(t, l) = 1 if truck t picks up load l Constraints: One truck for each load One load for each truck Examples 3
Set Trucks; Set Loads; Param Cost{Trucks, Loads}; Var Assign{Trucks, Loads} binary; minimize TotalCost: sum{t in Trucks, l in loads} Cost[t, t]*Assign[t, l]; s.t. OneTruck{l in Loads}: sum{t in Trucks} Assign[t,l] = 1; s.t. OneLoad{t in Trucks}: sum{l in Loads} Assign[t, l] = 1; Bipartite Matching 4
Move Goods from Plants to Warehouses Single Commodity! Plants have supplies Warehouses have demands Costs are proportional to volume shipped Transportation Model 5
Set Plants; Set Warehouses; Param Supply {Plants}; Param Demand {Warehouses}; Param Cost{Plants, Warehouses}; Var Flow{Plants, Warehouses}>= 0; minimize TotalCost: sum{p in Plants, w in Warehouses} Cost[p,w]*Flow[p,w]; s.t. WithinSupply{p in Plants}: sum{w in Warehouses} Flow[p, w] <= Supply[p]; s.t. MeetDemand{w in Warehouses}: sum{p in Plants} Flow[p, w] >= Demand[w]; Transportation Model 6
Find a shortest path from an origin to a destination in a network Network without negative cost cycles! Vehicle Routing Just 1 Destination! Shortest Path Model 7
Set Cities; Set Edges in Cities cross Cities; param Cost{Edges}; param origin; param destin; var UseEdge{Edges} >= 0; minimize PathCost: sum{(f,t) in Edges} Cost[f,t]*UseEdge[f,t]; s.t. PathDefinition{c in Cities}: sum{(c, t) in Edges} UseEdge[c,t] - sum{(f, c) in Edges} UseEdge[f, c] = (if c = origin then 1 else if c = destin then -1 else 0); Shortest Path Model 8
Set Cities; Set Edges in Cities cross Cities; param Cost{Edges}; param origin; var UseEdge{Edges} >= 0; minimize PathCost: sum{(f,t) in Edges} Cost[f,t]*UseEdge[f,t]; s.t. PathDefinition{c in Cities}: sum{(c, t) in Edges} UseEdge[c,t] - sum{(f, c) in Edges} UseEdge[f, c] = (if c = origin then card(Cities)-1 else -1); Shortest Paths to All Cities 9
Value of UseEdge[f,t] is the number of paths that use the edge. Is this the Expected Answer? 10
Move Goods from Plants to Customers via Warehouses Single Commodity! Plants have supplies Customers have demands Costs are proportional to volume shipped Minimum Cost Flow 11
Minimum Cost Flow • Set Locs; • Set Edges in Locs cross Locs; • param Cost{Edges}; • param NetSupply{Locs}; • var FlowVol{Edges} >= 0; • minimize TotalCost: sum{(f,t) in Edges} Cost[f,t]*FlowVol[f,t]; • s.t. PathDefinition{loc in Locs}: sum{(loc, t) in Edges} FlowVol[loc,t] - sum{(f, loc) in Edges} FlowVol[f, loc] = NetSupply[loc]; 12
How many vehicles are required to meet a schedule of departures and returns… No shared capacity Application 13
Set Returns; set Departs; set Continues := setof {r in Returns, d in Departs: r <= d} (r, d) var Assign{Continues} binary; maximize CoveredDeparts: sum{(r,d) in Continues} Assign[r,d]; s.t. OneDepart{r in Returns}: sum{(r,d) in Continues} Assign[r,d] <= 1; s.t. OneReturn{d in Departs}: sum{(r,d) in Continues} Assign[r,d] <= 1; Bipartite Matching 14
Given the Objective Value: CoveredDeparts and Variable Values: Assign What’s the answer? How many vehicles do we need? What does each vehicle do? Reading the Answer 15
How many vehicles are required to cover schedule of pickups and deliveries No shared capacity Extended Application 16
Set Origs; set Dests; param DeadTime{Dests, Origs}; set Continues := setof {d in Dests, o in Origs: d+DeadTime[d,o] <= o} (d, o) var Assign{Continues} binary; maximize CoveredOrigins: sum{(d, o) in Continues} Assign[d, o]; s.t. OneOrigin{d in Dests}: sum{(d,o) in Continues} Assign[d, o] <= 1; s.t. OneDestination{o in Origs}: sum{(d, o) in Continues} Assign[d,o] <= 1; Bipartite Matching 17
Given the Objective Value: CoveredOrigins and Variable Values: Assign What’s the answer? How many vehicles do we need? What does each vehicle do? Reading the Answer 18