Skip to content Skip to sidebar Skip to footer

Tsp Implementation In Docplex Python

Is there any python implementation available of TSP using the IBM cplex tool, with Dantzig-Fulkerson-Johnson formulation. If there is any can I get the link for it?

Solution 1:

The exact same question was asked here. Here is my (slightly modified) answer from there:

The distribution does not have an example implementation in Python, but there is one in OPL: opl/examples/opl/models/TravelingSalesmanProblem/tsp.mod in your installation. This could serve as a good starting point when implementing things in Python.

In the example the problem is solved in a loop: after each solve, subtour elimination constraints are separated. In Python you would probably want to do this using a lazy constraint callback.

In general, subtour elimination constraints are usually not added directly to the model since there exponentially many of them.

Post a Comment for "Tsp Implementation In Docplex Python"