Rob
I am getting infeasibility. I am trying to figure it out but no luck yet.
var Is_LSP {LSP} binary;
var IsLSPDC {LSP,DC} binary;
/* declare Constants*/
NUM BigM;
num LAX_Min;
num LAX_Max;
num SAV_Min; num SAV_Max;
READ DATA STDOPT.PN3158_ALT6_SPECIFICS(where=(RateMatchDest = "LAX")) INTO LAX_Min=FEU;
READ DATA STDOPT.PN3158_ALT6_SPECIFICS(where=(RateMatchDest = "LAX")) INTO LAX_Max=FEU;
READ DATA STDOPT.PN3158_ALT6_SPECIFICS(where=(RateMatchDest = "SAV")) INTO SAV_Min=FEU;
READ DATA STDOPT.PN3158_ALT6_SPECIFICS(where=(RateMatchDest = "SAV")) INTO SAV_Max=FEU;
LAX_Min=0.1*LAX_Min;LAX_Max=0.3*LAX_Max;
SAV_Min=0.1*SAV_Min;SAV_Max=0.3*SAV_Max;
Here are my general constraints:
/* GENERAL CONSTRAINTS */
con Min_Qty_at_LSP_is_Respected {c in LSP}:
sum{p in Ports,t in Transit,d in DC} ContainersfromPortstoLSPtoDC [p,t,c,d]>=Min_Qty_LSP*Is_LSP[c];
con ModelOutput_Same_As_ModelInput {p in Ports, d in DC}:
sum {t in Transit,c in LSP} ContainersfromPortstoLSPtoDC[p,t,c, d] = Containers [p,d];
con CheckLSP {c in LSP}: ContainersatLSP[c] <= BigM*Is_LSP[c];
Here are my specifc constraints:
/*Constraint for retricting DC-LSP: given DC can by served by "x" number of LSPs*/
/*LAX - I am trying to Restrict LAX to exactly 5 carriers. This works fine */
num LAX_LSPs=5;
con LAX_LSP: sum{c in LSP} IsLSPDC[c,'LAX'] = LAX_LSPs;
con LAX_LSP_Link1{p in Ports, t in Transit,c in lsp, d in {'LAX'}}:
ContainersfromPortstoLSPtoDC[p,t,c,'LAX'] <= BigM * IsLSPDC[C,'LAX'];
con LAX_LSPLink2{c in LSP, d in DC}:
sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,d] >= IsLSPDC[c,d];
/*SAV- same like LAX but the number is 4. This works fine as well. */
num SAV_LSPs=4;
con SAV_LSP: sum{c in LSP} IsLSPDC[c,'SAV'] = SAV_LSPs;
con SAV_LSP_Link1{p in Ports, t in Transit,c in lsp, d in {'SAV'}}:
ContainersfromPortstoLSPtoDC[p,t,c,'SAV'] <= BigM * IsLSPDC[C,'SAV'];
con SAV_LSPLink2{c in LSP, d in DC}:
sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,d] >= IsLSPDC[c,d];
/* After having forced a x number of LSPs for a given carrier, we want to make sure
the lowest and the highest a carrier can get is a set number */
/*LAX*/
con LAX_MIN_LSP {c in LSP, d in {'LAX'}}:
sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,'LAX'] >=LAX_Min*IsLSPDC[c,'LAX'];
con LAX_MAX_LSP {c in LSP, d in {'LAX'}}:
sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,'LAX'] <=LAX_Max*IsLSPDC[c,'LAX'];
/*SAV*/
con SAV_MIN_LSP {c in LSP, d in {'SAV'}}:
sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,'SAV'] >=SAV_Min*IsLSPDC[c,'SAV'];
con SAV_MAX_LSP {c in LSP, d in {'SAV'}}:
sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,'SAV'] <=SAV_Max*IsLSPDC[c,'SAV'];
Till Now, it worked correctly. When i added these constraint below, I get infeasibility.
/*For any Destination that is not LAX and SAV, #of Carriers per DC is 1 - I tried numbers from 1-7 but all came infeasible. So something is not right with the way I have written my constraint that it causes infeasibility. The 14,000 number that you see is Total FEU minus LAX and SAV combined.*/
num DC_LSP_Directs=1;
con DC_LSP_Direct:
sum{c in LSP, d in DC: d not in {'SAV','LAX'}} IsLSPDC[c,d] = DC_LSP_Directs;
con DC_LSP_Direct_Link1{p in Ports, t in Transit, c in lsp, d in DC: d not in {'SAV','LAX'}}:
ContainersfromPortstoLSPtoDC[p,t,c,d] <= 14000 * IsLSPDC[c,d];
con DC_LSPL_Directink2{c in LSP, d in DC: d not in {'SAV','LAX'}}:
sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,d] >= IsLSPDC[c,d];
You can use the IIS= option to help diagnose infeasibility. For the MILP solver, this option is new in SAS Optimization 8.5 on SAS Viya 3.5. For earlier releases, you can try the LP IIS functionality instead, as shown in this documentation example.
You can use the IIS= option to help diagnose infeasibility. For the MILP solver, this option is new in SAS Optimization 8.5 on SAS Viya 3.5. For earlier releases, you can try the LP IIS functionality instead, as shown in this documentation example.
Rob
I tried the IIS. But the problem I have is that my expand does not work at all. It does not expand anything.
I am guessing that this particular constraint "DC_LSP_Direct" is not correct syntax wise.
num DC_LSP_Directs=1;
con DC_LSP_Direct:
sum{c in LSP} IsLSPDC [c,d in DC: d not in {'SAV','LAX'}] = DC_LSP_Directs;
con DC_LSP_Direct_Link1{p in Ports, t in Transit, c in lsp, d in DC: d not in {'SAV','LAX'}}:
ContainersfromPortstoLSPtoDC[p,t,c,d] <= 14000 * IsLSPDC[c,d];
con DC_LSP_Directink2{c in LSP, d in DC}:
sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,d] >= IsLSPDC[c,d];
I changed to
con DC_LSP_Direct{d in DC: d not in {'SAV','LAX'}}:
sum{c in LSP} IsLSPDC [c,d] = DC_LSP_Directs;
and it seems to be working
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.