Ignore:
Timestamp:
Apr 28, 2008 11:38:45 AM (11 years ago)
Author:
forrest
Message:

many changes to try and improve performance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpNode.hpp

    r1163 r1197  
    1919  /**@name Useful methods */
    2020  //@{
    21   /// Applies node to model
    22   void applyNode(ClpSimplex * model, bool justBounds );
     21  /** Applies node to model
     22      0 - just tree bounds
     23      1 - tree bounds and basis etc
     24      2 - saved bounds and basis etc
     25  */
     26  void applyNode(ClpSimplex * model, int doBoundsEtc );
    2327  /// Fix on reduced costs
    2428  int fixOnReducedCosts(ClpSimplex * model);
     29  /// Create odd arrays
     30  void createArrays(ClpSimplex * model);
     31  /// Clean up as crunch is different model
     32  void cleanUpForCrunch();
    2533  //@}
    2634 
    2735  /**@name Gets and sets */
    2836  //@{
     37  /// Objective value
     38  inline double objectiveValue() const
     39  { return objectiveValue_;}
     40  /// Set objective value
     41  inline void setObjectiveValue(double value)
     42  { objectiveValue_=value;}
     43  /// Primal solution
     44  inline const double * primalSolution() const
     45  { return primalSolution_;}
     46  /// Dual solution
     47  inline const double * dualSolution() const
     48  { return dualSolution_;}
    2949  /// Initial value of integer variable
    3050  inline double branchingValue() const
    3151  { return branchingValue_;}
     52  /// Sum infeasibilities
     53  inline double sumInfeasibilities() const
     54  { return sumInfeasibilities_;}
     55  /// Number infeasibilities
     56  inline int numberInfeasibilities() const
     57  { return numberInfeasibilities_;}
     58  /// Estimated solution value
     59  inline double estimatedSolution() const
     60  { return estimatedSolution_;}
    3261  /** Way for integer variable -1 down , +1 up */
    3362  int way() const;
     
    3968  inline int sequence() const
    4069  { return sequence_;}
     70  /// If odd arrays exist
     71  inline bool oddArraysExist() const
     72  { return lower_!=NULL;}
     73  /// Status array
     74  inline const unsigned char * statusArray() const
     75  { return status_; }
    4176  //@}
    4277 
     
    4681  ClpNode();
    4782  /// Constructor from model
    48   ClpNode (const ClpSimplex * model, const ClpNodeStuff * stuff);
     83  ClpNode (ClpSimplex * model, const ClpNodeStuff * stuff,int depth);
    4984  /// Does work of constructor (partly so gdb will work)
    50   void gutsOfConstructor(const ClpSimplex * model, const ClpNodeStuff * stuff);
     85  void gutsOfConstructor(ClpSimplex * model, const ClpNodeStuff * stuff,
     86                         int arraysExist,int depth);
    5187  /** Destructor */
    5288  virtual ~ClpNode();
     
    72108  /// Initial value of integer variable
    73109  double branchingValue_;
     110  /// Value of objective
     111  double objectiveValue_;
     112  /// Sum of infeasibilities
     113  double sumInfeasibilities_;
     114  /// Estimated solution value
     115  double estimatedSolution_;
    74116  /// Factorization
    75117  ClpFactorization * factorization_;
     
    82124  /// Dual solution
    83125  double * dualSolution_;
     126  /// Integer lower bounds (only used in fathomMany)
     127  int * lower_;
     128  /// Integer upper bounds (only used in fathomMany)
     129  int * upper_;
    84130  /// Pivot variables for factorization
    85131  int * pivotVariables_;
     
    90136  /// Sequence number of integer variable (-1 if none)
    91137  int sequence_;
     138  /// Number of infeasibilities
     139  int numberInfeasibilities_;
    92140  /// Number fixed by reduced cost
    93141  int numberFixed_;
     142  /// Flags - 1 duals scaled
     143  int flags_;
     144  /// Maximum number fixed by reduced cost
     145  int maximumFixed_;
     146  /// Maximum rows so far
     147  int maximumRows_;
     148  /// Maximum columns so far
     149  int maximumColumns_;
     150  /// Maximum Integers so far
     151  int maximumIntegers_;
    94152  //@}
    95153};
     
    105163  //@}
    106164 
    107   /**@name Copy methods (at present illegal - will abort) */
     165  /**@name Copy methods (only copies ints etc, nulls arrays) */
    108166  //@{
    109167  /** The copy constructor. */
     
    111169  /// Operator =
    112170  ClpNodeStuff& operator=(const ClpNodeStuff&);
     171  /// Zaps stuff 1 - arrays, 2 ints, 3 both
     172  void zap(int type);
     173  //@}
     174 
     175 
     176  /**@name Fill methods */
     177  //@{
     178  /** Fill with pseudocosts */
     179  void fillPseudoCosts(const double * down, const double * up,
     180                       const int * numberDown, const int * numberUp,
     181                       const int * numberDownInfeasible, const int * numberUpInfeasible,
     182                       int number);
     183  /// Update pseudo costs
     184  void update(int way,int sequence,double change,bool feasible);
    113185  //@}
    114186 
     
    120192  /// Integer increment
    121193  double integerIncrement_;
     194  /// Down pseudo costs
     195  double * downPseudo_;
     196  /// Up pseudo costs
     197  double * upPseudo_;
     198  /// Number of times down
     199  int * numberDown_;
     200  /// Number of times up
     201  int * numberUp_;
     202  /// Number of times down infeasible
     203  int * numberDownInfeasible_;
     204  /// Number of times up infeasible
     205  int * numberUpInfeasible_;
     206  /// Copy of costs (local)
     207  double * saveCosts_;
     208  /// Array of ClpNodes
     209  ClpNode ** nodeInfo_;
     210  /// Large model if crunched
     211  ClpSimplex * large_;
     212  /// Which rows in large model
     213  int * whichRow_;
     214  /// Which columns in large model
     215  int * whichColumn_;
     216  /// Number bounds in large model
     217  int nBound_;
     218  /// Save of specialOptions_ (local)
     219  int saveOptions_;
     220  /** Options to pass to solver
     221      1 - create external reduced costs for columns
     222      2 - create external reduced costs for rows
     223      4 - create external row activity (columns always done)
     224      Above only done if feasible
     225      65536 - set if activated
     226  */
     227  int solverOptions_;
     228  /// Number deep
     229  int nDepth_;
     230  /// Number nodes returned (-1 if fathom aborted)
     231  int nNodes_;
     232  /// Number of nodes explored
     233  int numberNodesExplored_;
     234  /// Number of iterations
     235  int numberIterations_;
     236  /// Type of presolve - 0 none, 1 crunch
     237  int presolveType_;
     238  //@}
     239};
     240class ClpHashValue {
     241 
     242public:
     243  /**@name Useful methods */
     244  //@{
     245  /// Return index or -1 if not found
     246  int index(double value) const;
     247  /// Add value to list and return index
     248  int addValue(double value) ;
     249  //@}
     250
     251  /**@name Constructors, destructor */
     252  //@{
     253  /** Default constructor. */
     254  ClpHashValue();
     255  /** Useful constructor. */
     256  ClpHashValue(ClpSimplex * model);
     257  /** Destructor */
     258  virtual ~ClpHashValue();
     259  //@}
     260 
     261  /**@name Copy method */
     262  //@{
     263  /** The copy constructor. */
     264  ClpHashValue(const ClpHashValue&);
     265  /// =
     266  ClpHashValue& operator=(const ClpHashValue&);
     267  //@}
     268private:
     269  /**@name private stuff */
     270  //@{
     271  /** returns hash */
     272  int hash(double value) const;
     273  /// Resizes
     274  void resize(bool increaseMax);
     275  //@}
     276   
     277protected:
     278  /**@name Data members
     279     The data members are protected to allow access for derived classes. */
     280  //@{
     281  /// Data
     282  // for hashing
     283  typedef struct {
     284    double value;
     285    int index, next;
     286  } CoinHashLink;
     287  /// Hash table
     288  mutable CoinHashLink *hash_;
     289  /// Number of entries in hash table
     290  int numberHash_;
     291  /// Maximum number of entries in hash table i.e. size
     292  int maxHash_;
     293  /// Last used space
     294  int lastUsed_;
    122295  //@}
    123296};
Note: See TracChangeset for help on using the changeset viewer.