Changeset 268 for trunk


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

for nonlinear

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CbcModel.cpp

    r267 r268  
    89778977*/
    89788978void
    8979 CbcModel::setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode)
     8979CbcModel::setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const
    89808980{
    89818981  double newObjValue = solver_->getObjSense()*solver_->getObjValue();
    89828982  // 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);
     8983  if (solverCharacteristics_) {
     8984    newObjValue = CoinMax(newObjValue,solverCharacteristics_->mipBound());
     8985    // Reset bound anyway (no harm if not odd)
     8986    solverCharacteristics_->setMipBound(-COIN_DBL_MAX);
     8987  }
    89868988  // If not root then use max of this and parent
    89878989  if (parentNode)
  • trunk/CbcNode.cpp

    r267 r268  
    670670  printf("CbcNode %x Constructor from model\n",this);
    671671#endif
    672   OsiSolverInterface * solver = model->solver();
    673   objectiveValue_ = solver->getObjSense()*solver->getObjValue();
     672  model->setObjectiveValue(this,lastNode);
    674673
    675674  if (lastNode)
     
    875874  OsiSolverInterface * solver = model->solver();
    876875  double saveObjectiveValue = solver->getObjValue();
    877   double objectiveValue = solver->getObjSense()*saveObjectiveValue;
    878   assert (objectiveValue_==objectiveValue);
     876  double objectiveValue = CoinMax(solver->getObjSense()*saveObjectiveValue,objectiveValue_);
    879877  const double * lower = solver->getColLower();
    880878  const double * upper = solver->getColUpper();
     
    13881386            choice[i].numItersDown = 0;
    13891387          }
    1390           objectiveChange = newObjectiveValue-objectiveValue_ ;
    13911388        } else {
    13921389          iStatus = outputStuff[2*i];
     
    13971394          solver->setColSolution(outputSolution[2*i]);
    13981395        }
    1399         objectiveChange = newObjectiveValue  - objectiveValue_;
     1396        objectiveChange = CoinMax(newObjectiveValue  - objectiveValue_,0.0);
    14001397        if (!iStatus) {
    14011398          choice[i].finishedDown = true ;
     
    14131410              // only needed for odd solvers
    14141411              newObjectiveValue = solver->getObjSense()*solver->getObjValue();
    1415               objectiveChange = newObjectiveValue-objectiveValue_ ;
     1412              objectiveChange = CoinMax(newObjectiveValue-objectiveValue_,0.0) ;
    14161413              model->setLastHeuristic(NULL);
    14171414              model->incrementUsed(solver->getColSolution());
     
    14921489            choice[i].numItersDown = 0;
    14931490          }
    1494           objectiveChange = newObjectiveValue-objectiveValue_ ;
    14951491        } else {
    14961492          iStatus = outputStuff[2*i+1];
     
    15011497          solver->setColSolution(outputSolution[2*i+1]);
    15021498        }
    1503         objectiveChange = newObjectiveValue  - objectiveValue_;
     1499        objectiveChange = CoinMax(newObjectiveValue  - objectiveValue_,0.0);
    15041500        if (!iStatus) {
    15051501          choice[i].finishedUp = true ;
     
    15171513              // only needed for odd solvers
    15181514              newObjectiveValue = solver->getObjSense()*solver->getObjValue();
    1519               objectiveChange = newObjectiveValue-objectiveValue_ ;
     1515              objectiveChange = CoinMax(newObjectiveValue-objectiveValue_,0.0) ;
    15201516              model->setLastHeuristic(NULL);
    15211517              model->incrementUsed(solver->getColSolution());
     
    26322628          newObjectiveValue = solver->getObjSense()*solver->getObjValue();
    26332629          choice.numItersDown = solver->getIterationCount();
    2634           objectiveChange = newObjectiveValue  - objectiveValue_;
     2630          objectiveChange = CoinMax(newObjectiveValue  - objectiveValue_,0.0);
    26352631          decision->updateInformation( solver,this);
    26362632          if (!iStatus) {
     
    26542650                  solver->resolve();
    26552651                  newObjectiveValue = solver->getObjSense()*solver->getObjValue();
    2656                   objectiveChange = newObjectiveValue  - objectiveValue_;
     2652                  objectiveChange = CoinMax(newObjectiveValue  - objectiveValue_,0.0);
    26572653                  model->feasibleSolution(choice.numIntInfeasDown,
    26582654                                          choice.numObjInfeasDown);
     
    27302726          newObjectiveValue = solver->getObjSense()*solver->getObjValue();
    27312727          choice.numItersUp = solver->getIterationCount();
    2732           objectiveChange = newObjectiveValue  - objectiveValue_;
     2728          objectiveChange = CoinMax(newObjectiveValue  - objectiveValue_,0.0);
    27332729          decision->updateInformation( solver,this);
    27342730          if (!iStatus) {
     
    27522748                  solver->resolve();
    27532749                  newObjectiveValue = solver->getObjSense()*solver->getObjValue();
    2754                   objectiveChange = newObjectiveValue  - objectiveValue_;
     2750                  objectiveChange = CoinMax(newObjectiveValue  - objectiveValue_,0.0);
    27552751                  model->feasibleSolution(choice.numIntInfeasDown,
    27562752                                          choice.numObjInfeasDown);
  • trunk/include/CbcModel.hpp

    r267 r268  
    14081408     solverCharacteriscs_ and will also use bound from parent node
    14091409  */
    1410   void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode);
     1410  void setObjectiveValue(CbcNode * thisNode, const CbcNode * parentNode) const;
    14111411
    14121412  /** If numberBeforeTrust >0 then we are going to use CbcBranchDynamic.
Note: See TracChangeset for help on using the changeset viewer.