TSP implementation in docplex python

久未见 提交于 2020-04-18 02:34:12

问题


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?


回答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.



来源:https://stackoverflow.com/questions/60513452/tsp-implementation-in-docplex-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!