00001
00002
00003 #ifndef ClpNode_H
00004 #define ClpNode_H
00005
00006 #include "CoinPragma.hpp"
00007
00008
00013 class ClpFactorization;
00014 class ClpDualRowSteepest;
00015 class ClpNodeStuff;
00016 class ClpNode {
00017
00018 public:
00026 void applyNode(ClpSimplex * model, int doBoundsEtc );
00028 int fixOnReducedCosts(ClpSimplex * model);
00030 void createArrays(ClpSimplex * model);
00032 void cleanUpForCrunch();
00034
00037
00038 inline double objectiveValue() const
00039 { return objectiveValue_;}
00041 inline void setObjectiveValue(double value)
00042 { objectiveValue_=value;}
00044 inline const double * primalSolution() const
00045 { return primalSolution_;}
00047 inline const double * dualSolution() const
00048 { return dualSolution_;}
00050 inline double branchingValue() const
00051 { return branchingValue_;}
00053 inline double sumInfeasibilities() const
00054 { return sumInfeasibilities_;}
00056 inline int numberInfeasibilities() const
00057 { return numberInfeasibilities_;}
00059 inline double estimatedSolution() const
00060 { return estimatedSolution_;}
00062 int way() const;
00064 bool fathomed() const;
00066 void changeState();
00068 inline int sequence() const
00069 { return sequence_;}
00071 inline bool oddArraysExist() const
00072 { return lower_!=NULL;}
00074 inline const unsigned char * statusArray() const
00075 { return status_; }
00077
00081 ClpNode();
00083 ClpNode (ClpSimplex * model, const ClpNodeStuff * stuff,int depth);
00085 void gutsOfConstructor(ClpSimplex * model, const ClpNodeStuff * stuff,
00086 int arraysExist,int depth);
00088 virtual ~ClpNode();
00090
00094 ClpNode(const ClpNode&);
00096 ClpNode& operator=(const ClpNode&);
00098
00099 protected:
00100
00101 typedef struct {
00102 unsigned int firstBranch:1;
00103 unsigned int branch:2;
00104 unsigned int spare:29;
00105 } branchState;
00108
00109 double branchingValue_;
00111 double objectiveValue_;
00113 double sumInfeasibilities_;
00115 double estimatedSolution_;
00117 ClpFactorization * factorization_;
00119 ClpDualRowSteepest * weights_;
00121 unsigned char * status_;
00123 double * primalSolution_;
00125 double * dualSolution_;
00127 int * lower_;
00129 int * upper_;
00131 int * pivotVariables_;
00133 int * fixed_;
00135 branchState branchState_;
00137 int sequence_;
00139 int numberInfeasibilities_;
00141 int numberFixed_;
00143 int flags_;
00145 int maximumFixed_;
00147 int maximumRows_;
00149 int maximumColumns_;
00151 int maximumIntegers_;
00153 };
00154 class ClpNodeStuff {
00155
00156 public:
00160 ClpNodeStuff();
00162 virtual ~ClpNodeStuff();
00164
00168 ClpNodeStuff(const ClpNodeStuff&);
00170 ClpNodeStuff& operator=(const ClpNodeStuff&);
00172 void zap(int type);
00174
00175
00179 void fillPseudoCosts(const double * down, const double * up,
00180 const int * numberDown, const int * numberUp,
00181 const int * numberDownInfeasible, const int * numberUpInfeasible,
00182 int number);
00184 void update(int way,int sequence,double change,bool feasible);
00186
00187 public:
00190
00191 double integerTolerance_;
00193 double integerIncrement_;
00195 double * downPseudo_;
00197 double * upPseudo_;
00199 int * numberDown_;
00201 int * numberUp_;
00203 int * numberDownInfeasible_;
00205 int * numberUpInfeasible_;
00207 double * saveCosts_;
00209 ClpNode ** nodeInfo_;
00211 ClpSimplex * large_;
00213 int * whichRow_;
00215 int * whichColumn_;
00217 int nBound_;
00219 int saveOptions_;
00227 int solverOptions_;
00229 int nDepth_;
00231 int nNodes_;
00233 int numberNodesExplored_;
00235 int numberIterations_;
00237 int presolveType_;
00239 };
00240 class ClpHashValue {
00241
00242 public:
00245
00246 int index(double value) const;
00248 int addValue(double value) ;
00250 inline int numberEntries() const
00251 { return numberHash_;}
00253
00257 ClpHashValue();
00259 ClpHashValue(ClpSimplex * model);
00261 virtual ~ClpHashValue();
00263
00267 ClpHashValue(const ClpHashValue&);
00269 ClpHashValue& operator=(const ClpHashValue&);
00271 private:
00275 int hash(double value) const;
00277 void resize(bool increaseMax);
00279
00280 protected:
00284
00285
00286 typedef struct {
00287 double value;
00288 int index, next;
00289 } CoinHashLink;
00291 mutable CoinHashLink *hash_;
00293 int numberHash_;
00295 int maxHash_;
00297 int lastUsed_;
00299 };
00300 #endif