1

I wish to solve a TSP in python using docplex, and would like to develop something resembles the Statistics plot in CPLEX Optimisation Studio and print out lower and upper bounds for each feasible solution found.

The results I wish to receive from the engine, but using docplex

My initial idea is to apply "model.solve_details.mip_relative_gap" but it only prints out the final gap of the optimal solution. I wish to find out how to call this result back DURING the optimisation process, which I haven't succeed for having little experience with Python. Any hint would be appreciated.

The basic logic of my code looks like:

`from docplex.mp.model import Model 
model = Model("My_model") 
#(...add_constraints...) 
model.minimize(My_objective_function) 
solution = model.solve() 
status = model.solve_details.mip_relative_gap 
print(status) 
print(model.solution)`

This question has also been asked in the IBM Forum: https://www.ibm.com/mysupport/s/forumsquestion?id=0D50z00006abxNkCAI

LuciaEv
  • 13
  • 4

1 Answers1

1

Look at the progress listeners as described here:

https://github.com/IBMDecisionOptimization/docplex-examples/blob/master/examples/mp/jupyter/progress.ipynb

This API lets you receive and process information during a MIP solve, in particular draw a progress curve.

Philippe Couronne
  • 826
  • 1
  • 5
  • 6