How to limit the range of an index domain

  • 14 December 2021
  • 2 replies


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 14 December 2021, 10:47

View original

2 replies

Userlevel 5
Badge +7

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)


Userlevel 5
Badge +7

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