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.
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.
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.
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;
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.
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?
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;
oh thank you very much
thank you for your reply. i tried that earlier but did not help. I have posted my code above.
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.