BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Santha
Pyrite | Level 9

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.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

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;

View solution in original post

4 REPLIES 4
RobPratt
SAS Super FREQ

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;
Santha
Pyrite | Level 9

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'}];

Santha
Pyrite | Level 9

I think i know why  . let me try the fix

Santha
Pyrite | Level 9

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'}];

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Multiple Linear Regression in SAS

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.

Discussion stats
  • 4 replies
  • 867 views
  • 1 like
  • 2 in conversation