# transshipment.mod # # Written by Mike O'Sullivan & Cameron Walker 2006 # # This file contains the general transshipment model # # Last modified: 22/4/2008 # The set of all nodes in the network #set SUPPLY_NODES; #set DEMAND_NODES; #set TRANSSHIPMENT_NODES; # #set NODES := SUPPLY_NODES union # TRANSSHIPMENT_NODES union # DEMAND_NODES; set NODES; # The net demand at the nodes #param Supply {SUPPLY_NODES} >= 0, integer; #param Demand {DEMAND_NODES} >= 0, integer; # #param NetDemand {n in NODES} integer, default 0 # := if n in SUPPLY_NODES then -Supply[n] # else if n in DEMAND_NODES then Demand[n]; # else 0 by default param NetDemand {NODES} integer, default 0; # The set of all arcs in the network set ARCS within NODES cross NODES; # The cost of shipping 1 unit of goods (per time unit) param Cost {ARCS}; # The bounds on flow along the arcs param Lower {ARCS} >= 0, integer, default 0; param Upper {(i, j) in ARCS} >= Lower[i, j], integer, default Infinity; # The flow of goods sent across an arc var Flow {(i, j) in ARCS} >= Lower[i, j], <= Upper[i, j], integer; # Minimise the total shipping cost minimize TotalCost: sum {(i, j) in ARCS} Cost[i, j] * Flow[i, j]; # Must conserve flow in the network subject to ConserveFlow {j in NODES}: sum {(i, j) in ARCS} Flow[i, j] - sum {(j, k) in ARCS} Flow[j, k] >= NetDemand[j]; # Net demand must be <= 0 for the problem to be feasible (enough supply to satisfy demand) check : sum {n in NODES} NetDemand[n] >= 0;