0

I am trying to solve variant of a multi-path traveling salesman with an incomplete graph.

EDIT: changed the description (twice) based on feedback from @daniel_junglas.

In more words:

  • Only 1 salesperson
  • The salesperson can only visit every city exactly once
  • The salesperson can drive in various modes of transport (e.g. train, car, boat). Every mode of transport changes the time it takes to travel between cities
  • The salesperson can change the mode of transport in between cities (at a cost), but not in a city. The change can be seen as yet another edge between the two cities with a particular weight associated
  • not every city can be visited by every mode of transport (e.g. only a boat can reach city D)
  • the graph is not complete, so not all cities are connected, but one or more Hamiltonian path exists

enter image description here

Based on the example:

  • 4 cities (1-4), each node having a car parking lot (C), train station (T), harbor for boats (B).
  • Starting and ending in 1C
  • Every city has to be visited one
  • No link from a train station to a harbour to the parking lot, only able to change outside of the cities (for instance 1C to 2T).
  • every link has a weight associated to it, based on distance, speed of transport mode and time penalty for changing transport mode
  • Example paths:
    • 1C -> 2T -> 3T -> 4T -> 1C
    • 1C -> 2C -> 3T -> 4T -> 1C

I was planning to solve this with concorde/cplex.

I have tried solving it with pyconcorde. For this, I encoded every parallel edge to the same node as a new node (A, A', A''), but I can't find a restriction to say only one A-node should be visited. I see many a-symetric TSP and multi-TSP solutions, but none fitting my requirements.

My questions: How should I approach this problem (tutorial link, embedding proposal, etc) to find the shortest route that visits all cities exactly once? Which tool would help me?

P.S. I am aware of various single-algorithm solutions, both probabilistic and exact. However, I am searching for a tool that combines various techniques, such as cplex, in the hope of better results for my specific data.
P.S.2. I am aware this question might be broad. I am open to any remarks in order to improve my questions

Thomas Hubregtsen
  • 449
  • 1
  • 5
  • 22
  • You say `but my solution included every node`. Why is that a problem? Isn't that the very definition of TSP? Or does is your problem that some nodes in the graph *must* be visited but other nodes are optional to visit? That would remind of Steiner tree problems, maybe there is "Steiner version" of TSP and you can find software for it? – Daniel Junglas Oct 11 '19 at 09:20
  • BTW, if you have multiple paths between two cities, wouldn't it be easier to first compute the shortest path between any two cities, then remove all but those shortest paths. That gives you a graph on which you can solve the standard TSP. – Daniel Junglas Oct 11 '19 at 09:22
  • @DanielJunglas Updated the description based on your feedback. * Sorry, in my implementation I had virtual node A', A'', etc, as I did not know how to put in parallel edges * You are right, I forgot to add the mode of transport restrictions. In this case, you can optimize locally first, but would incur heavy costs in continuous changes of transport mode – Thomas Hubregtsen Oct 14 '19 at 09:00

3 Answers3

0

Gurobi has a good example of this with an interactive map and example code, see here. They are solving the same problem essentially that you describe, you just need to provide your own input locations and connections.

Maddo
  • 175
  • 1
  • 6
0

I am not sure you can create a graph that represents your model and on which you can solve a vanilla TSP: If you have multiple edges between nodes then we already agreed that you can remove any but the cheapest one. If you instead duplicate nodes then you have the problem that you no longer want to visit all nodes but only exactly one node from a set of duplicates. This is not addressed by TSP solvers.

However, you said you want to solve concorde/cplex. How about dropping the concorde part? You could take a MIP formulation for TSP. That should be easy to extend to include your additional constraints. For example, you could go back to multiple edges and add conditions like "if you enter city A by car then you have to leave by car or pay an extra N". You can then feed this to a general MIP solver like CPLEX.

Daniel Junglas
  • 5,830
  • 1
  • 5
  • 22
0

At a high level, Concorde is a very efficient implementation of column generation (branch and price and cut) for the TSP.

You can surely develop a very efficient implementation of column generation for your problem, where the routes would satisfy your constraints.

Marco Luebbecke has a very nice general-purpose tutorial. The TSP book is the reference work on the subject.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574