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

Hi I am having syntax error in the constraint declaration 

The constraint that I want is to make sure that the model forces a specific combination. ie. IST-SAV-MAEU-SAV to be 1.  Not sure how to sum the containers.

 

var IsPortsTransitLSPDC {Ports,Transit,LSP,DC} binary;

num IST_SAV;
fix IsPortsTransitLSPDC ['IST','SAV','MAEU','SAV']=1;
READ DATA STDOPT.PN3381_Data(where=(PortSource = "QIN" and RateMatchDest='SAV')) INTO IST_SAV=FEU;

/*Force IST to SAV via MAEU and SAV*/
CON IST_SAV_MAEU_SAV {p in {'IST'}, {t in {'SAV'}, c in {'MAEU'}, d in {'SAV'}}:
ContainersfromPortstoLSPtoDC ['QIN','SAV','MAEU','SAV'] =IST_SAV*IsPortsTransitLSPDC['IST','SAV','MAEU','SAV'];

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

I'm glad you got it working.  Because you don't use p, d, or c anywhere, here's a simpler way to declare the same constraint:

CON CONST_IST_SAV:
sum {t in Transit} ContainersfromPortstoLSPtoDC['IST',t,'MAEU','SAV'] =IST_SAV*IsPortsTransitLSPDC['IST','SAV','MAEU','SAV'];

View solution in original post

6 REPLIES 6
Santha
Pyrite | Level 9

oops. here is the constraint  i have

/*Force IST to SAV via MAEU and SAV*/
CON IST_SAV_MAEU_SAV {p in {'IST'}, {t in {'SAV'}, c in {'MAEU'}, d in {'SAV'}}:
ContainersfromPortstoLSPtoDC ['IST','SAV','MAEU','SAV'] =IST_SAV*IsPortsTransitLSPDC['IST','SAV','MAEU','SAV'];
RobPratt
SAS Super FREQ

Sorry, I don't quite understand your question.  The FIX statement will fix a variable to a given value, and your syntax for that looks correct.  Where does the sum come in?

Santha
Pyrite | Level 9

Rob

yeah i want that specific variable to be set 1 when the combo is IST-SAV-MAEU-SAV. 

In order to do that i declare a binary variable IsPortsTransitLSPDC and set it as 1. And also trying to set up a constraint so that this variable is used correctly and that the flow through this combo is exactly we see in my other variable IST_SAV that  I have. 

Santha
Pyrite | Level 9

Tried this one as well: Feels am close but not yet

CON CONST_IST_SAV {p in {'IST'}, d in {'SAV'}}: 
sum {t in Transit,c in LSP} ContainersfromPortstoLSPtoDC['IST',t,c,'SAV'] =IST_SAV*IsPortsTransitLSPDC['IST','SAV','MAEU','SAV'];
Santha
Pyrite | Level 9
CON CONST_IST_SAV {p in {'IST'}, d in {'SAV'},c in {'LSP'}}: 
sum {t in Transit} ContainersfromPortstoLSPtoDC['IST',t,'MAEU','SAV'] =IST_SAV*IsPortsTransitLSPDC['IST','SAV','MAEU','SAV'];

based on your feedback, i tweaked  and this one worked. 

 

RobPratt
SAS Super FREQ

I'm glad you got it working.  Because you don't use p, d, or c anywhere, here's a simpler way to declare the same constraint:

CON CONST_IST_SAV:
sum {t in Transit} ContainersfromPortstoLSPtoDC['IST',t,'MAEU','SAV'] =IST_SAV*IsPortsTransitLSPDC['IST','SAV','MAEU','SAV'];

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Discussion stats
  • 6 replies
  • 1493 views
  • 0 likes
  • 2 in conversation