Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Reporting ObjValues in different timelimits

    Posted 01/03/17 10:06 AM

    Originally posted by: AndyHam


    Dear IBM,
    I always thank for valuable feedbacks I have received from this forum.

     

    How to report ObjValues in different timelimits?
    I need to report the ObjValues in 1, 5, 60, and 180 seconds, respectively. Right now, I am reporting them in the following way, which is an inefficient way, namely, solving 4 times. I have two wishes:
    1. solve a problem just once with 180 s and report ObjValues for four different timelimits.
    2. identify optimality of each ObjValue (right now, I compare SolveTime with timelimit. If SolveTime < timelimit, then I assume it is optimal.)

    For instance, I would like to generate the following logs:
    //timelimit,   solve time to hit the best solution,           obj value,     optimality
    "1   secs,                    1.10,                                                       , 200          , no
    "5   secs,                    2.98,                                                       , 198          , no
    "60 secs,                    47.17,                                                     , 192          , yes
    "180 secs,                  47.17,                                                     , 192          , yes
    (note "the solve time to hit the best solution" can be much shorter than timelimt)

     

    for(var i=1;i<=4;i++)
    {
    var tLimit;
    if (i==1) tLimit=1;
    if (i==2) tLimit=5;
    if (i==3) tLimit=60;
    if (i==4) tLimit=180;
    cp.param.timelimit=tLimit;
    if (cp.solve()) {
         ofile.writeln(i + "sec," + cp.info.SolveTime+ "," + cp.getObjValue());
    } else {  
          ofile.writeln(i + "sec," + cp.info.SolveTime+ "," + "no solution");
    };

    Any help will be appreciated.
    Andy


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: Reporting ObjValues in different timelimits

    Posted 01/03/17 11:27 AM

    Hi,

    why not using a loop such as

    thisOplModel.generate(); 

    cp.startNewSearch(); 
    while(cp.next()) 
    {
      writeln("obj = ", cp.getObjValue(),  " | time = ", cp.info.SolveTime);
    cp.endSearch();  

    ?

     

    regards


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: Reporting ObjValues in different timelimits

    Posted 01/03/17 11:44 AM

    Originally posted by: AndyHam


    Thanks for the quick feedback. I can use this code to generate all different ObjValues with exact times. Then, I can manupulate the log to extract what I want. Thanks again! 


    #DecisionOptimization
    #OPLusingCPOptimizer