Hi dear community,
I have a constraint as sum((k,z1), y(b,k,z1,l,z2)) <= 1 and I want to add if statement to it:
if k = l, then z1 cannot be equal to z2;
if k<>l, then there’s no further constraint for z1 and z2.
I tryed to add it like this:
if k<>l then sum((k,z1), y(b,k,z1,l,z2)) <= 1
endif;
if k=l then sum((k,z1)|z1<>z2, y(b,k,z1,l,z2)) <= 1
endif;
The AIMMS through out the message “The scope of index "k" has not been specified.” like shown in the screenshot(I’ve highlighted where the error is-the first k appears in if statement).
![](https://uploads-eu-west-1.insided.com/aimms-en/attachment/75ea7e60-bc28-46a4-8785-a4693b7f4edf.png)
So my question is, is there a way to fix this constraint in the way that I want it to be? (maybe using element parameter)?
Thanks in advance!
Best answer by Marcel Hunting
View original