Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Cplex 12.9 doubling the time limit

    Posted 10/10/19 08:10 AM

    Originally posted by: alam0118


    Hi everyone

    I am using CPLEX 12.9 and i got a problem for setting a time limit. Whenever i put time limit, say 10 seconds, CPLEX will do 10 seconds and then carry on for another 10 seconds (see attached), does anyone know whats happining? 


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Cplex 12.9 doubling the time limit

    Posted 10/10/19 09:17 AM

    The most likely reason is that you call solve() twice in a row. Can you show the code that starts the solve?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Cplex 12.9 doubling the time limit

    Posted 10/10/19 09:37 AM

    Originally posted by: alam0118


    Thanks Daniel for your reply

    The code contains one solve(), but there is if (!cplex.solve()) after afew lines. Thats what i have 

                    float timeLimit = 10.0; 
                    cplex.setParam(IloCplex::TiLim, timeLimit);
                    time_t start, end;
                    double total_time;
                    start = clock();
                    cplex.solve();
                    end = clock();
                    total_time = (double)(end - start) / (double)CLK_TCK;

    Note; i have a loop to solve only the LP relaxation and then solve it again (the same instance) to optimality with the limited time. Does that cause such an issue? 


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Cplex 12.9 doubling the time limit

    Posted 10/10/19 10:22 AM

    What your log shows is that you are calling solve() more than once. I suggest you do the following:

    Before each line that contains the text 'cplex.solve()' you put something like

    std::cout << "Calling solve from line " << __LINE__ << std::endl;

    Then your log should show some of this output before each solve and you can figure out where the second solve is triggered from.

    Note that a statement like 'if (!cplex.solve())' will also trigger a solve that runs for 10 seconds.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Cplex 12.9 doubling the time limit

    Posted 10/10/19 10:41 AM

    Originally posted by: alam0118


    The problem was because i have cplex.solve(); and then  'if (!cplex.solve())'. The latter statement is deleted and the problem is solved..

    Many Thanks Daniel ..


    #CPLEXOptimizers
    #DecisionOptimization