source: branches/devel/Cbc/src/CbcTree.hpp @ 441

Last change on this file since 441 was 441, checked in by forrest, 13 years ago

for local tree search and feasibility pump

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 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  /// Create C++ lines to get to current state
33  virtual void generateCpp( FILE * fp) {};
34
35/*! \name Heap access and maintenance methods */
36//@{
37
38  /// Set comparison function and resort heap
39  void setComparison(CbcCompareBase  &compare);
40
41  /// Return the top node of the heap
42  virtual CbcNode * top() const;
43
44  /// Add a node to the heap
45  virtual void push(CbcNode * x);
46
47  /// Remove the top node from the heap
48  virtual void pop() ;
49  /// Gets best node and takes off heap
50  virtual CbcNode * bestNode(double cutoff);
51
52//@}
53/*! \name vector methods */
54//@{
55
56  /// Test if empty *** note may be overridden
57  virtual bool empty() ;
58
59  /// Return size
60  inline int size() const
61  { return nodes_.size();}
62
63  /// [] operator
64  inline CbcNode * operator [] (int i) const
65  { return nodes_[i];}
66
67  /// Return a node pointer
68  inline CbcNode * nodePointer (int i) const
69  { return nodes_[i];}
70
71//@}
72
73/*! \name Search tree maintenance */
74//@{
75
76/*! \brief Prune the tree using an objective function cutoff
77
78  This routine removes all nodes with objective worst than the
79  specified cutoff value.
80  It also sets bestPossibleObjective to best
81  of all on tree before deleting.
82*/
83
84  void cleanTree(CbcModel * model, double cutoff, double & bestPossibleObjective);
85
86  /// Get best on list using alternate method
87  CbcNode * bestAlternate();
88
89  /// We may have got an intelligent tree so give it one more chance
90  virtual void endSearch() {}
91//@}
92protected:
93  std::vector <CbcNode *> nodes_;
94  CbcCompare comparison_;       ///> Sort function for heap ordering.
95
96
97};
98#endif
99
Note: See TracBrowser for help on using the repository browser.