Solved

# Implementing limit on index in constraint

• 3 replies
• 69 views

+4
• 16 replies

Hi all,

I need to give a certain range to an index in a constraint, but I am not sure how to implement this in AIMMS. It is the following constraint:

In AIMMS already have this constraint but how do I change the constraint to the situation above?

icon

Best answer by gdiepen 9 January 2023, 16:17

View original

### 3 replies

Userlevel 5
+7

You can use the | operator (or such-that operator) for this in AIMMS.

In your case, if you want to generate that constraint for all i that are not equal to the first, you could do something like:

index domain: i | ord(i) >= 2

(ord gives the ordinal position in the set of the element, so this would restrict the generation to only those i that have ordinal position greater or equal then 2.

Within a sum, you can also limit the combinations by using the | operator again:

sum[   (j,t ) | ord(t) >=2,    x(i,j,t) ] <=1

This would only includes those values of t in the sum that have ordinal position >= 2.

Based on the model formulation, you will have to determine what to put after the | operator

+4

@gdiepen  Thank you for your answer! I figured out how to use the operator and which values to use. I have still one problem.

I have the original decision variable x(i,j,t)= 1 if job j of production order i is started on time t.

The capacity constraint needs to hold for every single t. However there is an internal summation over t’ in T(i,j,t). How do I implement that such that AIMMS know that x(i,j,t’) is the same as x(i,j,t)? I can add a constraint that tells that x(i,j,t) = x(i,j,t’) but is  there an easier way?

How can I implement this in the correct way, the constraint below is not doing anything. However, it also gives no warnings. See constraint and original model below.

+4