Cbc  2.10.10
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CbcCompareUser.hpp
Go to the documentation of this file.
1 // $Id$
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CbcCompareUser_H
7 #define CbcCompareUser_H
8 
9 #include "CbcNode.hpp"
10 #include "CbcCompareBase.hpp"
11 class CbcModel;
12 /* This is an example of a more complex rule with data
13  It is default after first solution
14  If weight is 0.0 then it is computed to hit first solution
15  less 2%
16 */
18 public:
19  // Default Constructor
21  // Constructor with weight
22  CbcCompareUser(double weight);
23 
24  // Copy constructor
25  CbcCompareUser(const CbcCompareUser &rhs);
26 
27  // Assignment operator
29 
31  virtual CbcCompareBase *clone() const;
32 
34  /* This returns true if weighted value of node y is less than
35  weighted value of node x */
36  virtual bool test(CbcNode *x, CbcNode *y);
38  virtual bool alternateTest(CbcNode *x, CbcNode *y);
39  // This allows method to change behavior as it is called
40  // after each solution
41  virtual bool newSolution(CbcModel *model,
42  double objectiveAtContinuous,
43  int numberInfeasibilitiesAtContinuous);
45  virtual bool fullScan() const;
46  // This allows method to change behavior
47  // Return true if want tree re-sorted
48  virtual bool every1000Nodes(CbcModel *model, int numberNodes);
49 
50  /* if weight == -1.0 then depth first (before solution)
51  if -2.0 then do breadth first just for first 1000 nodes
52  */
53  inline double getWeight() const
54  {
55  return weight_;
56  }
57  inline void setWeight(double weight)
58  {
59  weight_ = weight;
60  }
61 
62 protected:
63  // Weight for each infeasibility
64  double weight_;
65  // Weight for each infeasibility - computed from solution
66  double saveWeight_;
67  // Number of solutions
69  // count
70  mutable int count_;
71  // Tree size (at last check)
72  int treeSize_;
73 };
74 #endif
CbcCompareUser::clone
virtual CbcCompareBase * clone() const
Clone.
CbcCompareUser::newSolution
virtual bool newSolution(CbcModel *model, double objectiveAtContinuous, int numberInfeasibilitiesAtContinuous)
Reconsider behaviour after discovering a new solution.
CbcCompareUser
Definition: CbcCompareUser.hpp:17
CbcCompareUser::saveWeight_
double saveWeight_
Definition: CbcCompareUser.hpp:66
CbcCompareUser::treeSize_
int treeSize_
Definition: CbcCompareUser.hpp:72
CbcCompareUser::setWeight
void setWeight(double weight)
Definition: CbcCompareUser.hpp:57
CbcCompareUser::CbcCompareUser
CbcCompareUser()
CbcModel
Simple Branch and bound class.
Definition: CbcModel.hpp:100
CbcCompareUser::weight_
double weight_
Definition: CbcCompareUser.hpp:64
CbcCompareBase.hpp
CbcCompareUser::count_
int count_
Definition: CbcCompareUser.hpp:70
CbcCompareUser::alternateTest
virtual bool alternateTest(CbcNode *x, CbcNode *y)
This is alternate test function.
CbcNode
Information required while the node is live.
Definition: CbcNode.hpp:49
CbcCompareUser::every1000Nodes
virtual bool every1000Nodes(CbcModel *model, int numberNodes)
CbcNode.hpp
CbcCompareUser::numberSolutions_
int numberSolutions_
Definition: CbcCompareUser.hpp:68
CbcCompareUser::test
virtual bool test(CbcNode *x, CbcNode *y)
This is test function.
CbcCompareUser::~CbcCompareUser
~CbcCompareUser()
CbcCompareBase
Definition: CbcCompareBase.hpp:26
CbcCompareUser::operator=
CbcCompareUser & operator=(const CbcCompareUser &rhs)
CbcCompareUser::getWeight
double getWeight() const
Definition: CbcCompareUser.hpp:53
CbcCompareUser::fullScan
virtual bool fullScan() const
Returns true if wants code to do scan with alternate criterion.