Changeset 634


Ignore:
Timestamp:
Jun 9, 2011 5:00:05 PM (9 years ago)
Author:
berthold
Message:

set time limit in SCIP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/heuristics/CouenneFPFindSolution.cpp

    r632 r634  
    1313#include "CouenneFeasPump.hpp"
    1414#include "CouenneProblem.hpp"
     15#include "CoinTime.hpp"
    1516
    1617using namespace Couenne;
     
    5152
    5253#ifdef COIN_HAS_SCIP
    53 
    5454   if (useSCIP_) {
    5555
     
    6969     const int* indices;
    7070
     71     SCIP_Real timelimit;
     72
    7173     double infinity;
    7274     int nvars;
    7375     int nconss;
    7476
    75      printf ("USING SCIP\n");
     77     int currentmilpmethod;
    7678
    7779     // COUENNE_INFINITY , getInfinity()
     
    115117     SCIP_CALL( SCIPsetBoolParam(scip, "misc/catchctrlc", FALSE) );
    116118
     119     // set time limit
     120     timelimit = problem_ -> getMaxCpuTime () - CoinCpuTime ();
     121     SCIP_CALL( SCIPsetRealParam(scip, "limits/time", timelimit) );
     122
    117123     // create problem instance in SCIP
    118124     SCIP_CALL_ABORT( SCIPcreateProb(scip, "auxiliary FeasPump MILP", NULL, NULL, NULL, NULL, NULL, NULL, NULL) );
     
    154160        checkInfinity(scip, rhss[i], infinity);
    155161
     162        // create an empty linear constraint
    156163        SCIP_CALL_ABORT( SCIPcreateConsLinear(scip, &cons, consname, 0, NULL, NULL, lhss[i], rhss[i],
    157164              TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE) );
     
    164171        }
    165172
     173        // add constraint to SCIP
    166174        SCIP_CALL_ABORT( SCIPaddCons(scip, cons) );
    167175        SCIP_CALL_ABORT( SCIPreleaseCons(scip, &cons) );       
    168176     }
     177     
     178     // determine the method to solve the MILP
     179     if (milpMethod_ == 0 )
     180     {
     181        // TODO: add rule for automatic choice of currentmilpmethod
     182        currentmilpmethod = 1;
     183     }
     184     else
     185        currentmilpmethod = milpMethod_; // use a fixed method to solve the MILP
     186     
     187     SCIPdebugMessage("using MILP method: %d\n",currentmilpmethod);
     188
     189     // tune SCIP differently, depending on the chosen method to solve the MILP
     190     switch(currentmilpmethod)
     191     {
     192     case 1: // solve the MILP completely. SCIP's default setting should be best for this
     193        break;
     194
     195     case 2: // solve the MILP quickly. Set limits on overall nodes and stall nodes (nodes without incumbent improvement)
     196             // disable or cut down all procedures which are merely used for improving the dual bound, e.g., cuts
     197        SCIP_CALL_ABORT( SCIPsetLongintParam(scip, "limits/stallnodes", 100) );
     198        SCIP_CALL_ABORT( SCIPsetLongintParam(scip, "limits/nodes", 1000) );
     199
     200        // disable cutting plane separation
     201        SCIP_CALL_ABORT( SCIPsetSeparating(scip, SCIP_PARAMSETTING_OFF, TRUE) );
     202       
     203        // disable expensive presolving
     204        SCIP_CALL_ABORT( SCIPsetPresolving(scip, SCIP_PARAMSETTING_FAST, TRUE) );
     205
     206        // use aggressuve Heuristics
     207        SCIP_CALL_ABORT( SCIPsetHeuristics(scip, SCIP_PARAMSETTING_AGGRESSIVE, TRUE) );
     208       
     209        // use best estimate node selection
     210        if( SCIPfindNodesel(scip, "estimate") != NULL )
     211        {
     212           SCIP_CALL_ABORT( SCIPsetIntParam(scip, "nodeselection/estimate/stdpriority", INT_MAX/4) );
     213        }
     214       
     215        // use inference branching
     216        if( SCIPfindBranchrule(scip, "inference") != NULL )
     217        {
     218           SCIP_CALL_ABORT( SCIPsetIntParam(scip, "branching/inference/priority", INT_MAX/4) );
     219        }
     220       
     221        // disable conflict analysis
     222        SCIP_CALL_ABORT( SCIPsetBoolParam(scip, "conflict/useprop", FALSE) );
     223        SCIP_CALL_ABORT( SCIPsetBoolParam(scip, "conflict/useinflp", FALSE) );
     224        SCIP_CALL_ABORT( SCIPsetBoolParam(scip, "conflict/useboundlp", FALSE) );
     225        SCIP_CALL_ABORT( SCIPsetBoolParam(scip, "conflict/usesb", FALSE) );
     226        SCIP_CALL_ABORT( SCIPsetBoolParam(scip, "conflict/usepseudo", FALSE) );
     227
     228        break;
     229
     230     case 3: // solve the MILP with RENS. Disable most other features, enable RENS
     231        SCIP_CALL_ABORT( SCIPsetLongintParam(scip, "limits/nodes", 1) );
     232
     233        // disable cutting plane separation
     234        SCIP_CALL_ABORT( SCIPsetSeparating(scip, SCIP_PARAMSETTING_OFF, TRUE) );
     235       
     236        // disable expensive presolving
     237        SCIP_CALL_ABORT( SCIPsetPresolving(scip, SCIP_PARAMSETTING_FAST, TRUE) );
     238
     239        // besides RENS, only use cheap heuristics
     240        SCIP_CALL_ABORT( SCIPsetHeuristics(scip, SCIP_PARAMSETTING_FAST, TRUE) );
     241
     242        // use inference branching
     243        if( SCIPfindBranchrule(scip, "inference") != NULL )
     244        {
     245           SCIP_CALL_ABORT( SCIPsetIntParam(scip, "branching/inference/priority", INT_MAX/4) );
     246        }
     247
     248        // ensure that RENS is called
     249        if( SCIPfindHeur(scip, "rens") != NULL )
     250        {
     251           SCIP_CALL_ABORT( SCIPsetIntParam(scip, "heuristics/rens/freq", 0) );
     252           SCIP_CALL_ABORT( SCIPsetRealParam(scip, "heuristics/rens/minfixingrate", 0.0) );
     253        }
     254        break;
     255
     256     case 4: // solve the MILP with Feasibility Pump. Disable most other features, enable stage 3 for feaspump
     257        SCIP_CALL_ABORT( SCIPsetLongintParam(scip, "limits/nodes", 1) );
     258
     259        // disable cutting plane separation
     260        SCIP_CALL_ABORT( SCIPsetSeparating(scip, SCIP_PARAMSETTING_OFF, TRUE) );
     261       
     262        // disable expensive presolving
     263        SCIP_CALL_ABORT( SCIPsetPresolving(scip, SCIP_PARAMSETTING_FAST, TRUE) );
     264
     265        // besides feaspump, only use cheap heuristics
     266        SCIP_CALL_ABORT( SCIPsetHeuristics(scip, SCIP_PARAMSETTING_FAST, TRUE) );
     267
     268        // use inference branching
     269        if( SCIPfindBranchrule(scip, "inference") != NULL )
     270        {
     271           SCIP_CALL_ABORT( SCIPsetIntParam(scip, "branching/inference/priority", INT_MAX/4) );
     272        }
     273
     274        // ensure that feasibility pump is called
     275        if( SCIPfindHeur(scip, "feaspump") != NULL )
     276        {
     277           SCIP_CALL_ABORT( SCIPsetIntParam(scip, "heuristics/feaspump/freq", 0) );
     278           SCIP_CALL_ABORT( SCIPsetIntParam(scip, "heuristics/feaspump/maxsols", -1) );
     279           (void) SCIPsetBoolParam(scip, "heuristics/feaspump/stage3", TRUE);
     280           (void) SCIPsetBoolParam(scip, "heuristics/feaspump2/stage3", TRUE);
     281        }
     282
     283        break;
     284
     285     default:
     286        break;
     287     }
     288  /// 1. Solve a MILP relaxation with Manhattan distance as objective
     289  /// 2. Partially solve the MILP with emphasis on good solutions
     290  /// 3. Apply RENS to 1
     291  /// 4. Use Objective FP 2.0 for MILPs
     292  /// 5. round-and-propagate
     293  /// 6. choose from pool, see 4
     294  /// 7. random perturbation
    169295
    170296         
Note: See TracChangeset for help on using the changeset viewer.