Pyrite | Level 9

## Constraints for PROC OPTMODEL

Rob

I want to add a constraint UseProperRates  where I want only if the rates are greater than 1000 to be considered for model.

I did this but it is not working.

con UseProperRates {p in Ports, t in Transit, c in LSP, d in DC}: InboundLinehaul[p,t,c,d] >=1000;

I added this one. Not sure if this is right.

con UseProperRates {p in Ports, t in Transit, c in LSP, d in DC}:
sum {p in Ports, t in Transit,c in LSP, d in DC} InboundLinehaul [p,t,c,d] >=1000;

1 ACCEPTED SOLUTION

Accepted Solutions
SAS Super FREQ

## Re: Constraints for PROC OPTMODEL

Your first attempt is correct if you want each InboundLinehaul[p,t,c,d] variable to be >= 1000.  If you instead want the sum of all InboundLinehaul[p,t,c,d] variables to be >= 1000, the correct declaration is:

``````con UseProperRates:
sum {p in Ports, t in Transit, c in LSP, d in DC} InboundLinehaul [p,t,c,d] >= 1000;``````
5 REPLIES 5
SAS Super FREQ

## Re: Constraints for PROC OPTMODEL

Your first attempt is correct if you want each InboundLinehaul[p,t,c,d] variable to be >= 1000.  If you instead want the sum of all InboundLinehaul[p,t,c,d] variables to be >= 1000, the correct declaration is:

``````con UseProperRates:
sum {p in Ports, t in Transit, c in LSP, d in DC} InboundLinehaul [p,t,c,d] >= 1000;``````
Pyrite | Level 9

## Re: Constraints for PROC OPTMODEL

Yes i tried the first one. but i guess infeasibility. Here are my three other constraints.

con Min_Qty_at_LSP_is_Respected {c in LSP}:
sum{p in Ports,t in Transit,d in DC} ContainersfromPortstoLSPtoDC [p,t,c,d]>=Min_Qty_LSP*Is_LSP[c];

con ModelOutput_Same_As_ModelInput {p in Ports, d in DC}:
sum {t in Transit,c in LSP} ContainersfromPortstoLSPtoDC[p,t,c, d] = Containers [p,d];

con CheckLSP {c in LSP}: ContainersatLSP[c] <= BigM*Is_LSP[c];

con UseProperRates {p in Ports, t in Transit, c in LSP, d in DC}: InboundLinehaul[p,t,c,d] >=1;

SAS Super FREQ

## Re: Constraints for PROC OPTMODEL

OK, I see from your other thread that InboundLineHaul is a NUM, not a VAR.  The constraints should all contain at least one variable.

I'm not quite sure what rule you are trying to enforce when you say "I want only if the rates are greater than 1000 to be considered for model."  Does this mean that if InboundLinehaul[p,t,c,d] < 1000 you want to treat it as 0 instead?  Or maybe if InboundLinehaul[p,t,c,d] < 1000 you want to force ContainersfromPortstoLSPtoDC[p,t,c, d] = 0?  Or something else?

Pyrite | Level 9

## Re: Constraints for PROC OPTMODEL

Thanks Rob.

I am trying to enforce a rule where I want the model to just use costs when it is more than 1000.

Anything less than 1000, I dont want model to consider it.

Pyrite | Level 9

## Re: Constraints for PROC OPTMODEL

Thanks Rob

Based on ur feedback I did this: I declared a binary variable called IsPortsTransitLSPDC

con UseProperRates {p in Ports, t in Transit, c in LSP, d in DC}: IsPortsTransitLSPDC[p,t,c,d]*InboundLinehaul[p,t,c,d] >=1;

this seems to be working. i will check on the numbers closesly

Discussion stats
• 5 replies
• 429 views
• 1 like
• 2 in conversation