AMPL offers superior support by our development and technical support teams.
Contact us for general queries, partnerships, and more.
We can help you find the license and offering that works best for your situation.
AMPL offers superior support by our development and technical support teams.
Contact us for general queries, partnerships, and more.
We can help you find the license and offering that works best for your situation.
# ----------------------------------------
# LOCATION-TRANSPORTATION PROBLEM
# ----------------------------------------
set ORIG; # shipment origins (warehouses)
set DEST; # shipment destinations (stores)
param supply {ORIG} > 0;
param demand {DEST} > 0;
var Build {ORIG} binary; # 1 iff it is built
param fix_cost {ORIG} > 0;
var Ship {ORIG,DEST} >= 0; # amounts shipped
param var_cost {ORIG,DEST} > 0;
minimize Total_Cost:
sum {i in ORIG} fix_cost[i] * Build[i] +
sum {i in ORIG, j in DEST} var_cost[i,j] * Ship[i,j];
subj to Supply {i in ORIG}:
sum {j in DEST} Ship[i,j] <= supply[i] * Build[i];
subj to Demand {j in DEST}:
sum {i in ORIG} Ship[i,j] = demand[j];