IBMDecisionOptimization / docplex-examples

These samples demonstrate how to use the DOcplex library to model and solve optimization problems.
https://ibmdecisionoptimization.github.io/
Apache License 2.0
396 stars 228 forks source link

how to output multi results #54

Closed weidongzhou1994 closed 2 years ago

weidongzhou1994 commented 3 years ago

as title, I want to choose the best result from multi results, but docplex only output a result, how to output multi results.

vberaudi commented 3 years ago

If you want to collect all the solutions, you should look at callbacks. Here is an example which shows how those callbacks work in docplex: https://github.com/PhilippeCouronne/docplex_contribs/blob/master/docplex_contribs/src/cut_callback.py and the doc: http://ibmdecisionoptimization.github.io/docplex-doc/mp/docplex.mp.callbacks.cb_mixin.html#docplex.mp.callbacks.cb_mixin.ModelCallbackMixin