/* ======================================================================== An AMPL Model of the Steco Warehouse case ======================================================================== */ set WAREHOUSES; param Capacity{WAREHOUSES}; param Lease{WAREHOUSES}; table WarehouseTable IN "ODBC" "D:\personal\15057\StecoData.mdb" "Warehouses": WAREHOUSES <- [Warehouse], Capacity, Lease; read table WarehouseTable; set DISTRICTS; param Demand{DISTRICTS}; table DistrictTable IN "ODBC" "D:\personal\15057\StecoData.mdb" "Districts": DISTRICTS <- [District], Demand; read table DistrictTable; param TruckCost{WAREHOUSES, DISTRICTS}; table TruckTable IN "ODBC" "D:\personal\15057\StecoData.mdb" "TruckCost": [Warehouse, District], TruckCost; read table TruckTable; var Open{WAREHOUSES} binary; var Ship{WAREHOUSES, DISTRICTS} >= 0; minimize TotalCost: sum{warehouse in WAREHOUSES} Lease[warehouse]*Open[warehouse] + sum{w in WAREHOUSES, d in DISTRICTS} TruckCost[w,d]*Ship[w,d]; s.t. MeetDemand{d in DISTRICTS}: sum{w in WAREHOUSES} Ship[w,d] >= Demand[d]; s.t. ObserveEffectiveCapacity{w in WAREHOUSES}: sum{d in DISTRICTS} Ship[w,d] <= Capacity[w]*Open[w]; s.t. StrongerEffectiveCapacity{w in WAREHOUSES, d in DISTRICTS}: Ship[w,d] <= min(Capacity[w], Demand[d])*Open[w]; option solver cplex; option single_step 1; solve; display Ship;