Decision Optimization

Expand all | Collapse all

How can I get the elapsed time in DoCplex?

  • 1.  How can I get the elapsed time in DoCplex?

    Posted Tue June 30, 2020 04:34 AM
    Hello,

    How can I get the elapsed time in DoCplex? (Other ways than log file). I need to save the elapsed time in every iteration.

    ------------------------------
    Sajad Karimi
    ------------------------------


  • 2.  RE: How can I get the elapsed time in DoCplex?

    Posted Tue June 30, 2020 05:36 AM
    What exactly do you mean by "elapsed time in every iteration"? Do you mean simplex iteration?

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



  • 3.  RE: How can I get the elapsed time in DoCplex?

    Posted Tue June 30, 2020 12:07 PM
    I want to solve a model by different parameters. So I wrote a loop and changed the parameters in every iteration and solved the model. I want to save the elapsed of solving the model in each iteration.
    I know that I can get the value of objective function by "model.get_objective_value()", but I am not sure how to get the elapsed time for the model.

    ------------------------------
    Sajad Karimi
    ------------------------------



  • 4.  RE: How can I get the elapsed time in DoCplex?

    Posted Wed July 01, 2020 02:00 AM
    So you only want to get the total solution time. You can just use Python's time package and the time.time() function to get a time stamp. With this you can easily calculate the elapsed time. This will also include any overhead there is between docplex and calling the engine. The raw engine solution time can be queried using
    m.get_solve_details().time​

    assuming that m is an instance of Model and m.solve() was called before.

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