/home/coin/SVN-release/Bcp-1.2.3/Clp/src/ClpNode.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2008, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef ClpNode_H
00004 #define ClpNode_H
00005 
00006 #include "CoinPragma.hpp"
00007 
00008 // This implements all stuff for Clp fathom
00013 class ClpFactorization;
00014 class ClpDualRowSteepest;
00015 class ClpNodeStuff;
00016 class ClpNode {
00017   
00018 public:
00026   void applyNode(ClpSimplex * model, int doBoundsEtc );
00028   void chooseVariable(ClpSimplex * model, ClpNodeStuff * info);
00030   int fixOnReducedCosts(ClpSimplex * model);
00032   void createArrays(ClpSimplex * model);
00034   void cleanUpForCrunch();
00036   
00039 
00040   inline double objectiveValue() const
00041   { return objectiveValue_;}
00043   inline void setObjectiveValue(double value)
00044   { objectiveValue_=value;}
00046   inline const double * primalSolution() const
00047   { return primalSolution_;}
00049   inline const double * dualSolution() const
00050   { return dualSolution_;}
00052   inline double branchingValue() const
00053   { return branchingValue_;}
00055   inline double sumInfeasibilities() const
00056   { return sumInfeasibilities_;}
00058   inline int numberInfeasibilities() const
00059   { return numberInfeasibilities_;}
00061   inline int depth() const
00062   { return depth_;}
00064   inline double estimatedSolution() const
00065   { return estimatedSolution_;}
00067   int way() const;
00069   bool fathomed() const;
00071   void changeState();
00073   inline int sequence() const
00074   { return sequence_;}
00076   inline bool oddArraysExist() const
00077   { return lower_!=NULL;}
00079   inline const unsigned char * statusArray() const 
00080   { return status_; }
00082   
00086   ClpNode();
00088   ClpNode (ClpSimplex * model, const ClpNodeStuff * stuff,int depth);
00090   void gutsOfConstructor(ClpSimplex * model, const ClpNodeStuff * stuff,
00091                          int arraysExist,int depth);
00093   virtual ~ClpNode();
00095   
00099   ClpNode(const ClpNode&);
00101   ClpNode& operator=(const ClpNode&);
00103   
00104 protected:
00105 // For state of branch
00106 typedef struct {
00107   unsigned int firstBranch:1; //  nonzero if first branch on variable is up
00108   unsigned int branch:2; //  0 means do first branch next, 1 second, 2 finished
00109   unsigned int spare:29;
00110 } branchState;
00113 
00114   double branchingValue_;
00116   double objectiveValue_;
00118   double sumInfeasibilities_;
00120   double estimatedSolution_;
00122   ClpFactorization * factorization_;
00124   ClpDualRowSteepest * weights_;
00126   unsigned char * status_;
00128   double * primalSolution_;
00130   double * dualSolution_;
00132   int * lower_;
00134   int * upper_;
00136   int * pivotVariables_;
00138   int * fixed_;
00140   branchState branchState_;
00142   int sequence_;
00144   int numberInfeasibilities_;
00146   int depth_;
00148   int numberFixed_;
00150   int flags_;
00152   int maximumFixed_;
00154   int maximumRows_;
00156   int maximumColumns_;
00158   int maximumIntegers_;
00160 };
00161 class ClpNodeStuff {
00162   
00163 public:
00167   ClpNodeStuff();
00169   virtual ~ClpNodeStuff();
00171   
00175   ClpNodeStuff(const ClpNodeStuff&);
00177   ClpNodeStuff& operator=(const ClpNodeStuff&);
00179   void zap(int type);
00181   
00182   
00186   void fillPseudoCosts(const double * down, const double * up, 
00187                        const int * numberDown, const int * numberUp,
00188                        const int * numberDownInfeasible, const int * numberUpInfeasible,
00189                        int number);
00191   void update(int way,int sequence,double change,bool feasible);
00193   int maximumNodes() const;
00195   int maximumSpace() const;
00197   
00198 public:
00201 
00202   double integerTolerance_;
00204   double integerIncrement_;
00206   double * downPseudo_;
00208   double * upPseudo_;
00210   int * numberDown_;
00212   int * numberUp_;
00214   int * numberDownInfeasible_;
00216   int * numberUpInfeasible_;
00218   double * saveCosts_;
00220   ClpNode ** nodeInfo_;
00222   ClpSimplex * large_;
00224   int * whichRow_;
00226   int * whichColumn_;
00228   int nBound_;
00230   int saveOptions_;
00239   int solverOptions_;
00241   int maximumNodes_;
00243   int nDepth_;
00245   int nNodes_;
00247   int numberNodesExplored_;
00249   int numberIterations_;
00251   int presolveType_;
00253 };
00254 class ClpHashValue {
00255   
00256 public:
00259 
00260   int index(double value) const;
00262   int addValue(double value) ;
00264   inline int numberEntries() const
00265   { return numberHash_;}
00267 
00271   ClpHashValue();
00273   ClpHashValue(ClpSimplex * model);
00275   virtual ~ClpHashValue();
00277   
00281   ClpHashValue(const ClpHashValue&);
00283   ClpHashValue& operator=(const ClpHashValue&);
00285 private:
00289   int hash(double value) const;
00291   void resize(bool increaseMax);
00293     
00294 protected:
00298 
00299   // for hashing
00300   typedef struct {
00301     double value;
00302     int index, next;
00303   } CoinHashLink;
00305   mutable CoinHashLink *hash_;
00307   int numberHash_;
00309   int maxHash_;
00311   int lastUsed_;
00313 };
00314 #endif

Generated on Thu Oct 8 03:12:38 2009 for coin-Bcp by  doxygen 1.4.7