This constraint forces that a DC is served by exactly "x" number of LSPs.
/*Constraint for retricting DC-LSP: given DC can by served by "x" number of LSPs*/
num DC_LSPs=5;
con DC_LSP: sum{c in LSP} IsLSPDC[c,'LAX'] = DC_LSPs;
con DC_LSP_Link1{p in Ports, t in Transit,c in lsp, d in {'LAX'}}:
ContainersfromPortstoLSPtoDC[p,t,c,'AL1'] <= BigM * IsLSPDC[C,'LAX'];
con DC_LSPLink2{c in LSP, d in DC}:
sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,d] >= IsLSPDC[c,d];
This works fine. Now I want to have another constraint where I want to follow the same logic but want to limit my choice of DC to anything that is not in ('LAX','SAV'). So am looking to write sthg like
con DC_LSP_NoSAVLAX: sum{c in LSP} IsLSPDC[c,not in ('SAV,'LAX')] = DC_LSPs;
Can i do that? If yes what would be the correct syntax.
If you really want just one constraint, here are two ways:
con DC_LSP_NoSAVLAX:
sum{c in LSP, d in DC: d not in {'SAV,'LAX'}} IsLSPDC[c,d] = DC_LSPs;
con DC_LSP_NoSAVLAX:
sum{c in LSP, d in DC diff {'SAV,'LAX'}} IsLSPDC[c,d] = DC_LSPs;
If instead you want a family of constraints indexed by d, here are two ways:
con DC_LSP_NoSAVLAX {d in DC: d not in {'SAV,'LAX'}}:
sum{c in LSP} IsLSPDC[c,d] = DC_LSPs;
con DC_LSP_NoSAVLAX {d in DC diff {'SAV,'LAX'}}:
sum{c in LSP} IsLSPDC[c,d] = DC_LSPs;
If you really want just one constraint, here are two ways:
con DC_LSP_NoSAVLAX:
sum{c in LSP, d in DC: d not in {'SAV,'LAX'}} IsLSPDC[c,d] = DC_LSPs;
con DC_LSP_NoSAVLAX:
sum{c in LSP, d in DC diff {'SAV,'LAX'}} IsLSPDC[c,d] = DC_LSPs;
If instead you want a family of constraints indexed by d, here are two ways:
con DC_LSP_NoSAVLAX {d in DC: d not in {'SAV,'LAX'}}:
sum{c in LSP} IsLSPDC[c,d] = DC_LSPs;
con DC_LSP_NoSAVLAX {d in DC diff {'SAV,'LAX'}}:
sum{c in LSP} IsLSPDC[c,d] = DC_LSPs;
the constraint worked.
I have the second constraint that I changed to this. But i get syntax errors.
con DC_LSP_Direct_Link1{p in Ports, t in Transit,c in lsp, d not in {'SAV','LAX'}}:
ContainersfromPortstoLSPtoDC[p,t,c,d not in {'SAV','LAX'}] <= BigM * IsLSPDC[c,d not in {'SAV','LAX'}];
I think i know why . let me try the fix
I tried this. still got error:
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 in DC: d not in {'SAV','LAX'}] <= BigM * IsLSPDC[c,d in DC: d not in {'SAV','LAX'}];
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.