Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

How to (1) print optimality gap and (2) set limit for it using Python

  • 1.  How to (1) print optimality gap and (2) set limit for it using Python

    Posted Wed April 29, 2020 12:48 PM

    Hello Everyone!

    While my background is with GAMS and I have experience with cplex in its environment. I am new to docplex + python for solving a problem on the cloud. I have two questions and really appreciate your help and support.

    1. How can I print and check the optimality gap at each iteration?
    2. How can I put limitations on the optimality gap, computational time, etc.?

    Thank you in advance,
    Hossein 



    ------------------------------
    Hossein Shahandeh
    ------------------------------

    #DecisionOptimization


  • 2.  RE: How to (1) print optimality gap and (2) set limit for it using Python

    Posted Wed April 29, 2020 01:03 PM
    Limitations are set via parameters. The list of available parameters can be found here. In order to set a parameter in docplex use the `Model.parameters` property.
    One way to monitor progress is by just enabling the log: call solve() with `log_output=True`. Another way to do that would be callbacks.
    I think you can find examples for everything you asked in the examples on the docplex website.

    ------------------------------
    Daniel Junglas
    ------------------------------