Changeset 2164


Ignore:
Timestamp:
Mar 17, 2015 4:33:10 AM (4 years ago)
Author:
forrest
Message:

fix for when heuristics too good - Cbc says infeasible

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcModel.cpp

    r2146 r2164  
    20892089        }
    20902090        originalContinuousObjective_ = COIN_DBL_MAX;
     2091        if (bestSolution_ &&
     2092            ((specialOptions_&8388608)==0||(specialOptions_&2048)!=0)) {
     2093          // best solution found by various heuristics - set solution
     2094          char general[200];
     2095          sprintf(general,"Solution of %g already found by heuristic",
     2096                  bestObjective_);
     2097          messageHandler()->message(CBC_GENERAL,
     2098                                    messages())
     2099            << general << CoinMessageEol ;
     2100          setCutoff(1.0e50) ; // As best solution should be worse than cutoff
     2101          // change cutoff as constraint if wanted
     2102          if (cutoffRowNumber_>=0) {
     2103            if (solver_->getNumRows()>cutoffRowNumber_)
     2104              solver_->setRowUpper(cutoffRowNumber_,1.0e50);
     2105          }
     2106          // also in continuousSolver_
     2107          if (continuousSolver_) {
     2108            // Solvers know about direction
     2109            double direction = solver_->getObjSense();
     2110            continuousSolver_->setDblParam(OsiDualObjectiveLimit, 1.0e50*direction);
     2111          } else {
     2112            continuousSolver_ = solver_->clone();
     2113          }
     2114          phase_ = 5;
     2115          double increment = getDblParam(CbcModel::CbcCutoffIncrement) ;
     2116          if ((specialOptions_&4) == 0)
     2117            bestObjective_ += 100.0 * increment + 1.0e-3; // only set if we are going to solve
     2118          setBestSolution(CBC_END_SOLUTION, bestObjective_, bestSolution_, 1) ;
     2119          continuousSolver_->resolve() ;
     2120          if (!continuousSolver_->isProvenOptimal()) {
     2121            continuousSolver_->messageHandler()->setLogLevel(2) ;
     2122            continuousSolver_->initialSolve() ;
     2123          }
     2124          delete solver_ ;
     2125          solver_ = continuousSolver_ ;
     2126          setPointers(solver_);
     2127          continuousSolver_ = NULL ;
     2128        }
    20912129        solverCharacteristics_ = NULL;
    20922130        if (flipObjective)
Note: See TracChangeset for help on using the changeset viewer.