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.
Sample model from the AMPL book
set D_CITY;
set W_CITY;
set DW_LINKS within (D_CITY cross W_CITY);
param p_supply >= 0; # amount available at plant
param w_demand {W_CITY} >= 0; # amounts required at warehouses
check: p_supply = sum {j in W_CITY} w_demand[j];
param pd_cost {D_CITY} >= 0; # shipment costs/1000 packages
param dw_cost {DW_LINKS} >= 0;
param pd_cap {D_CITY} >= 0; # max packages that can be shipped
param dw_cap {DW_LINKS} >= 0;
var PD_Ship {i in D_CITY} >= 0, <= pd_cap[i];
var DW_Ship {(i,j) in DW_LINKS} >= 0, <= dw_cap[i,j];
# packages to be shipped
minimize Total_Cost:
sum {i in D_CITY} pd_cost[i] * PD_Ship[i] +
sum {(i,j) in DW_LINKS} dw_cost[i,j] * DW_Ship[i,j];
subject to P_Bal: sum {i in D_CITY} PD_Ship[i] = p_supply;
subject to D_Bal {i in D_CITY}:
PD_Ship[i] = sum {(i,j) in DW_LINKS} DW_Ship[i,j];
subject to W_Bal {j in W_CITY}:
sum {(i,j) in DW_LINKS} DW_Ship[i,j] = w_demand[j];