Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to get the solution time in Java?

    Posted 11/10/08 06:02 AM

    Originally posted by: SystemAdmin


    [cplex_ma said:]

    Hi,

    I would like to know how long it takes for CPLEX to solve my problem, as a result, I want to keep time. Is there any API in CPLEX that keeps the solution time?

    Thanks
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to get the solution time in Java?

    Posted 11/10/08 02:21 PM

    Originally posted by: SystemAdmin


    [Didier Vidal said:]

    Hi,

    What about IloCplex.getCplexTime ?


    Didier Vidal.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How to get the solution time in Java?

    Posted 11/10/08 02:21 PM

    Originally posted by: SystemAdmin


    [cplex_ma said:]

    Hi,

    Thanks for the answer.

    I have
    IloCplex cpx = new IloCplex();
    but the cpx object does not have any getCplexTime() method. cpx does not have anything related to Time. Is it any other object?

    Thanks,

    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: How to get the solution time in Java?

    Posted 11/10/08 07:04 PM

    Originally posted by: SystemAdmin


    [prubin said:]

    I don't see a getCplexTime method in the API as of version 11.0.  Was this added to 11.1?  AFAIK, for 11.0 and earlier, about the only way is to use the System methods to get clock values before and after the call to solve().  The C++ API has an IloTimer class that facilitates this, but it doesn't exist in Java.

    /Paul
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: How to get the solution time in Java?

    Posted 11/10/08 07:18 PM

    Originally posted by: SystemAdmin


    [Didier Vidal said:]

    I found the method in the documentation of CPLEX 11.2. I didn't know it wasn't there in previous releases. Sorry about that.


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: How to get the solution time in Java?

    Posted 11/10/08 07:22 PM

    Originally posted by: SystemAdmin


    [Didier Vidal said:]

    This post http://forums.ilog.com/optimization/index.php?topic=267.msg710#msg710 should give you a solution if you use a version of CPLEX that doesn't have the method getCPLEXTime.

    Didier.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: How to get the solution time in Java?

    Posted 11/11/08 04:13 PM

    Originally posted by: SystemAdmin


    [Strider said:]

    [quote author=Didier Vidal link=topic=676.msg2061#msg2061 date=1226334118]
    This post http://forums.ilog.com/optimization/index.php?topic=267.msg710#msg710 should give you a solution if you use a version of CPLEX that doesn't have the method getCPLEXTime.

    Didier.


    They suggest System.currentTimeMillis().
    If you want more accuracy I suggest using System.nanoTime() if you have JDK 1.5+. This is not mainly because it uses nanoseconds, but because the milliseconds from System.currentTimeMillis can be off by some amount. You could write something like this:


        long beginTime = System.nanoTime();
        cplex.solve();
        long endTime = System.nanoTime();
        System.out.println("Solution time = " + ((endTime - beginTime) / 1E6) + " ms.");

    #CPLEXOptimizers
    #DecisionOptimization