CbcGeneralDepth.hpp

Go to the documentation of this file.
00001 // $Id: CbcGeneralDepth.hpp 1902 2013-04-10 16:58:16Z stefan $
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 // Edwin 11/10/2009-- carved out of CbcBranchActual
00007 
00008 #ifndef CbcGeneralDepth_H
00009 #define CbcGeneralDepth_H
00010 
00011 #include "CbcGeneral.hpp"
00012 #include "CbcBranchBase.hpp"
00013 #include "CbcSubProblem.hpp"
00014 
00015 #ifdef COIN_HAS_CLP
00016 
00020 #include "ClpSimplex.hpp"
00021 #include "ClpNode.hpp"
00022 
00023 
00024 class CbcGeneralDepth : public CbcGeneral {
00025 
00026 public:
00027 
00028     // Default Constructor
00029     CbcGeneralDepth ();
00030 
00037     CbcGeneralDepth (CbcModel * model, int maximumDepth);
00038 
00039     // Copy constructor
00040     CbcGeneralDepth ( const CbcGeneralDepth &);
00041 
00043     virtual CbcObject * clone() const;
00044 
00045     // Assignment operator
00046     CbcGeneralDepth & operator=( const CbcGeneralDepth& rhs);
00047 
00048     // Destructor
00049     ~CbcGeneralDepth ();
00050 
00052     virtual double infeasibility(const OsiBranchingInformation * info,
00053                                  int &preferredWay) const;
00054 
00055     using CbcObject::feasibleRegion ;
00057     virtual void feasibleRegion();
00058 
00060     virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
00062     inline int maximumNodes() const {
00063         return maximumNodes_;
00064     }
00066     inline int maximumDepth() const {
00067         return maximumDepth_;
00068     }
00070     inline void setMaximumDepth(int value) {
00071         maximumDepth_ = value;
00072     }
00074     inline int numberNodes() const {
00075         return numberNodes_;
00076     }
00078     inline int whichSolution() const {
00079         return whichSolution_;
00080     }
00082     inline ClpNode * nodeInfo(int which) {
00083         return nodeInfo_->nodeInfo_[which];
00084     }
00085 
00087     virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
00088 
00089 protected:
00092     int maximumDepth_;
00094     int maximumNodes_;
00096     mutable int whichSolution_;
00098     mutable int numberNodes_;
00100     mutable ClpNodeStuff * nodeInfo_;
00101 };
00105 class CbcNode;
00106 class CbcGeneralBranchingObject : public CbcBranchingObject {
00107 
00108 public:
00109 
00110     // Default Constructor
00111     CbcGeneralBranchingObject ();
00112 
00113     // Useful constructor
00114     CbcGeneralBranchingObject (CbcModel * model);
00115 
00116     // Copy constructor
00117     CbcGeneralBranchingObject ( const CbcGeneralBranchingObject &);
00118 
00119     // Assignment operator
00120     CbcGeneralBranchingObject & operator=( const CbcGeneralBranchingObject& rhs);
00121 
00123     virtual CbcBranchingObject * clone() const;
00124 
00125     // Destructor
00126     virtual ~CbcGeneralBranchingObject ();
00127 
00128     using CbcBranchingObject::branch ;
00130     virtual double branch();
00133     virtual void checkIsCutoff(double cutoff);
00134 
00135     using CbcBranchingObject::print ;
00138     virtual void print();
00140     void state(double & objectiveValue, double & sumInfeasibilities,
00141                int & numberUnsatisfied, int which) const;
00143     inline void setNode(CbcNode * node) {
00144         node_ = node;
00145     }
00147     virtual CbcBranchObjType type() const {
00148         return GeneralDepthBranchObj;
00149     }
00150 
00158     virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
00159 
00168     virtual CbcRangeCompare compareBranchingObject
00169     (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00171     inline int numberSubProblems() const {
00172         return numberSubProblems_;
00173     }
00175     inline int decrementNumberLeft() {
00176         numberSubLeft_--;
00177         return numberSubLeft_;
00178     }
00180     inline int whichNode() const {
00181         return whichNode_;
00182     }
00184     inline void setWhichNode(int value) {
00185         whichNode_ = value;
00186     }
00187     // Sub problem
00188     const CbcSubProblem * subProblem(int which) const {
00189         return subProblems_ + which;
00190     }
00191 
00192 public:
00194     // Sub problems
00195     CbcSubProblem * subProblems_;
00197     CbcNode * node_;
00199     int numberSubProblems_;
00201     int numberSubLeft_;
00203     int whichNode_;
00205     int numberRows_;
00206 };
00210 class CbcOneGeneralBranchingObject : public CbcBranchingObject {
00211 
00212 public:
00213 
00214     // Default Constructor
00215     CbcOneGeneralBranchingObject ();
00216 
00217     // Useful constructor
00218     CbcOneGeneralBranchingObject (CbcModel * model,
00219                                   CbcGeneralBranchingObject * object,
00220                                   int whichOne);
00221 
00222     // Copy constructor
00223     CbcOneGeneralBranchingObject ( const CbcOneGeneralBranchingObject &);
00224 
00225     // Assignment operator
00226     CbcOneGeneralBranchingObject & operator=( const CbcOneGeneralBranchingObject& rhs);
00227 
00229     virtual CbcBranchingObject * clone() const;
00230 
00231     // Destructor
00232     virtual ~CbcOneGeneralBranchingObject ();
00233 
00234     using CbcBranchingObject::branch ;
00236     virtual double branch();
00239     virtual void checkIsCutoff(double cutoff);
00240 
00241     using CbcBranchingObject::print ;
00244     virtual void print();
00246     virtual CbcBranchObjType type() const {
00247         return OneGeneralBranchingObj;
00248     }
00249 
00257     virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
00258 
00267     virtual CbcRangeCompare compareBranchingObject
00268     (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00269 
00270 public:
00273     CbcGeneralBranchingObject * object_;
00275     int whichOne_;
00276 };
00277 #endif //COIN_HAS_CLP
00278 #endif
00279 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 28 Jan 2014 for Cbc by  doxygen 1.6.1