- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Cgl-0.55.0/Clp/src/ClpNode.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpNode.hpp 1430 2009-09-15 15:51:17Z forrest $ */
    00002 // Copyright (C) 2008, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 #ifndef ClpNode_H
    00005 #define ClpNode_H
    00006
    00007 #include "CoinPragma.hpp"
    00008
    00009 // This implements all stuff for Clp fathom
    00014 class ClpFactorization;
    00015 class ClpDualRowSteepest;
    00016 class ClpNodeStuff;
    00017 class ClpNode {
    00018
    00019 public:
    00027   void applyNode(ClpSimplex * model, int doBoundsEtc );
    00029   void chooseVariable(ClpSimplex * model, ClpNodeStuff * info);
    00031   int fixOnReducedCosts(ClpSimplex * model);
    00033   void createArrays(ClpSimplex * model);
    00035   void cleanUpForCrunch();
    00037
    00040
    00041   inline double objectiveValue() const
    00042   { return objectiveValue_;}
    00044   inline void setObjectiveValue(double value)
    00045   { objectiveValue_=value;}
    00047   inline const double * primalSolution() const
    00048   { return primalSolution_;}
    00050   inline const double * dualSolution() const
    00051   { return dualSolution_;}
    00053   inline double branchingValue() const
    00054   { return branchingValue_;}
    00056   inline double sumInfeasibilities() const
    00057   { return sumInfeasibilities_;}
    00059   inline int numberInfeasibilities() const
    00060   { return numberInfeasibilities_;}
    00062   inline int depth() const
    00063   { return depth_;}
    00065   inline double estimatedSolution() const
    00066   { return estimatedSolution_;}
    00068   int way() const;
    00070   bool fathomed() const;
    00072   void changeState();
    00074   inline int sequence() const
    00075   { return sequence_;}
    00077   inline bool oddArraysExist() const
    00078   { return lower_!=NULL;}
    00080   inline const unsigned char * statusArray() const
    00081   { return status_; }
    00083
    00087   ClpNode();
    00089   ClpNode (ClpSimplex * model, const ClpNodeStuff * stuff,int depth);
    00091   void gutsOfConstructor(ClpSimplex * model, const ClpNodeStuff * stuff,
    00092                          int arraysExist,int depth);
    00094   virtual ~ClpNode();
    00096
    00100   ClpNode(const ClpNode&);
    00102   ClpNode& operator=(const ClpNode&);
    00104
    00105 protected:
    00106 // For state of branch
    00107 typedef struct {
    00108   unsigned int firstBranch:1; //  nonzero if first branch on variable is up
    00109   unsigned int branch:2; //  0 means do first branch next, 1 second, 2 finished
    00110   unsigned int spare:29;
    00111 } branchState;
    00114
    00115   double branchingValue_;
    00117   double objectiveValue_;
    00119   double sumInfeasibilities_;
    00121   double estimatedSolution_;
    00123   ClpFactorization * factorization_;
    00125   ClpDualRowSteepest * weights_;
    00127   unsigned char * status_;
    00129   double * primalSolution_;
    00131   double * dualSolution_;
    00133   int * lower_;
    00135   int * upper_;
    00137   int * pivotVariables_;
    00139   int * fixed_;
    00141   branchState branchState_;
    00143   int sequence_;
    00145   int numberInfeasibilities_;
    00147   int depth_;
    00149   int numberFixed_;
    00151   int flags_;
    00153   int maximumFixed_;
    00155   int maximumRows_;
    00157   int maximumColumns_;
    00159   int maximumIntegers_;
    00161 };
    00162 class ClpNodeStuff {
    00163
    00164 public:
    00168   ClpNodeStuff();
    00170   virtual ~ClpNodeStuff();
    00172
    00176   ClpNodeStuff(const ClpNodeStuff&);
    00178   ClpNodeStuff& operator=(const ClpNodeStuff&);
    00180   void zap(int type);
    00182
    00183
    00187   void fillPseudoCosts(const double * down, const double * up,
    00188                        const int * priority,
    00189                        const int * numberDown, const int * numberUp,
    00190                        const int * numberDownInfeasible, const int * numberUpInfeasible,
    00191                        int number);
    00193   void update(int way,int sequence,double change,bool feasible);
    00195   int maximumNodes() const;
    00197   int maximumSpace() const;
    00199
    00200 public:
    00203
    00204   double integerTolerance_;
    00206   double integerIncrement_;
    00208   double smallChange_;
    00210   double * downPseudo_;
    00212   double * upPseudo_;
    00214   int * priority_;
    00216   int * numberDown_;
    00218   int * numberUp_;
    00220   int * numberDownInfeasible_;
    00222   int * numberUpInfeasible_;
    00224   double * saveCosts_;
    00226   ClpNode ** nodeInfo_;
    00228   ClpSimplex * large_;
    00230   int * whichRow_;
    00232   int * whichColumn_;
    00234   int nBound_;
    00236   int saveOptions_;
    00245   int solverOptions_;
    00247   int maximumNodes_;
    00249   int numberBeforeTrust_;
    00251   int stateOfSearch_;
    00253   int nDepth_;
    00255   int nNodes_;
    00257   int numberNodesExplored_;
    00259   int numberIterations_;
    00261   int presolveType_;
    00263 };
    00264 class ClpHashValue {
    00265
    00266 public:
    00269
    00270   int index(double value) const;
    00272   int addValue(double value) ;
    00274   inline int numberEntries() const
    00275   { return numberHash_;}
    00277
    00281   ClpHashValue();
    00283   ClpHashValue(ClpSimplex * model);
    00285   virtual ~ClpHashValue();
    00287
    00291   ClpHashValue(const ClpHashValue&);
    00293   ClpHashValue& operator=(const ClpHashValue&);
    00295 private:
    00299   int hash(double value) const;
    00301   void resize(bool increaseMax);
    00303
    00304 protected:
    00308
    00309   // for hashing
    00310   typedef struct {
    00311     double value;
    00312     int index, next;
    00313   } CoinHashLink;
    00315   mutable CoinHashLink *hash_;
    00317   int numberHash_;
    00319   int maxHash_;
    00321   int lastUsed_;
    00323 };
    00324 #endif