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
Page 1 / 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)
]
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)
]
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.
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.
This helped me ! Thank you so much both
Sign up
Already have an account? Login
Please use your business or academic e-mail address to register
Login to the community
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.