Changeset 1071 for trunk


Ignore:
Timestamp:
Mar 12, 2014 9:35:13 PM (6 years ago)
Author:
pbelotti
Message:

tweaked performance of FP MILP methods, added option 5 for getIntCandidate (missing pass sol to SCIP)

Location:
trunk/Couenne/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/convex/generateCuts.cpp

    r945 r1071  
    415415    // Bound tightening ////////////////////////////////////
    416416
    417     /*printf ("== BT ================\n");
    418       for (int i = 0; i < problem_ -> nVars (); i++)
    419       if (problem_ -> Var (i) -> Multiplicity () > 0)
    420       printf ("%4d %+20.8g [%+20.8g,%+20.8g]\n", i,
    421       problem_ -> X  (i), problem_ -> Lb (i), problem_ -> Ub (i));
    422       printf("=============================\n");*/
     417    //bool is_feas = p -> btCore (chg_bds);
    423418
    424419    // Reduced Cost BT -- to be done first to use rcost correctly
  • trunk/Couenne/src/heuristics/CouenneFPFindSolution.cpp

    r1062 r1071  
    2525
    2626/// find a feasible or optimal solution of MILP
    27 double CouenneFeasPump::findSolution (double* &iSol, int niter, int* nsuciter) {
     27double CouenneFeasPump::findSolution (const double *nSol, double* &iSol, int niter, int* nsuciter) {
    2828
    2929  /// As found on the notes, these methods can be used, from the most
     
    7070  if (useSCIP_ && problem_ -> nIntVars () > 0) { // if LP, use Clp below
    7171
    72     SCIP_RETCODE retcode = ScipSolve (iSol, niter, nsuciter, obj);
     72    SCIP_RETCODE retcode = ScipSolve (nSol, iSol, niter, nsuciter, obj);
    7373
    7474    if (retcode != SCIP_OKAY) {
  • trunk/Couenne/src/heuristics/CouenneFPSolveMILP.cpp

    r1065 r1071  
    181181  }
    182182
    183   double obj = findSolution (iSol, niter, nsuciter);
     183  double obj = findSolution (nSol0, iSol, niter, nsuciter);
    184184
    185185  if ((nSol0 && iSol) &&
  • trunk/Couenne/src/heuristics/CouenneFPscipSolve.cpp

    r1066 r1071  
    2424#include "scip/cons_bounddisjunction.h"
    2525
    26 SCIP_RETCODE CouenneFeasPump::ScipSolve (double* &sol, int niter, int* nsuciter, CouNumber &obj) {
     26SCIP_RETCODE CouenneFeasPump::ScipSolve (const double *nSol, double* &sol, int niter, int* nsuciter, CouNumber &obj) {
    2727
    2828  static int currentmilpmethod = 0;
     
    217217
    218218    SCIP_CONS* cons;
    219        
    220     char consname[SCIP_MAXSTRLEN]; 
     219
     220    char consname[SCIP_MAXSTRLEN];
    221221    (void) SCIPsnprintf(consname, SCIP_MAXSTRLEN, "row_%d", i);
    222222
     
    257257  do {
    258258    solveagain = false;
    259        
     259
    260260    // reset parameters if MILP is solved agian
    261261    SCIP_CALL( SCIPresetParams(scip) );
     
    268268    // do not abort subproblem on CTRL-C
    269269    SCIP_CALL( SCIPsetBoolParam(scip, "misc/catchctrlc", FALSE) );
    270        
     270
    271271    // set time limit
    272272    timelimit = problem_ -> getMaxCpuTime () - CoinCpuTime ();
     
    282282       
    283283    // tune SCIP differently, depending on the chosen method to solve the MILP
    284     /// -1. Solve the MILP relaxation to proven optimality
     284    /// -1. MILP and stop at first solution found (similar to other FP implementations and mainly done for comparison with them)
    285285    ///  0. Let Couenne choose
    286286    ///  1. Partially solve the MILP with emphasis on good solutions
     
    292292      case -1: // solve the MILP completely. SCIP's default setting should be best for this
    293293        if( milpCuttingPlane_ == FP_CUT_INTEGRATED )
    294           { 
     294          {
    295295            SCIP_CALL( SCIPsetLongintParam(scip, "constraints/rowcuts/maxcuttingrounds", 0) );
    296296          }
     
    307307        SCIP_CALL( SCIPsetRealParam   (scip, "limits/gap", .001) );
    308308
    309         // disable cutting plane separation
    310         SCIP_CALL( SCIPsetSeparating(scip, SCIP_PARAMSETTING_OFF, TRUE) );
     309        // disable expensive cutting plane separation
     310        //SCIP_CALL( SCIPsetSeparating(scip, SCIP_PARAMSETTING_FAST, TRUE) );
    311311       
    312312        // disable expensive presolving
    313         SCIP_CALL( SCIPsetPresolving(scip, SCIP_PARAMSETTING_FAST, TRUE) );
     313        //SCIP_CALL( SCIPsetPresolving(scip, SCIP_PARAMSETTING_FAST, TRUE) );
    314314
    315315        // use aggressive primal heuristics
    316316        SCIP_CALL( SCIPsetHeuristics(scip, SCIP_PARAMSETTING_AGGRESSIVE, TRUE) );
    317317       
    318         // use best estimate node selection
    319         if( SCIPfindNodesel(scip, "estimate") != NULL )
     318        // use best estimate node selection
     319        /*
     320          if( SCIPfindNodesel(scip, "estimate") != NULL )
    320321          {
    321322            SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/estimate/stdpriority", INT_MAX/4) );
    322323          }
    323        
     324        */
     325
    324326        // use inference branching
    325         if( SCIPfindBranchrule(scip, "inference") != NULL )
     327        /*
     328          if( SCIPfindBranchrule(scip, "inference") != NULL )
    326329          {
    327330            SCIP_CALL( SCIPsetIntParam(scip, "branching/inference/priority", INT_MAX/4) );
    328331          }
    329        
     332        */
     333
    330334        // disable conflict analysis
    331         SCIP_CALL( SCIPsetBoolParam(scip, "conflict/useprop", FALSE) );
    332         SCIP_CALL( SCIPsetBoolParam(scip, "conflict/useinflp", FALSE) );
    333         SCIP_CALL( SCIPsetBoolParam(scip, "conflict/useboundlp", FALSE) );
    334         SCIP_CALL( SCIPsetBoolParam(scip, "conflict/usesb", FALSE) );
    335         SCIP_CALL( SCIPsetBoolParam(scip, "conflict/usepseudo", FALSE) );
     335        /*
     336          SCIP_CALL( SCIPsetBoolParam(scip, "conflict/useprop", FALSE) );
     337          SCIP_CALL( SCIPsetBoolParam(scip, "conflict/useinflp", FALSE) );
     338          SCIP_CALL( SCIPsetBoolParam(scip, "conflict/useboundlp", FALSE) );
     339          SCIP_CALL( SCIPsetBoolParam(scip, "conflict/usesb", FALSE) );
     340          SCIP_CALL( SCIPsetBoolParam(scip, "conflict/usepseudo", FALSE) );
     341        */
    336342
    337343        break;
     
    421427        break;
    422428
     429      case 5: // use rounding heuristic in Couenne
     430
     431        {
     432          bool success;
     433
     434          if (!sol)
     435            sol = new CouNumber [problem_ -> nVars ()];
     436
     437          if (nSol)
     438            problem_ -> getIntegerCandidate (nSol, sol, problem_ -> Lb (), problem_ -> Ub ());
     439
     440          //
     441          //
     442          //SCIP_SOL scipSol = {0,0,0,sol,NULL,NULL,0,0,0,0,0,0};
     443          //SCIP_CALL (SCIPtrySol (scip, ScipSol, FALSE, FALSE, FALSE, FALSE, &success) );
     444          //if (!success)
     445          //problem_ -> Jnlst () -> Printf (Ipopt::J_WARNING, J_NLPHEURISTIC, "Could not add initial MINLP solution to SCIP\n");
     446        }
     447
     448        break;
     449
     450
     451      case 6: // round, but perturb first if we are cycling
     452
     453        break;
     454
     455
    423456      default:
    424         printf("invalid MILP method: %d\n", currentmilpmethod);
     457        printf("Invalid MILP method in feasibility pump: %d\n", currentmilpmethod);
    425458        assert(false);
    426459        break;
     
    562595        ++(*nsuciter);
    563596
    564         // if we succeeded five times in a row, try a cheaper MILP_ solving method next time
     597        // if we succeeded three times in a row, try a cheaper MILP_ solving method next time
    565598        // TODO: if we want to use time limits, hitting the time limit would be another good reason to switch
    566         if( *nsuciter >= 3 && currentmilpmethod < 4 )
     599        if( milpMethod_ == 0 && *nsuciter >= 3 && currentmilpmethod < 4 )
    567600          {
    568601            ++currentmilpmethod;
  • trunk/Couenne/src/heuristics/CouenneFeasPump.hpp

    r1063 r1071  
    123123
    124124    /// find feasible solution (called by solveMILP ())
    125     double findSolution (double *&sol, int niter, int* nsuciter);
     125    double findSolution (const double *nSol, double *&sol, int niter, int* nsuciter);
    126126
    127127    /// initialize all solvers at the first call, where the initial
     
    166166
    167167#ifdef COIN_HAS_SCIP
    168     SCIP_RETCODE ScipSolve (double* &sol, int niter, int* nsuciter, CouNumber &obj);
     168    SCIP_RETCODE ScipSolve (const double *nSol, double* &sol, int niter, int* nsuciter, CouNumber &obj);
    169169#endif
    170170
  • trunk/Couenne/src/heuristics/CouenneFeasPumpConstructors.cpp

    r1060 r1071  
    549549    ("feas_pump_milpmethod",
    550550     "How should the integral solution be constructed?",
    551      -1, 4, -1,
     551     -1, 5, 0,
    552552       "0: automatic, 1: aggressive heuristics, large node limit, 2: default, node limit, 3: RENS, 4: Objective Feasibility Pump,  -1: solve MILP completely");
    553553
  • trunk/Couenne/src/problem/getIntegerCandidate.cpp

    r886 r1071  
    377377    if (i == infeasible)
    378378      retval = -1;
     379
     380    //
     381    // While Couenne does not use this solution (retval==-1), the FP can still use a rounded solution
     382    //
     383
     384    for (int j=nVars(); j--;)
     385      xInt [j] = ceil (xInt [j] - 0.5);
    379386  }
    380387
Note: See TracChangeset for help on using the changeset viewer.