Changeset 1985


Ignore:
Timestamp:
May 30, 2012 2:03:31 PM (7 years ago)
Author:
pbonami
Message:

Respect time limit better in iFP

Location:
trunk/Bonmin/src/Algorithms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Bonmin/src/Algorithms/BonBonminSetup.cpp

    r1980 r1985  
    649649      options_->SetStringValue(o_name.c_str(),"yes", true, true);
    650650      o_name = prefix + "pump_for_minlp.time_limit";
    651       options_->SetNumericValue(o_name.c_str(),30, true, true);
     651      options_->SetNumericValue(o_name.c_str(),10, true, true);
    652652      o_name = prefix + "pump_for_minlp.solution_limit";
    653653      options_->SetIntegerValue(o_name.c_str(),3, true, true);
  • trunk/Bonmin/src/Algorithms/BonSubMipSolver.cpp

    r1961 r1985  
    4444      ownClp_(false)
    4545  {
     46
     47   int logLevel;
     48   b.options()->GetIntegerValue("milp_log_level", logLevel, prefix);
     49
    4650   int ivalue;
    4751   b.options()->GetEnumValue("milp_solver",ivalue,prefix);
     
    5054     clp_ = new OsiClpSolverInterface;
    5155     ownClp_ = true;
     56     clp_->messageHandler()->setLogLevel(logLevel);
    5257   }
    5358   else if (ivalue == 1) {
     
    5661     clp_ = new OsiClpSolverInterface;
    5762     ownClp_ = true;
     63     clp_->messageHandler()->setLogLevel(logLevel);
    5864   }
    5965   else if (ivalue == 2) {
     
    6167      OsiCpxSolverInterface * cpxSolver = new OsiCpxSolverInterface;
    6268#if 1
     69     
    6370      b.options()->GetIntegerValue("number_cpx_threads",ivalue,prefix);
    6471      CPXsetintparam(cpxSolver->getEnvironmentPtr(), CPX_PARAM_THREADS, ivalue);
     
    6774#endif
    6875      cpx_ = cpxSolver;
     76      cpx_->messageHandler()->setLogLevel(logLevel);
    6977#else
    7078      std::cerr << "You have set an option to use CPLEX as the milp\n"
     
    242250        CPXsetdblparam(env, CPX_PARAM_EPGAP, gap_tol_);
    243251
     252        double start_time = CoinCpuTime();
    244253
    245254        CPXsetintparam(env,CPX_PARAM_INTSOLLIM, 10);
     
    263272        status = CPXsolninfo(env, cpxlp, NULL, &type, NULL, NULL);
    264273        CHECK_CPX_STAT("solninfo", status);
    265 
    266         while(!optimal_ && type == CPX_NO_SOLN && stat != CPXMIP_SOL_LIM){
     274        while(!optimal_ && type == CPX_NO_SOLN && stat != CPXMIP_SOL_LIM && stat != CPXMIP_TIME_LIM_INFEAS
     275              && stat != CPXMIP_TIME_LIM_FEAS && (CoinCpuTime() - start_time) <= max_time){
    267276          CPXsetintparam(env, CPX_PARAM_INTSOLLIM, 1);
     277          CPXsetdblparam(env, CPX_PARAM_TILIM, max_time - CoinCpuTime() + start_time);
    268278          CPXsetintparam(env,CPX_PARAM_NODELIM, 2100000000);
    269279           status = CPXmipopt(env,cpxlp);
Note: See TracChangeset for help on using the changeset viewer.