source: trunk/Samples/CbcCompareUser.hpp @ 31

Last change on this file since 31 was 31, checked in by forrest, 16 years ago

make different from Default

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1// Copyright (C) 2002, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef CbcCompareUser_H
4#define CbcCompareUser_H
5
6#include "CbcNode.hpp"
7#include "CbcCompareBase.hpp"
8class CbcModel;
9/* This is an example of a more complex rule with data
10   It is default after first solution
11   If weight is 0.0 then it is computed to hit first solution
12   less 2%
13*/
14class CbcCompareUser  : public CbcCompareBase {
15public:
16  // Default Constructor
17  CbcCompareUser () ;
18  // Constructor with weight
19  CbcCompareUser (double weight);
20
21  // Copy constructor
22  CbcCompareUser ( const CbcCompareUser &rhs);
23   
24  // Assignment operator
25  CbcCompareUser & operator=( const CbcCompareUser& rhs);
26
27  /// Clone
28  virtual CbcCompareBase * clone() const;
29
30  ~CbcCompareUser() ;
31  /* This returns true if weighted value of node y is less than
32     weighted value of node x */
33  virtual bool test (CbcNode * x, CbcNode * y) ;
34  // This allows method to change behavior as it is called
35  // after each solution
36  virtual void newSolution(CbcModel * model,
37                           double objectiveAtContinuous,
38                           int numberInfeasibilitiesAtContinuous) ;
39  // This allows method to change behavior
40  // Return true if want tree re-sorted
41  virtual bool every1000Nodes(CbcModel * model,int numberNodes);
42
43  /* if weight == -1.0 then depth first (before solution)
44     if -2.0 then do breadth first just for first 1000 nodes
45  */
46  inline double getWeight() const
47  { return weight_;};
48  inline void setWeight(double weight)
49  { weight_ = weight;};
50protected:
51  // Weight for each infeasibility
52  double weight_;
53  // Weight for each infeasibility - computed from solution
54  double saveWeight_;
55  // Number of solutions
56  int numberSolutions_;
57  // Tree size (at last check)
58  int treeSize_;
59};
60#endif
Note: See TracBrowser for help on using the repository browser.