Hi there,
I am trying to implement some form of heuristic for the TSP where I'm decreasing the size of the model by restricting the declaration of variables X(i,j) to those combination (i,j) for which j belong to the, say, 10 cities nearest to i. Here X(i,j) is an binary variable indicating whether or not edge (i,j) is in the tour.
I created a subset of the cities to find the nearest neighbors of city i, but how can I implement it in the model? Do I need to add an extra constraint or?
Added you'll find the code of my AIMMS project.
Thanks in advance!
Solved
Nearest neighbors for TSP
Best answer by mohansx
You will make the index domain of X(i, j) as
X(i, j) | j in NearestNeighbors(i)
That will create only those combinations of (i, j) where j is a nearest neighbor of the node i.
This topic has been closed for replies.
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.