source: trunk/include/CbcTree.hpp @ 135

Last change on this file since 135 was 135, checked in by forrest, 15 years ago

starting dynamic pseudo costs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1// Copyright (C) 2004, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef CbcTree_H
4#define CbcTree_H
5using namespace std;
6
7
8#include <vector>
9
10/*! \class tree
11    \brief Implementation of live set as a heap.
12
13    This class is used to hold the set of live nodes in the search tree.
14*/
15
16class CbcTree {
17
18public:
19
20  // Default Constructor
21  CbcTree ();
22
23  // Copy constructor
24  CbcTree ( const CbcTree & rhs);
25  // = operator
26  CbcTree & operator=(const CbcTree & rhs);
27   
28  virtual ~CbcTree();
29
30  /// Clone
31  virtual CbcTree * clone() const;
32
33/*! \name Heap access and maintenance methods */
34//@{
35
36  /// Set comparison function and resort heap
37  void setComparison(CbcCompareBase  &compare);
38
39  /// Return the top node of the heap
40  virtual CbcNode * top();
41
42  /// Add a node to the heap
43  virtual void push(CbcNode * x);
44
45  /// Remove the top node from the heap
46  virtual void pop() ;
47  /// Gets best node and takes off heap
48  virtual CbcNode * bestNode(double cutoff);
49
50//@}
51/*! \name vector methods */
52//@{
53
54  /// Test if empty *** note may be overridden
55  virtual bool empty() ;
56
57  /// Return size
58  inline int size() const
59  { return nodes_.size();};
60
61  /// [] operator
62  inline CbcNode * operator [] (int i) const
63  { return nodes_[i];};
64
65  /// Return a node pointer
66  inline CbcNode * nodePointer (int i) const
67  { return nodes_[i];};
68
69//@}
70
71/*! \name Search tree maintenance */
72//@{
73
74/*! \brief Prune the tree using an objective function cutoff
75
76  This routine removes all nodes with objective worst than the
77  specified cutoff value.
78  It also sets bestPossibleObjective to best
79  of all on tree before deleting.
80*/
81
82  void cleanTree(CbcModel * model, double cutoff, double & bestPossibleObjective);
83
84  /// Get best on list using alternate method
85  CbcNode * bestAlternate();
86
87  /// We may have got an intelligent tree so give it one more chance
88  virtual void endSearch() {};
89//@}
90protected:
91  std::vector <CbcNode *> nodes_;
92  CbcCompare comparison_;       ///> Sort function for heap ordering.
93
94
95};
96#endif
97
Note: See TracBrowser for help on using the repository browser.