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 have four nodes. Call it p,t,c, and d. Products flow from p (that is the actual origin) and go to d (actual destination). The input data is in terms of quantities from p to d (origin to destination). However, there are carriers (c) and transits (t). The quantity from a given p to given d can flow from any combination of c and d. Each combination of p,t,c,d has its own rates. Model is set to solve the optimal cost. 

SAS modeling works just fine. However, I have problem with my data that i am trying to see if we can have ideas with SAS to resolve.

For example, for p1 to d1, lets say there are 5 carriers and 4transits. so there are 20 combination possible. however, i do not have a real rate for all the 20 combinations. Reason is that not all carries operate via all ports. As a result there are some holes. I tried to fill in those holes by giving those holes a big number (max rate of that p-d pair). That works fine when i do not have many constraints. But when i do have constraints like this c can handle only x quantities (capacity constraints for a carrier), then the model picks a combination that is a fake rate meaning the big number that i artificially tried to fill in. SAS is perfectly fine that it results in infeasibility. But I was just looking for ideas to see if there is anything that you guys encountered similar to this and/or to prevent this.

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

You can use sparse index sets of tuples as follows:

set <str,str> PD;
num Containers {PD} init 0;
read data STDOPT.Data into PD=[PortSource RateMatchDest] Containers=FEU;

set <str,str,str,str> PTCD;
num InboundLinehaul {PTCD}; 
read data STDOPT.RATES into PTCD=[PortSource Transit LSP RateMatchDest] InboundLinehaul=Rate;

Please see SAS Help Center: Sparse Modeling for another example.

View solution in original post

7 REPLIES 7
ballardw
Super User

Did you try including a missing values for the input data instead of a "large value" for c*t combinations that don't actually occur?

 

You might also want to post your code so someone with more familiarity than I have can see the options you are using. That would eliminate suggestions of what you have tried that might appear.

Santha
Pyrite | Level 9
proc optmodel;

set <str> P;
set <str> D; 
set <str> C; 
set <str> T;

read data STDOPT.PN3510_P into P=[PortSource];
read data STDOPT.PN3510_D into D=[RateMatchDest];
read data STDOPT.PN3510_L into L=[LSP];
read data STDOPT.PN3510_T into T=[Transit];

num Containers {P,D} init 0;
read data STDOPT.Data into [PortSource RateMatchDest] Containers=FEU;


num InboundLinehaul {P,T,C,D}; 
read data STDOPT.RATES into [PortSource Transit LSP RateMatchDest] InboundLinehaul=Rate;
RobPratt
SAS Super FREQ

You can use sparse index sets of tuples as follows:

set <str,str> PD;
num Containers {PD} init 0;
read data STDOPT.Data into PD=[PortSource RateMatchDest] Containers=FEU;

set <str,str,str,str> PTCD;
num InboundLinehaul {PTCD}; 
read data STDOPT.RATES into PTCD=[PortSource Transit LSP RateMatchDest] InboundLinehaul=Rate;

Please see SAS Help Center: Sparse Modeling for another example.

Santha
Pyrite | Level 9

Rob

Thank you. that makes sense.

Is there  a way where I can tell SAS when we do the READ DATA step to omit/ignore the values where we have a null or 0 values in the rates? This question I am asking when we declare num InboundLinehaul {Ports,Transit,LSP,DC}; ie. 4 individual sets?

 

 

 

RobPratt
SAS Super FREQ

You can use a WHERE clause in the READ DATA statement:

read data STDOPT.RATES(where=(Rate ne 0)) into [PortSource Transit LSP RateMatchDest] InboundLinehaul=Rate;
Santha
Pyrite | Level 9

oh thank you very much

Santha
Pyrite | Level 9

thank you for your reply. i tried that earlier but did not help. I have posted my code above. 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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
  • 7 replies
  • 1682 views
  • 1 like
  • 3 in conversation