Tags:
view all tags
---+ The Transportation Problem in AMPL ---++ AMPL Formulation The formulation of the transportation problem is AMPL is a straighforward translation of the matehmatical programme for [[TransportationProblem][the transportation problem]]. The sets %${\cal S}$% and %${\cal D}$% are declared as =SUPPLY_NODES= and =DEMAND_NODES= respectively: <pre> set SUPPLY_NODES; set DEMAND_NODES; </pre> The supply %$s_i, i \in {\cal S}$% and demand %$d_j, j \in {\cal D}$% are declared as *integer* parameters: <pre> param Supply {SUPPLY_NODES} >= 0, integer; param Demand {DEMAND_NODES} >= 0, integer; </pre> The cost %$c_{ij}$% is declared over the =SUPPLY_NODES= and =DEMAND_NODES=: <pre> param Cost {SUPPLY_NODES, DEMAND_NODES}; </pre> Now, the mathematical programme follows directly: <pre> var Flow {SUPPLY_NODES, DEMAND_NODES} >= 0, integer; minimize TotalCost: sum {i in SUPPLY_NODES, j in DEMAND_NODES} Cost[i, j] * Flow[i, j]; subject to UseSupply {i in SUPPLY_NODES}: sum {j in DEMAND_NODES} Flow[i, j] = Supply[i]; subject to MeetDemand {j in DEMAND_NODES}: sum {i in SUPPLY_NODES} Flow[i, j] = Demand[j]; </pre> Note that we assume the transportation is balanced. ---++ Adding Bounds In the main discussion of [[TransportationProblem][transportation problems]], we saw that adding bounds to the flow variables allowed us to easily either bound the transportation of good from a supply node to a demand node or remove an arc from the problem altogether. We can add bounds to our AMPL formulation by [[ParametersInAMPL][declaring 2 new parameters with defaults]]: <pre> param Lower {SUPPLY_NODES, DEMAND_NODES} integer default 0; param Upper {SUPPLY_NODES, DEMAND_NODES} integer default Infinity; </pre> and adding them to the =Flow= variable declaration: <pre> var Flow {i in SUPPLY_NODES, j in DEMAND_NODES} >= Lower[i, j], <= Upper[i, j], integer; </pre> ---++ Balancing Transportation Problems -- Main.MichaelOSullivan - 02 Apr 2008
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r9
|
r5
<
r4
<
r3
<
r2
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r3 - 2008-04-02
-
MichaelOSullivan
Home
Site map
Forum web
Main web
NDSG web
ORUA web
OpsRes web
Sandbox web
TWiki web
OpsRes Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Edit
Attach
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback