Skip to main content
Solved

How to limit the range of an index domain

  • December 14, 2021
  • 2 replies
  • 73 views

Forum|alt.badge.img

I need to fill the 6*6 matrix as shown in the above.

Here (i,j) is from 0 to 6

So I used below code to achieve the matrix as shown above

 

Here my question is I am trying to achieve this constraint x(i,j)=1 if either i or j =0 or 6

Is there a better way to use Index domain to achieve that

Best answer by gdiepen

Forgot to mention, if you replace 7 with card(SetName)  where SetName is the name of the set they belong to, you will make it right away generic for any input.

2 replies

gdiepen
AIMMS Champ
Forum|alt.badge.img+7
  • AIMMS Champ
  • 155 replies
  • December 14, 2021

You are using everywhere a range check, while you can also do just a comparison, which makes it a bit less complex

 

So you can achieve the same with:

(i,j) | (ord(i) = 1) or (ord(i) = 7) or (ord(j) = 1) or (ord(i) = 7)

 


gdiepen
AIMMS Champ
Forum|alt.badge.img+7
  • AIMMS Champ
  • 155 replies
  • Answer
  • December 14, 2021

Forgot to mention, if you replace 7 with card(SetName)  where SetName is the name of the set they belong to, you will make it right away generic for any input.



Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator