Solved

Definition in Constraints: how to connect the indices to a subset?

  • 6 June 2019
  • 3 replies
  • 834 views

Dear all,

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
icon

Best answer by Paulus 6 June 2019, 12:48

View original

This topic has been closed for comments

3 replies

Userlevel 1
Not sure but what if you add more indices (m, n, o) to the set location?

And then ...

+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)]]

|
m in LocationOnRouteQ(q)
and n in LocationOnRouteQAfterK(o,q)


Not sure of this is exactly the right solution, but I think introducing more indices is the key to your solution.
Userlevel 3
Badge +1
Hi Aimee,

You should probably move the condition into the sum. Meaning that the index k only 'lives' inside the scope to the sum.

Is this a good formulation for you?
1/T(q)
*
sum[k |k in LocationOnRouteQ(q),
sum[l | l in LocationOnRouteQAfterK(k,q),
i(k,l,q)*min(travelTimes(k,l),tau)
]
]

or equivalently,
1/T(q)
*
sum[ (k,l) |k in LocationOnRouteQ(q) and l in LocationOnRouteQAfterK(k,q),
i(k,l,q)*min(travelTimes(k,l),tau)
]
This helped me ! Thank you so much both

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

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