Changeset 1011 for trunk


Ignore:
Timestamp:
Oct 19, 2013 7:31:58 PM (6 years ago)
Author:
pbelotti
Message:

minor output fixes and SCIP heuristic tuning for tests

Location:
trunk/Couenne/src/heuristics
Files:
7 edited

Legend:

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

    r897 r1011  
    154154
    155155  if ((nSol0 && iSol) &&
    156       (problem_ -> Jnlst () -> ProduceOutput (Ipopt::J_ERROR, J_NLPHEURISTIC))) {
     156      (problem_ -> Jnlst () -> ProduceOutput (Ipopt::J_WARNING, J_NLPHEURISTIC))) {
    157157
    158158    double dist = 0.;
  • trunk/Couenne/src/heuristics/CouenneFPSolveNLP.cpp

    r898 r1011  
    9898
    9999  else problem_ -> Jnlst () -> Printf
    100       (J_ERROR, J_NLPHEURISTIC, "FP: warning, NLP returns a NULL solution\n");
     100      (J_WARNING, J_NLPHEURISTIC, "FP: warning, NLP returns a NULL solution\n");
    101101
    102102  if (nlp_ -> getSolution () && (problem_ -> Jnlst () -> ProduceOutput (J_ALL, J_NLPHEURISTIC))) { // check if non-NULL
     
    118118
    119119    problem_ -> Jnlst () -> Printf
    120       (J_ERROR, J_NLPHEURISTIC, "Feasibility Pump: Error solving NLP problem\n");
     120      (J_WARNING, J_NLPHEURISTIC, "Feasibility Pump: Error solving NLP problem\n");
    121121
    122122  retval = nlp_ -> getSolValue ();
  • trunk/Couenne/src/heuristics/CouenneFPpool.cpp

    r893 r1011  
    138138    case ALL_VARS: {
    139139      // lexicographical comparison: unless the two solutions have the
    140       // same integer subvector, comparison will tell them apart
     140      // same subvector, comparison will tell them apart
    141141
    142142      for (std::vector <exprVar *>::iterator i = problem_ -> Variables (). begin ();
  • trunk/Couenne/src/heuristics/CouenneFPscipSolve.cpp

    r966 r1011  
    251251  else if (milpMethod_ != 0)
    252252    currentmilpmethod = milpMethod_; // use a fixed method to solve the MILP
    253      
     253
    254254     
    255255  // MILP solving loop. If the MILP terminates without a solution, it might get resolved with a more expensive atrategy
     
    261261       
    262262    // deactivate SCIP output
    263     if (!(problem_ -> Jnlst () -> ProduceOutput (Ipopt::J_ERROR, J_NLPHEURISTIC))) {
     263    if (!(problem_ -> Jnlst () -> ProduceOutput (Ipopt::J_WARNING, J_NLPHEURISTIC))) {
    264264      SCIP_CALL( SCIPsetIntParam(scip, "display/verblevel", 0) );
    265265    }
     
    276276    SCIP_CALL( SCIPsetRealParam(scip, "limits/time", timelimit) );       
    277277
    278 
    279     if (problem_ -> Jnlst () -> ProduceOutput (Ipopt::J_ERROR, J_NLPHEURISTIC)) {
     278    if (problem_ -> Jnlst () -> ProduceOutput (Ipopt::J_WARNING, J_NLPHEURISTIC)) {
    280279      SCIPinfoMessage(scip, NULL, "using MILP method: %d\n",currentmilpmethod);
    281280    }
     
    295294            SCIP_CALL( SCIPsetLongintParam(scip, "constraints/rowcuts/maxcuttingrounds", 0) );
    296295          }
     296
     297        // As this is expensive, stop as soon as a solution is found
     298
     299        SCIP_CALL( SCIPsetIntParam(scip, "limits/bestsol", 1) );
    297300        break;
    298301
     
    335338        SCIP_CALL( SCIPsetLongintParam(scip, "limits/stallnodes", 500) );
    336339        SCIP_CALL( SCIPsetLongintParam(scip, "limits/nodes", 5000) );
     340
     341        // disable expensive dual techniques
     342
     343        SCIP_CALL( SCIPsetSeparating(scip, SCIP_PARAMSETTING_FAST, TRUE) );
     344        SCIP_CALL( SCIPsetPresolving(scip, SCIP_PARAMSETTING_FAST, TRUE) );
     345        SCIP_CALL( SCIPsetIntParam(scip, "branching/pscost/priority", INT_MAX/4) );
     346
    337347        break;
    338348      case 3: // solve the MILP with RENS. Disable most other features, enable RENS
     
    424434    SCIP_RETCODE retcode = SCIPsolve (scip);
    425435
     436    if (problem_ -> Jnlst () -> ProduceOutput (Ipopt::J_WARNING, J_NLPHEURISTIC))
     437      SCIP_CALL( SCIPprintStatistics(scip, NULL) );
     438
     439    // Greppable line with condensed info
     440
     441    problem_ -> Jnlst () -> Printf (Ipopt::J_ERROR, J_NLPHEURISTIC, "[FeasPump-SCIP] %5d %5d %7.2f\n", SCIPgetNVars(scip), SCIPgetNConss(scip), SCIPgetSolvingTime(scip));
     442
    426443    if (retcode != SCIP_OKAY) {
    427       problem_ -> Jnlst () -> Printf (Ipopt::J_ERROR, J_NLPHEURISTIC, "Couenne FP: SCIPsolve did not succeed\n");
     444      problem_ -> Jnlst () -> Printf (Ipopt::J_WARNING, J_NLPHEURISTIC, "Couenne FP: SCIPsolve did not succeed\n");
    428445      goto TERMINATION;
    429446    }
  • trunk/Couenne/src/heuristics/CouenneFeasPump.cpp

    r988 r1011  
    4141  const int depth = (model_ -> currentNode ()) ? model_ -> currentNode () -> depth () : 0;
    4242
     43  double time0 = CoinCpuTime();
     44
    4345  if (//(problem_ -> nIntVars () <= 0) ||                   // feas pump on NLP? Why not?
    4446      (CoinCpuTime () > problem_ -> getMaxCpuTime ()) ||  // don't start if time is out
     
    4951    return 0;
    5052
    51   problem_ -> Jnlst () -> Printf (J_ERROR, J_NLPHEURISTIC, "==================================================== FP: BEGIN\n");
     53  problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "==================================================== FP: BEGIN\n");
     54
     55  problem_ -> Jnlst () -> Printf (J_ERROR, J_NLPHEURISTIC, "[FeasPump] Initializing\n");
    5256
    5357  // Solve NLP once at the beginning ////////////////////////
     
    101105  problem_ -> domain () -> pop ();
    102106
    103   if ((status != Solve_Succeeded) &&  (status != Solved_To_Acceptable_Level))
    104     problem_ -> Jnlst () -> Printf (J_ERROR, J_NLPHEURISTIC, "Feasibility Pump: error in initial NLP problem\n");
     107  if ((status != Solve_Succeeded) && (status != Solved_To_Acceptable_Level))
     108    problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "Feasibility Pump: error in initial NLP problem\n");
    105109
    106110  if ((multHessNLP_  > 0.) ||
     
    172176      break;
    173177
    174     problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: loop\n");
     178    problem_ -> Jnlst () -> Printf (J_ERROR, J_NLPHEURISTIC, "[FeasPump] Iteration %d [%gs]\n", niter, CoinCpuTime() - time0);
    175179
    176180    // INTEGER PART /////////////////////////////////////////////////////////
     
    188192    if (!iSol || z >= COIN_DBL_MAX/2) {
    189193
    190       problem_ -> Jnlst () -> Printf (J_ERROR, J_NLPHEURISTIC, "FP: could not find IP solution\n");
     194      problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: could not find IP solution\n");
    191195
    192196      // find non-tabu solution in the solution pool
     
    208212      if (!try_again) { // nothing to do, bail out
    209213       
    210         problem_ -> Jnlst () -> Printf (J_ERROR, J_NLPHEURISTIC, "FP: could not find from pool either, bailing out\n");
     214        problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: could not find from pool either, bailing out\n");
    211215        break;
    212216      }
     
    337341    // 1) Fix integer variables to IP solution's corresponding components
    338342    // 2) Solve restriction with original obj
    339     // 3) While not found (MI)NLP solution or 
     343    // 3) While not found (MI)NLP solution or
    340344    //          solution MINLP infeasible or
    341345    //          z not better
    342346    // 4)   Get solution x* from pool
    343     // 5)   Solve with original object
     347    // 5)   Solve with original objective
    344348    // 6) Done
    345349    // 7) If found solution, set it, otherwise keep previously found (IP-feasible) one
     
    348352         z > problem_ -> getCutOff ())) {  // not improving
    349353
    350       problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: infeasible or non-improving, try looping on pool\n");
     354      problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: infeasible/non-improving (feas==%d, z=%g, cutoff=%g), looping on pool\n", isChecked, z, problem_->getCutOff ());
    351355
    352356      bool try_again;
     
    420424    // if we have a new solution, and if so we save it.
    421425
    422     if (!isChecked)
    423       problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: IP solution NOT MINLP feasible\n");
    424 
    425426    if (isChecked) {
    426427
    427       problem_ -> Jnlst () -> Printf (J_ERROR, J_NLPHEURISTIC, "FP: IP solution is MINLP feasible\n");
     428      problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: IP solution is MINLP feasible\n");
    428429
    429430      // solution is MINLP feasible! Save it.
     
    432433      objVal = z;
    433434
    434       // Found a MINLP-feasible solution, but to keep diversity do not
     435      // Found a MINLP-feasible solution, but to keep diversity do NOT
    435436      // use the best available. Just use this.
    436437      //
     
    452453      // #  else /* not FM_TRACE_OPTSOL */
    453454
    454       best   = iSol;
     455      best = iSol;
    455456
    456457      //       objVal = z;
     
    503504      break;
    504505
    505     } else if (milpCuttingPlane_ == FP_CUT_EXTERNAL ||
    506                milpCuttingPlane_ == FP_CUT_POST) {
    507 
    508       // Solution is IP- but not MINLP feasible: it might get cut by
    509       // linearization cuts. If so, add a round of cuts and repeat.
    510 
    511       OsiCuts cs;
    512 
    513       problem_   -> domain () -> push (milp_);
    514       couenneCG_ -> genRowCuts (*milp_, cs, 0, NULL); // remaining three arguments NULL by default
    515       problem_   -> domain () -> pop ();
    516 
    517       if (cs.sizeRowCuts ()) {
    518 
    519         // the (integer, NLP infeasible) solution could be separated
    520 
    521         milp_ -> applyCuts (cs);
    522 
    523         // found linearization cut, now re-solve MILP (not quite a FP)
    524         if (milpCuttingPlane_ == FP_CUT_EXTERNAL &&
    525             nSep++ < nSepRounds_)
    526           continue;
     506    } else {
     507
     508      problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: IP solution NOT MINLP feasible\n");
     509
     510      if (milpCuttingPlane_ == FP_CUT_EXTERNAL ||
     511          milpCuttingPlane_ == FP_CUT_POST) {
     512
     513        // Solution is IP- but not MINLP feasible: it might get cut by
     514        // linearization cuts. If so, add a round of cuts and repeat.
     515
     516        OsiCuts cs;
     517
     518        problem_   -> domain () -> push (milp_);
     519        couenneCG_ -> genRowCuts (*milp_, cs, 0, NULL); // remaining three arguments NULL by default
     520        problem_   -> domain () -> pop ();
     521
     522        if (cs.sizeRowCuts ()) {
     523
     524          // the (integer, NLP infeasible) solution could be separated
     525
     526          milp_ -> applyCuts (cs);
     527
     528          // found linearization cut, now re-solve MILP (not quite a FP)
     529          if (milpCuttingPlane_ == FP_CUT_EXTERNAL &&
     530              nSep++ < nSepRounds_)
     531            continue;
     532        }
    527533      }
    528534    }
     
    542548
    543549    if ((nSol && iSol) &&
    544         (problem_ -> Jnlst () -> ProduceOutput (J_ERROR, J_NLPHEURISTIC))) {
     550        (problem_ -> Jnlst () -> ProduceOutput (J_WARNING, J_NLPHEURISTIC))) {
    545551
    546552      double dist = 0.;
     
    566572    }
    567573
    568     if (problem_ -> Jnlst () -> ProduceOutput (J_ERROR, J_NLPHEURISTIC)) {
     574    if (problem_ -> Jnlst () -> ProduceOutput (J_WARNING, J_NLPHEURISTIC)) {
    569575
    570576      printDist   (problem_, iSol, nSol);
     
    637643           (retval == 0));
    638644
    639   problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: out of the FP loop\n");
     645  problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: out of the FP loop (feas=%d\n)", retval);
    640646
    641647  // OUT OF THE LOOP ////////////////////////////////////////////////////////
     
    679685          (status != Solved_To_Acceptable_Level))
    680686 
    681         problem_ -> Jnlst () -> Printf (J_ERROR, J_NLPHEURISTIC,
     687        problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC,
    682688                                        "Feasibility Pump: error in final NLP problem (due to fixing integer variables?)\n");
    683689
     
    738744    problem_ -> domain () -> pop ();
    739745
    740     if (problem_ -> Jnlst () -> ProduceOutput (J_ERROR, J_NLPHEURISTIC)) {
     746    if (problem_ -> Jnlst () -> ProduceOutput (J_WARNING, J_NLPHEURISTIC)) {
    741747      printf ("FP: returning MINLP feasible solution:\n");
    742748      printDist (problem_, best, nSol);
     
    761767
    762768  problem_ -> Jnlst () -> Printf
    763     (J_ERROR, J_NLPHEURISTIC, "FP: done ===================\n");
     769    (J_WARNING, J_NLPHEURISTIC, "FP: done ===================\n");
    764770
    765771  return retval;
     
    768774// gather data on single solution for later printout
    769775void compDistSingle (CouenneProblem *p,
    770                      int n, 
    771                      const double *v, 
    772                      double &norm, 
    773                      int &nInfI, 
    774                      int &nInfN, 
    775                      double &infI, 
     776                     int n,
     777                     const double *v,
     778                     double &norm,
     779                     int &nInfI,
     780                     int &nInfN,
     781                     double &infI,
    776782                     double &infN) {
    777783
  • trunk/Couenne/src/heuristics/CouenneFeasPump.hpp

    r966 r1011  
    157157
    158158    //
    159     // Essential tools for the FP: a problem pointer and one for the
     159    // ESSENTIAL TOOLS for the FP: a problem pointer and one for the
    160160    // linearization cut generator
    161161    //
     
    181181    Ipopt::IpoptApplication *app_;
    182182
    183     /// MILP relaxation of the MINLP (used to find integer
    184     /// non-NLP-feasible solution)
     183    /// MILP relaxation of the MINLP (used to find integer,
     184    /// non-NLP-feasible solutions)
    185185    OsiSolverInterface *milp_;
    186186
     
    214214    double multObjFMILP_; ///< weight of objective in MILP
    215215
    216     /// compute distance from integer variables only, not all variables;
     216    /// Compute distance from integer variables only, not all variables
    217217    enum fpCompDistIntType compDistInt_;
    218218
     
    223223    int nSepRounds_;
    224224
    225     /// maximum iterations per call
     225    /// Maximum iterations per call
    226226    int maxIter_;
    227227
    228     /// use SCIP instead of Cbc for solving MILPs
     228    /// Use SCIP instead of Cbc for solving MILPs
    229229    bool useSCIP_;
    230230
  • trunk/Couenne/src/heuristics/CouenneFeasPumpConstructors.cpp

    r963 r1011  
    8787  tabuMgt_             (FP_TABU_NONE) {
    8888
     89  int compareTerm = INTEGER_VARS;
     90
    8991  if (IsValid (options)) {
    9092
    9193    std::string s;
    92 
    93     int compareTerm;
    9494
    9595    options -> GetIntegerValue ("feas_pump_iter",       maxIter_,             "couenne.");
     
    122122    options -> GetIntegerValue ("feas_pump_milpmethod", milpMethod_, "couenne.");
    123123    options -> GetIntegerValue ("feas_pump_poolcomp",   compareTerm, "couenne.");
    124 
    125     pool_ = new CouenneFPpool (problem_, (enum what_to_compare) compareTerm);
    126124
    127125    options -> GetStringValue  ("feas_pump_tabumgt", s, "couenne.");
     
    143141#endif
    144142
    145   } else
    146     //pool_ = new CouenneFPpool (SUM_NINF);
    147     pool_ = new CouenneFPpool (problem_, INTEGER_VARS);
     143  }
     144
     145  pool_ = new CouenneFPpool (problem_, (enum what_to_compare) compareTerm);
     146
     147  //pool_ = new CouenneFPpool (SUM_NINF);
     148  //pool_ = new CouenneFPpool (problem_, INTEGER_VARS);
    148149
    149150  setHeuristicName ("Couenne Feasibility Pump");
Note: See TracChangeset for help on using the changeset viewer.