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'];
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'];
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'];
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?
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.
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'];
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.
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'];
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.