Pyrite | Level 9

## Data Rate holes

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
SAS Super FREQ

## Re: Data Rate holes

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.

7 REPLIES 7
Super User

## Re: Data Rate holes

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.

Pyrite | Level 9

## Re: Data Rate holes

``````proc optmodel;

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

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;``````
SAS Super FREQ

## Re: Data Rate holes

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.

Pyrite | Level 9

## Re: Data Rate holes

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?

SAS Super FREQ

## Re: Data Rate holes

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

## Re: Data Rate holes

oh thank you very much

Pyrite | Level 9

## Re: Data Rate holes

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

Discussion stats
• 7 replies
• 420 views
• 1 like
• 3 in conversation