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

- File List
- File Members

# /home/coin/svn-release/Alps-1.4.8/Clp/src/ClpNode.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpNode.hpp 1910 2013-01-27 02:00:13Z stefan $ */
    00002 // Copyright (C) 2008, 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 ClpNode_H
    00007 #define ClpNode_H
    00008
    00009 #include "CoinPragma.hpp"
    00010
    00011 // This implements all stuff for Clp fathom
    00016 class ClpFactorization;
    00017 class ClpDualRowSteepest;
    00018 class ClpNodeStuff;
    00019 class ClpNode {
    00020
    00021 public:
    00029      void applyNode(ClpSimplex * model, int doBoundsEtc );
    00031      void chooseVariable(ClpSimplex * model, ClpNodeStuff * info);
    00033      int fixOnReducedCosts(ClpSimplex * model);
    00035      void createArrays(ClpSimplex * model);
    00037      void cleanUpForCrunch();
    00039
    00042
    00043      inline double objectiveValue() const {
    00044           return objectiveValue_;
    00045      }
    00047      inline void setObjectiveValue(double value) {
    00048           objectiveValue_ = value;
    00049      }
    00051      inline const double * primalSolution() const {
    00052           return primalSolution_;
    00053      }
    00055      inline const double * dualSolution() const {
    00056           return dualSolution_;
    00057      }
    00059      inline double branchingValue() const {
    00060           return branchingValue_;
    00061      }
    00063      inline double sumInfeasibilities() const {
    00064           return sumInfeasibilities_;
    00065      }
    00067      inline int numberInfeasibilities() const {
    00068           return numberInfeasibilities_;
    00069      }
    00071      inline int depth() const {
    00072           return depth_;
    00073      }
    00075      inline double estimatedSolution() const {
    00076           return estimatedSolution_;
    00077      }
    00079      int way() const;
    00081      bool fathomed() const;
    00083      void changeState();
    00085      inline int sequence() const {
    00086           return sequence_;
    00087      }
    00089      inline bool oddArraysExist() const {
    00090           return lower_ != NULL;
    00091      }
    00093      inline const unsigned char * statusArray() const {
    00094           return status_;
    00095      }
    00097
    00101      ClpNode();
    00103      ClpNode (ClpSimplex * model, const ClpNodeStuff * stuff, int depth);
    00105      void gutsOfConstructor(ClpSimplex * model, const ClpNodeStuff * stuff,
    00106                             int arraysExist, int depth);
    00108      virtual ~ClpNode();
    00110
    00114      ClpNode(const ClpNode&);
    00116      ClpNode& operator=(const ClpNode&);
    00118
    00119 protected:
    00120 // For state of branch
    00121      typedef struct {
    00122           unsigned int firstBranch: 1; //  nonzero if first branch on variable is up
    00123           unsigned int branch: 2; //  0 means do first branch next, 1 second, 2 finished
    00124           unsigned int spare: 29;
    00125      } branchState;
    00128
    00129      double branchingValue_;
    00131      double objectiveValue_;
    00133      double sumInfeasibilities_;
    00135      double estimatedSolution_;
    00137      ClpFactorization * factorization_;
    00139      ClpDualRowSteepest * weights_;
    00141      unsigned char * status_;
    00143      double * primalSolution_;
    00145      double * dualSolution_;
    00147      int * lower_;
    00149      int * upper_;
    00151      int * pivotVariables_;
    00153      int * fixed_;
    00155      branchState branchState_;
    00157      int sequence_;
    00159      int numberInfeasibilities_;
    00161      int depth_;
    00163      int numberFixed_;
    00165      int flags_;
    00167      int maximumFixed_;
    00169      int maximumRows_;
    00171      int maximumColumns_;
    00173      int maximumIntegers_;
    00175 };
    00176 class ClpNodeStuff {
    00177
    00178 public:
    00182      ClpNodeStuff();
    00184      virtual ~ClpNodeStuff();
    00186
    00190      ClpNodeStuff(const ClpNodeStuff&);
    00192      ClpNodeStuff& operator=(const ClpNodeStuff&);
    00194      void zap(int type);
    00196
    00197
    00201      void fillPseudoCosts(const double * down, const double * up,
    00202                           const int * priority,
    00203                           const int * numberDown, const int * numberUp,
    00204                           const int * numberDownInfeasible, const int * numberUpInfeasible,
    00205                           int number);
    00207      void update(int way, int sequence, double change, bool feasible);
    00209      int maximumNodes() const;
    00211      int maximumSpace() const;
    00213
    00214 public:
    00217
    00218      double integerTolerance_;
    00220      double integerIncrement_;
    00222      double smallChange_;
    00224      double * downPseudo_;
    00226      double * upPseudo_;
    00228      int * priority_;
    00230      int * numberDown_;
    00232      int * numberUp_;
    00234      int * numberDownInfeasible_;
    00236      int * numberUpInfeasible_;
    00238      double * saveCosts_;
    00240      ClpNode ** nodeInfo_;
    00242      ClpSimplex * large_;
    00244      int * whichRow_;
    00246      int * whichColumn_;
    00247 #ifndef NO_FATHOM_PRINT
    00249      CoinMessageHandler * handler_;
    00250 #endif
    00252      int nBound_;
    00254      int saveOptions_;
    00255
    00263      int solverOptions_;
    00265      int maximumNodes_;
    00267      int numberBeforeTrust_;
    00269      int stateOfSearch_;
    00271      int nDepth_;
    00273      int nNodes_;
    00275      int numberNodesExplored_;
    00277      int numberIterations_;
    00279      int presolveType_;
    00280 #ifndef NO_FATHOM_PRINT
    00282      int startingDepth_;
    00284      int nodeCalled_;
    00285 #endif
    00286
    00287 };
    00288 class ClpHashValue {
    00289
    00290 public:
    00293
    00294      int index(double value) const;
    00296      int addValue(double value) ;
    00298      inline int numberEntries() const {
    00299           return numberHash_;
    00300      }
    00302
    00306      ClpHashValue();
    00308      ClpHashValue(ClpSimplex * model);
    00310      virtual ~ClpHashValue();
    00312
    00316      ClpHashValue(const ClpHashValue&);
    00318      ClpHashValue& operator=(const ClpHashValue&);
    00320 private:
    00324      int hash(double value) const;
    00326      void resize(bool increaseMax);
    00328
    00329 protected:
    00333
    00334      // for hashing
    00335      typedef struct {
    00336           double value;
    00337           int index, next;
    00338      } CoinHashLink;
    00340      mutable CoinHashLink *hash_;
    00342      int numberHash_;
    00344      int maxHash_;
    00346      int lastUsed_;
    00348 };
    00349 #endif