Operations Research topics: SAS/OR,
SAS Optimization, and SAS Simulation Studio

Constraint for specific set of Varibles

Accepted Solution Solved
Reply
Super Contributor
Posts: 334
Accepted Solution

Constraint for specific set of Varibles

Hello,

how do you define a constraint for a specific set of variales (using "in" not GE or LE, etc.)? For example, instead of:

Con Cns_Ex{c in Components:c="R2"}Smiley Frustratedum{p in Products} X

*Qty[p,c]<=8;

I would like something similar to:

Con Cns_Ex{c in Components:c in ("R2", "R5")}Smiley Frustratedum{p in Products} X

*Qty[p,c]<=8

Thanks&best regards


Accepted Solutions
Solution
‎07-28-2015 10:12 AM
SAS Employee
Posts: 416

Re: Constraint for specific set of Varibles

Here are two ways (note the curly braces instead of parentheses):

Con Cns_Ex{c in Components:c in {"R2", "R5"}}Smiley Frustratedum{p in Products} X

*Qty[p,c]<=8;

Con Cns_Ex{c in Components inter {"R2", "R5"}}Smiley Frustratedum{p in Products} X

*Qty[p,c]<=8;

If you know that "R2" and "R5" are both in Components, you can make it even simpler:

Con Cns_Ex{c in {"R2", "R5"}}Smiley Frustratedum{p in Products} X

*Qty[p,c]<=8;

View solution in original post


All Replies
Solution
‎07-28-2015 10:12 AM
SAS Employee
Posts: 416

Re: Constraint for specific set of Varibles

Here are two ways (note the curly braces instead of parentheses):

Con Cns_Ex{c in Components:c in {"R2", "R5"}}Smiley Frustratedum{p in Products} X

*Qty[p,c]<=8;

Con Cns_Ex{c in Components inter {"R2", "R5"}}Smiley Frustratedum{p in Products} X

*Qty[p,c]<=8;

If you know that "R2" and "R5" are both in Components, you can make it even simpler:

Con Cns_Ex{c in {"R2", "R5"}}Smiley Frustratedum{p in Products} X

*Qty[p,c]<=8;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 183 views
  • 0 likes
  • 2 in conversation