docplexcloud

Implementing TSP with Lazy constraint callback

笑着哭i 提交于 2020-04-18 06:53:11
问题 I am trying to TSP with Lazy constraint callback. From Answer given here and here, I have tried to use the code from the links and was able to add the call back function. Now I am struggling with add_lazy_constraints . Here is my current code: It is a 9 Node TSP. import docplex.mp.model as cpx from cplex.callbacks import LazyConstraintCallback from docplex.mp.callbacks.cb_mixin import * class DOLazyCallback(ConstraintCallbackMixin, LazyConstraintCallback): def __init__(self, env):

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