# CbcNode.hpp

Go to the documentation of this file.

    00001 /* $Id: CbcNode.hpp 1573 2011-01-05 01:12:36Z lou $ */
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005
    00006 #ifndef CbcNode_H
    00007 #define CbcNode_H
    00008
    00009 #include <string>
    00010 #include <vector>
    00011
    00012 #include "CoinWarmStartBasis.hpp"
    00013 #include "CoinSearchTree.hpp"
    00014 #include "CbcBranchBase.hpp"
    00015 #include "CbcNodeInfo.hpp"
    00016 #include "CbcFullNodeInfo.hpp"
    00017 #include "CbcPartialNodeInfo.hpp"
    00018
    00019 class OsiSolverInterface;
    00020 class OsiSolverBranch;
    00021
    00022 class OsiCuts;
    00023 class OsiRowCut;
    00024 class OsiRowCutDebugger;
    00025 class CoinWarmStartBasis;
    00026 class CbcCountRowCut;
    00027 class CbcModel;
    00028 class CbcNode;
    00029 class CbcSubProblem;
    00030 class CbcGeneralBranchingObject;
    00031
    00049 class CbcNode : public CoinTreeNode {
    00050
    00051 public:
    00052
    00054     CbcNode ();
    00055
    00057     CbcNode (CbcModel * model, CbcNode * lastNode);
    00058
    00060     CbcNode (const CbcNode &);
    00061
    00063     CbcNode & operator= (const CbcNode& rhs);
    00064
    00066     ~CbcNode ();
    00067
    00083     void
    00084     createInfo(CbcModel * model,
    00085                CbcNode * lastNode,
    00086                const CoinWarmStartBasis *lastws,
    00087                const double * lastLower, const double * lastUpper,
    00088                int numberOldActiveCuts, int numberNewCuts);
    00089
    00110     int chooseBranch (CbcModel * model,
    00111                       CbcNode * lastNode,
    00112                       int numberPassesLeft);
    00138     int chooseDynamicBranch (CbcModel * model,
    00139                              CbcNode * lastNode,
    00140                              OsiSolverBranch * & branches,
    00141                              int numberPassesLeft);
    00168     int chooseOsiBranch (CbcModel * model,
    00169                          CbcNode * lastNode,
    00170                          OsiBranchingInformation * usefulInfo,
    00171                          int branchState);
    00187     int chooseClpBranch (CbcModel * model,
    00188                          CbcNode * lastNode);
    00189     int analyze(CbcModel * model, double * results);
    00191     void decrementCuts(int change = 1);
    00192
    00194     void decrementParentCuts(CbcModel * model, int change = 1);
    00195
    00197     void nullNodeInfo();
    00206     void initializeInfo();
    00207
    00209     int branch(OsiSolverInterface * solver);
    00210
    00214     double checkIsCutoff(double cutoff);
    00215     // Information to make basis and bounds
    00216     inline CbcNodeInfo * nodeInfo() const {
    00217         return nodeInfo_;
    00218     }
    00219
    00220     // Objective value
    00221     inline double objectiveValue() const {
    00222         return objectiveValue_;
    00223     }
    00224     inline void setObjectiveValue(double value) {
    00225         objectiveValue_ = value;
    00226     }
    00228     inline int numberBranches() const {
    00229         if (branch_)
    00230             return (branch_->numberBranches()) ;
    00231         else
    00232             return (-1) ;
    00233     }
    00234
    00235     /* Active arm of the attached OsiBranchingObject.
    00236
    00237      In the simplest instance, coded -1 for the down arm of the branch, +1 for
    00238      the up arm. But see OsiBranchingObject::way()
    00239        Use nodeInfo--.numberBranchesLeft_ to see how active
    00240     */
    00241     int way() const;
    00243     inline int depth() const {
    00244         return depth_;
    00245     }
    00247     inline void setDepth(int value) {
    00248         depth_ = value;
    00249     }
    00251     inline int numberUnsatisfied() const {
    00252         return numberUnsatisfied_;
    00253     }
    00255     inline void setNumberUnsatisfied(int value) {
    00256         numberUnsatisfied_ = value;
    00257     }
    00259     inline double sumInfeasibilities() const {
    00260         return sumInfeasibilities_;
    00261     }
    00263     inline void setSumInfeasibilities(double value) {
    00264         sumInfeasibilities_ = value;
    00265     }
    00266     // Guessed objective value (for solution)
    00267     inline double guessedObjectiveValue() const {
    00268         return guessedObjectiveValue_;
    00269     }
    00270     inline void setGuessedObjectiveValue(double value) {
    00271         guessedObjectiveValue_ = value;
    00272     }
    00274     inline const OsiBranchingObject * branchingObject() const {
    00275         return branch_;
    00276     }
    00278     inline OsiBranchingObject * modifiableBranchingObject() const {
    00279         return branch_;
    00280     }
    00282     inline void setBranchingObject(OsiBranchingObject * branchingObject) {
    00283         branch_ = branchingObject;
    00284     }
    00286     inline int nodeNumber() const {
    00287         return nodeNumber_;
    00288     }
    00289     inline void setNodeNumber(int node) {
    00290         nodeNumber_ = node;
    00291     }
    00293     inline bool onTree() const {
    00294         return (state_&1) != 0;
    00295     }
    00297     inline void setOnTree(bool yesNo) {
    00298         if (yesNo) state_ |= 1;
    00299         else state_ &= ~1;
    00300     }
    00302     inline bool active() const {
    00303         return (state_&2) != 0;
    00304     }
    00306     inline void setActive(bool yesNo) {
    00307         if (yesNo) state_ |= 2;
    00308         else state_ &= ~2;
    00309     }
    00311     void print() const;
    00313     inline void checkInfo() const {
    00314         assert (nodeInfo_->numberBranchesLeft() ==
    00315                 branch_->numberBranchesLeft());
    00316     }
    00317
    00318 private:
    00319     // Data
    00321     CbcNodeInfo * nodeInfo_;
    00323     double objectiveValue_;
    00325     double guessedObjectiveValue_;
    00327     double sumInfeasibilities_;
    00329     OsiBranchingObject * branch_;
    00331     int depth_;
    00333     int numberUnsatisfied_;
    00335     int nodeNumber_;
    00340     int state_;
    00341 };
    00342
    00343
    00344 #endif
    00345

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines