Changeset 136


Ignore:
Timestamp:
May 23, 2009 7:57:06 AM (13 years ago)
Author:
pbelotti
Message:

added context flag for CouenneSolverInterface::resolve -- check for feasible solutions when in normal resolve, not in strong branching or OBBT. Still struggling with SOS

Location:
trunk/Couenne/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/bound_tightening/obbt.cpp

    r131 r136  
    164164
    165165    csi -> setupForRepeatedUse ();
     166    csi -> doingResolve () = false;
     167
    166168    //csi -> setHintParam (OsiDoDualInResolve, false);
    167169
     
    197199    }
    198200
     201    csi -> doingResolve () = true;
     202
    199203    delete csi;
    200204
  • trunk/Couenne/src/branch/CouenneChooseStrong.hpp

    r1 r136  
    1717// Forward declaration
    1818class CouenneProblem;
     19class CouenneSolverInterface;
    1920
    2021namespace Bonmin {
     
    5455         3 - returning because max time
    5556    */
    56     virtual int doStrongBranching( OsiSolverInterface * solver,
     57    virtual int doStrongBranching( CouenneSolverInterface * solver,
    5758                                   OsiBranchingInformation *info,
    5859                                   int numberToDo, int returnCriterion);
  • trunk/Couenne/src/branch/doStrongBranching.cpp

    r39 r136  
    1313#include "CouenneProblem.hpp"
    1414#include "CouenneBranchingObject.hpp"
     15#include "CouenneSolverInterface.hpp"
    1516
    1617/// compute Euclidean distance between two points (most likely LP solutions)
     
    5455       3 - returning because max time
    5556  */
    56   int CouenneChooseStrong::doStrongBranching (OsiSolverInterface * solver,
     57  int CouenneChooseStrong::doStrongBranching (CouenneSolverInterface * solver,
    5758                                              OsiBranchingInformation *info,
    5859                                              int numberToDo, int returnCriterion)
     
    6162    jnlst_ -> Printf (J_ITERSUMMARY, J_BRANCHING,
    6263                      "\n-\n------- CCS: trying %d objects:\n", numberToDo);
     64
     65    solver -> doingResolve () = false; // turns off setCutoff and restoreUnused
    6366
    6467    int numberColumns = solver -> getNumCols ();
     
    367370    solver -> unmarkHotStart ();     // Delete the snapshot
    368371
     372    solver -> doingResolve () = true;
     373
    369374    return returnCode;
    370375  }
  • trunk/Couenne/src/convex/generateCuts.cpp

    r131 r136  
    100100      *ub  = si.getColUpper ();
    101101
    102     for (int i=problem_ -> nVars (); i--; opt++, lb++, ub++)
    103       if ((*opt < *lb - COUENNE_EPS) ||
    104           (*opt > *ub + COUENNE_EPS)) {
     102    int objind = problem_ -> Obj (0) -> Body () -> Index ();
     103
     104    for (int j=0, i=problem_ -> nVars (); i--; j++, opt++, lb++, ub++)
     105      if ((j != objind) &&
     106          ((*opt < *lb - COUENNE_EPS * (1 + CoinMin (fabs (*opt), fabs (*lb)))) ||
     107           (*opt > *ub + COUENNE_EPS * (1 + CoinMin (fabs (*opt), fabs (*ub)))))) {
     108       
    105109        jnlst_ -> Printf (J_VECTOR, J_CONVEXIFYING,
    106110                          "out of bounds, ignore x%d = %g [%g,%g] opt = %g\n",
  • trunk/Couenne/src/main/BonCouenneSetup.cpp

    r85 r136  
    176176   
    177177    extraStuff = dynamic_cast <Bonmin::BabInfo *> (continuousSolver_ -> getAuxiliaryInfo ());
    178    
     178
    179179    /* Setup log level*/
    180180    int lpLogLevel;
     
    229229
    230230      nSOS = couenneProb -> findSOS (nonlinearSolver (), objects);
     231
     232      nonlinearSolver () -> addObjects (nSOS, objects);
     233
    231234      //printf ("==================== found %d SOS\n", nSOS);
    232235      //nonlinearSolver () -> addObjects (nSOS, objects);
  • trunk/Couenne/src/problem/CouenneSOS.cpp

    r126 r136  
    123123      // TODO: if use Cbc, add CbcSOSBranchingObject
    124124
    125       CouenneSOSObject *newsos = new CouenneSOSObject (solver, nelem, indices, NULL, 1,
    126                                                        jnlst_, true, true);
     125      /*CouenneSOSObject *newsos = new CouenneSOSObject (solver, nelem, indices, NULL, 1,
     126        jnlst_, true, true);*/
     127
     128      OsiSOS *newsos = new OsiSOS (solver, nelem, indices, NULL, 1);
    127129
    128130      objects [nSOS] = newsos;
  • trunk/Couenne/src/problem/CouenneSolverInterface.cpp

    r129 r136  
    2020  cutgen_ (cg),
    2121  knowInfeasible_(false),
    22   knowOptimal_(false) {
     22  knowOptimal_(false),
     23  doingResolve_ (true) {
    2324
    2425  // prevents from running OsiClpSolverInterface::tightenBounds()
     
    2930CouenneSolverInterface::CouenneSolverInterface (const CouenneSolverInterface &src):
    3031
    31   OsiSolverInterface (src),
     32  OsiSolverInterface    (src),
    3233  OsiClpSolverInterface (src),
    33   cutgen_ (src.cutgen_),
    34   knowInfeasible_ (src.knowInfeasible_),
    35   knowOptimal_ (src.knowOptimal_) {}
     34  cutgen_               (src.cutgen_),
     35  knowInfeasible_       (src.knowInfeasible_),
     36  knowOptimal_          (src.knowOptimal_),
     37  doingResolve_         (src.doingResolve_) {}
    3638
    3739/// Destructor
     
    153155
    154156  // check if resolve found new integer solution
    155   if (isProvenOptimal () &&
     157  if (doingResolve () &&                 // this is not called from strong branching
     158      isProvenOptimal () &&
    156159      (objval < curCutoff - COUENNE_EPS) &&
    157160      (cutgen_ -> Problem () -> checkNLP (getColSolution (), objval, true)) &&
    158161      (objval < curCutoff - COUENNE_EPS) && // check again as it may have changed
    159       (objval > -COUENNE_INFINITY/2)) { // check if it makes sense
     162      (objval > -COUENNE_INFINITY/2)) {    // check if it makes sense
    160163
    161164    // also save the solution so that cbcModel::setBestSolution saves it too
  • trunk/Couenne/src/problem/CouenneSolverInterface.hpp

    r103 r136  
    8787  {return continuousModel_;}
    8888
    89 private:
     89  /// set doingResolve_
     90  bool &doingResolve ()
     91  {return doingResolve_;}
     92
     93protected:
    9094
    9195  /// The pointer to the Couenne cut generator. Gives us a lot of
     
    99103  /// Flag indicating that optimality was detected during solveFromHotStart
    100104  bool knowOptimal_;
     105
     106  /// flag to indicate this is an LP for the BB, not for (e.g.) strong
     107  /// branching or OBBT
     108  bool doingResolve_;
    101109};
    102110
Note: See TracChangeset for help on using the changeset viewer.