Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Python Coding for measuring the computation time of cplex (docplex)

    Posted 08/02/22 05:00 AM
    Dear All,

    I am running several scenarios by using cplex (docplex) library, for example to change the number of decision variables, to change the number in parameters, etc. In this case, I would like to ask you: is there any python coding to measure the computation time of cplex (docplex) library? If yes, could anyone share me, please? Thank you in advance.

    ------------------------------
    Nicholas Nicholas
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Python Coding for measuring the computation time of cplex (docplex)

    Posted 08/02/22 09:48 AM
    Dear Nicholas,

    When using docplex.mp models, the time spent to solve the problem is given in the object returned by the 'solve_details' method of the solved model. So you can write:

    if mdl.solve():
      print('time', mdl.solve_details.time)

    I hope this helps.

    Cheers,

    ------------------------------
    Renaud Dumeur
    ------------------------------



  • 3.  RE: Python Coding for measuring the computation time of cplex (docplex)

    Posted 08/18/22 01:56 AM
    Dear @Renaud Dumeur,

    Thank you for your recommendation.
    When I included the following code:
    if mdl.solve():
      print('time', mdl.solve_details.time)

    the result is time 0.0
    I guess it might be because of the number of decimal digit. Do you know, by any chance, how to increase the decimal digit for CPLEX python?

    Thank you!​

    ------------------------------
    Nicholas Nicholas
    ------------------------------



  • 4.  RE: Python Coding for measuring the computation time of cplex (docplex)

    Posted 08/22/22 03:11 AM
    That's odd: I've never seen this value as a 0.0. (there is no notion of decimal digit in the cplex python layer)
    In the CPLEX log, is the Total (root+branch&cut) also 0?

    ------------------------------
    Vincent Beraudier
    ------------------------------