Hello,
I am trying to solve the traveling salesman problem and I ran into the problem how to set the subtour eliminating constraints in case the set CITY contains string memebrs like Velvary. It is the depot and I need to specify the constraints for j>1 (please see the example):
subject to cycle{i in CITY, j in CITY: j >1}: u[i]+1-(N-1)*(1-x[i,j])<=u[j];
It works if there are numbers in the set CITY. Of course, I can write the following:
subject to cycle{i in CITY, j in CITY: j != ‘CITY-NAME’}: u[i]+1-(N-1)*(1-x[i,j])<= u[j];
But it is not general expression (if the set CITY is changed, I have to change the model as well). I need sth like
j in CITY: index(CITY,j)>1
Please can you help me? I know that there is FIRST function, but it does not work with unordered sets…
If you need more explanations, please let me know.
Thank you,
Ondřej Šafka