Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Runtime given by cplex different from calculated one

    Posted 07/21/14 06:22 PM

    Originally posted by: Trino


    Hello, I have an algorithm in c++ that calls cplex to solve a certain formulation and at the end of each iteration it may add some additional constraints, then call cplex again, and  so on...

    I'm limiting the number of threads in 1 by using the following code:

    cplex.setParam(IloCplex::Threads, 1);
    

    At the end of each iteration I call the method getTime() of the instance of IloCplex that I use to solve my model in order to accumulate the total time. What happens is that sometimes the total time calculated using this method is very different from the one I calculate by myself using the library -ltr of linux (sometimes double the time!). What I though is that cplex may be using another thread, but I checked and I was setting the number of threads, so I don't know why it is giving me these results, can somebody give me some insight about this?

     

    Thanks.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Runtime given by cplex different from calculated one

    Posted 07/22/14 05:59 PM

    Could it be that you're using different clock types with the two timers?  By default, cplex will use wall-clock time for the clocktype parameter.

    Sorry for my ignorance, but what is the "library -ltr of linux" that you refer to?

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Runtime given by cplex different from calculated one

    Posted 07/25/14 04:47 PM

    Originally posted by: Trino


    This is the Posix RealtimeExtension and it allows me to use the following functions to get the time http://pubs.opengroup.org/onlinepubs/007908799/xsh/clock_gettime.html

    In cplex I'm using the default option which gives me the wall time, while in this library I use the CLOCK_MONOTONIC (more precise than the wall-clock). But could it be the difference being the double??

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Runtime given by cplex different from calculated one

    Posted 08/04/14 07:39 AM

    Just to be sure: you are aware that IloCplex::getTime() only returns a timestamp, not the elapsed time? So your code should look like this:

    double const start = cplex.getTime();
    cplex.solve();
    double const elapsed = cplex.getTime() - start;

    When you observe that CPLEX reports twice as much elapsed time as CLOCK_MONOTONIC, what is the order of magnitude of the elapsed times? Are we talking second, milliseconds, nanoseconds here?

    Does the problem persist if you use CLOCK_REALTIME instead? What happens if you use gettimeofday() to time CPLEX execution?


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Runtime given by cplex different from calculated one

    Posted 08/04/14 10:27 AM

    Originally posted by: Trino


    uhm...I was not aware of that, I was considering that it returns the elapsed time. So that should be it!

    I'll will test and give a fideback here.

     

    Thanks!


    #CPLEXOptimizers
    #DecisionOptimization