I have a constraint in AIMMS which is as follows:

lambda1(q)*0+lambda2(q)*mu1+lambda3(q)*mu2+lambda4(q)=

1/T(q)*sum[k,sum[l,i(k,l,q)*min(travelTimes(k,l),tau)]]|k in LocationOnRouteQ(q) and l in LocationOnRouteQAfterK(k,q)

The problem is in this part:

k in LocationOnRouteQ(q) and l in LocationOnRouteQAfterK(k,q)

Because I get an error that the scope of index k has not been specified. However, when I put the indices k and l in the index domain I get the error that the scope already has been specified. I want to let the k come out of the set LocationOnRouteQ(q) and l out of subset LocationOnRouteQAfterK(k,q) and I have tried many things, but none worked out.

LocationOnRouteQ(q) and LocationOnRouteQAfterK(k,q) are both subsets of the set Locations and I got k and l as indices in the set Location.

I hope someone can help me.

Kind regards,

AimÃ©e

**Best answer by Paulus**