Changeset 267 for trunk


Ignore:
Timestamp:
Mar 10, 2006 10:11:08 AM (14 years ago)
Author:
forrest
Message:

for nonlinear

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CbcModel.cpp

    r266 r267  
    767767  if (feasible) {
    768768    newNode = new CbcNode ;
    769     double newObjValue = direction*solver_->getObjValue();
    770     if (newObjValue!=solverCharacteristics_->mipBound()) {
    771       newObjValue = CoinMax(newObjValue,solverCharacteristics_->mipBound());
    772       solverCharacteristics_->setMipBound(-COIN_DBL_MAX);
    773     }
    774     newNode->setObjectiveValue(newObjValue);
     769    // Set objective value (not so obvious if NLP etc)
     770    setObjectiveValue(newNode,NULL);
    775771    anyAction = -1 ;
    776772    // To make depth available we may need a fake node
     
    802798    while (anyAction == -1)
    803799    {
    804       newNode->setObjectiveValue(direction*solver_->getObjValue()) ;
     800      // Set objective value (not so obvious if NLP etc)
     801      setObjectiveValue(newNode,NULL);
    805802      if (numberBeforeTrust_==0 ) {
    806803        anyAction = newNode->chooseBranch(this,NULL,numberPassesLeft) ;
     
    12481245        if (feasible) {
    12491246          newNode = new CbcNode ;
    1250           double newObjValue = direction*solver_->getObjValue();
    1251           if (newObjValue!=solverCharacteristics_->mipBound()) {
    1252             newObjValue = CoinMax(newObjValue,solverCharacteristics_->mipBound());
    1253             solverCharacteristics_->setMipBound(-COIN_DBL_MAX);
    1254           }
    1255           newNode->setObjectiveValue(newObjValue);
     1247          // Set objective value (not so obvious if NLP etc)
     1248          setObjectiveValue(newNode,node);
    12561249          anyAction =-1 ;
    12571250          resolved = false ;
     
    12631256          while (anyAction == -1)
    12641257          {
    1265             newNode->setObjectiveValue(direction*solver_->getObjValue()) ;
     1258            // Set objective value (not so obvious if NLP etc)
     1259            setObjectiveValue(newNode,node);
    12661260            if (numberBeforeTrust_==0 ) {
    12671261              anyAction = newNode->chooseBranch(this,node,numberPassesLeft) ;
     
    12931287              }
    12941288              if (feasible)
    1295               { newNode->setObjectiveValue(direction*
    1296                                            solver_->getObjValue()) ;
     1289              {
     1290                // Set objective value (not so obvious if NLP etc)
     1291                setObjectiveValue(newNode,node);
    12971292                reducedCostFix() ;
    1298               if (newNode->objectiveValue() >= getCutoff())
    1299                 anyAction=-2;
     1293                if (newNode->objectiveValue() >= getCutoff())
     1294                  anyAction=-2;
    13001295              }
    13011296              else
     
    21092104  if (feasible) {
    21102105    newNode = new CbcNode ;
    2111     double newObjValue = direction*solver_->getObjValue();
    2112     if (newObjValue!=solverCharacteristics_->mipBound()) {
    2113       newObjValue = CoinMax(newObjValue,solverCharacteristics_->mipBound());
    2114       solverCharacteristics_->setMipBound(-COIN_DBL_MAX);
    2115     }
    2116     newNode->setObjectiveValue(newObjValue);
     2106    // Set objective value (not so obvious if NLP etc)
     2107    setObjectiveValue(newNode,NULL);
    21172108    anyAction = -1 ;
    21182109    // To make depth available we may need a fake node
     
    21442135    while (anyAction == -1)
    21452136    {
    2146       newNode->setObjectiveValue(direction*solver_->getObjValue()) ;
     2137      // Set objective value (not so obvious if NLP etc)
     2138      setObjectiveValue(newNode,NULL);
    21472139      if (numberBeforeTrust_==0 ) {
    21482140        anyAction = newNode->chooseBranch(this,NULL,numberPassesLeft) ;
     
    29062898      if (feasible) {
    29072899        newNode = new CbcNode ;
    2908         double newObjValue = direction*solver_->getObjValue();
    2909         if (newObjValue!=solverCharacteristics_->mipBound()) {
    2910           newObjValue = CoinMin(newObjValue,solverCharacteristics_->mipBound());
    2911           solverCharacteristics_->setMipBound(-COIN_DBL_MAX);
    2912         }
    2913         newNode->setObjectiveValue(newObjValue);
     2900        // Set objective value (not so obvious if NLP etc)
     2901        setObjectiveValue(newNode,node);
    29142902        anyAction =-1 ;
    29152903        resolved = false ;
     
    29212909        OsiSolverBranch * branches=NULL;
    29222910        while (anyAction == -1) {
    2923           newNode->setObjectiveValue(direction*solver_->getObjValue()) ;
     2911          // Set objective value (not so obvious if NLP etc)
     2912          setObjectiveValue(newNode,node);
    29242913          if (numberBeforeTrust_==0 ) {
    29252914            anyAction = newNode->chooseBranch(this,node,numberPassesLeft) ;
     
    29492938            }
    29502939            if (feasible) {
    2951               newNode->setObjectiveValue(direction*solver_->getObjValue()) ;
     2940              // Set objective value (not so obvious if NLP etc)
     2941              setObjectiveValue(newNode,node);
    29522942              reducedCostFix() ;
    29532943              if (newNode->objectiveValue() >= getCutoff())
     
    30583048                    }
    30593049                    if (feasible) {
    3060                       newNode2->setObjectiveValue(direction*solver_->getObjValue()) ;
     3050                      // Set objective value (not so obvious if NLP etc)
     3051                      setObjectiveValue(newNode2,node);
    30613052                      reducedCostFix() ;
    30623053                      if (newNode2->objectiveValue() >= getCutoff())
     
    89818972    strongInfo_[2] ++;
    89828973}
     8974/* Set objective value in a node.  This is separated out so that
     8975   odd solvers can use.  It may look at extra information in
     8976   solverCharacteriscs_ and will also use bound from parent node
     8977*/
     8978void
     8979CbcModel::setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode)
     8980{
     8981  double newObjValue = solver_->getObjSense()*solver_->getObjValue();
     8982  // If odd solver take its bound
     8983  newObjValue = CoinMax(newObjValue,solverCharacteristics_->mipBound());
     8984  // Reset bound anyway (no harm if not odd)
     8985  solverCharacteristics_->setMipBound(-COIN_DBL_MAX);
     8986  // If not root then use max of this and parent
     8987  if (parentNode)
     8988    newObjValue = CoinMax(newObjValue,parentNode->objectiveValue());
     8989  thisNode->setObjectiveValue(newObjValue);
     8990}
  • trunk/CbcNode.cpp

    r264 r267  
    99//#define CHECK_CUT_COUNTS
    1010//#define CHECK_NODE
     11#define CBC_WEAK_STRONG
    1112#include <cassert>
    1213#include <cfloat>
  • trunk/include/CbcModel.hpp

    r265 r267  
    14041404  */
    14051405  void addCuts1(CbcNode * node, CoinWarmStartBasis *&lastws);
     1406  /** Set objective value in a node.  This is separated out so that
     1407     odd solvers can use.  It may look at extra information in
     1408     solverCharacteriscs_ and will also use bound from parent node
     1409  */
     1410  void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode);
    14061411
    14071412  /** If numberBeforeTrust >0 then we are going to use CbcBranchDynamic.
Note: See TracChangeset for help on using the changeset viewer.