Hi Rob Thank you. Here is my full code. I am not able to send the data as it contains price information. However, the data read is good and the data is clean. I have verified that part. proc optmodel; /* Declare Ports, ICs and DCs */ set<str> Ports;/* this is a set of Ports*/ set<str> DC; /* this is a set of ICs*/ set<str> IC; /* this is a set of DCs*/ /* declare Constants*/ num Min_Qty_at_IC=2500; num Inbound_Fuel_Per_Container=10; num Drayage_Fuel=2.8;/* This is a Percentage Based Charge*/ **num NumberofICsopen = x; /* Delcare Variables for the Scenario involving many ICs and chosen IC to have >2,500 FEU */ var Build {IC} binary; /*If C is selected, then it is 1, else 0 */ /*Declaring an Array of Costs - THIS IS INPUT data */ num InboundLinehaul {Ports,IC}; /* This is an array of InboundLinehaul Costs indexed over Ports and IC*/ num OutboundLinehaul {IC,DC}; /*This is an array of OutboundLinehaul Costs indexed over IC and DC*/ num Outbound_Fuel{IC,DC}; /* This is an array of Outbound Fuel Cost Per Mil;e indexed over IC and DC*/ num TransloadCost {IC};/*This is an array of Transload Costs at IC*/ num DrayageCost {IC};/*This is an array of Drayage Costs at IC*/ num PierPassCost {IC};/*This is an array of PierPass Costs at IC*/ num MilesBetweenIC_DC {IC,DC}; /*This is an array of Miles between IC and DC indexed over IC and DC */ /* Declaring an Array of Decision Variables*/ var ContainersfromPortstoICtoDC {Ports,IC,DC}>=0; /*Declaring Implicit Variables*/ impvar ContainersatIC{c in IC}=sum{p in Ports, d in DC} ContainersfromPortstoICtoDC [p,c,d]; impvar Inbound_Linehaul_Costs= sum {p in Ports, c in IC, d in DC} InboundLinehaul [p,c] *ContainersfromPortstoICtoDC [p,c,d]; impvar Inbound_Fuel_Costs=Inbound_Fuel_Per_Container*sum {p in Ports, c in IC, d in DC} ContainersfromPortstoICtoDC [p,c,d]; impvar Outbound_Linehaul_Costs = sum {p in Ports, c in IC, d in DC} OutboundLinehaul [c,d] * ContainersfromPortstoICtoDC [p,c,d]; impvar Outbound_Fuel_Costs = sum{c in IC, d in DC} Outbound_Fuel[c,d]*MilesBetweenIC_DC[c,d]; impvar Transloading_Costs = sum{p in Ports, c in IC, d in DC} ContainersfromPortstoICtoDC[p,c,d]*TransloadCost[c]; impvar Drayage_Costs =sum{p in Ports, c in IC, d in DC} ContainersfromPortstoICtoDC [p,c,d]*DrayageCost[c]; impvar Drayage_Fuel_Costs=Drayage_Fuel*sum{p in Ports, c in IC, d in DC} ContainersfromPortstoICtoDC [p,c,d]*DrayageCost[c]; impvar PierPass_Costs=sum{p in Ports, c in IC, d in DC} ContainersfromPortstoICtoDC[p,c,d]*PierPassCost[c]; /* declare Objective Function*/ Min TotalCost = Inbound_Linehaul_Costs+Inbound_Fuel_Costs+Outbound_Linehaul_Costs+Outbound_Fuel_Costs+Transloading_Costs+Drayage_Costs+Drayage_Fuel_Costs+PierPass_Costs; /* declare Constraints*/ con All_ICs_are_Used{c in IC} : sum{p in Ports, d in DC} ContainersfromPortstoICtoDC [p,c,d]>=Min_Qty_at_IC*Build[c]; con Flows_from_Ports_to_DC_Modelequals_FlowFromPortstoDC_inInputData {p in Ports, d in DC}: sum {c in IC} ContainersfromPortstoICtoDC[p, c, d] = Containers [p,d]; /*the flow from p to d that goes through ALL ICs*/ con CheckIC {c in IC}: ContainersatIC[c] <= 15000*Build[c];/*15000 is the Big M- Have it as the sum demandfrom the data*/ **con HaveAtleastTheseManyICsopen: Sum{c in IC} Build [c] =NumberofICsopen; **expand; solve with lp; /*Outputs*/ print ContainersfromPortstoICtoDC; print ContainersatIC; print TotalCost; print Inbound_Linehaul_Costs; print Inbound_Fuel_Costs; print Outbound_Linehaul_Costs; print Outbound_Fuel_Costs; print Transloading_Costs; print Drayage_Costs; print Drayage_Fuel_Costs; print PierPass_Costs;
... View more