00001
00002
00003 #ifndef CbcCompareBase_H
00004 #define CbcCompareBase_H
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "CbcNode.hpp"
00020
00021 class CbcModel;
00022 class CbcTree;
00023 class CbcCompareBase {
00024 public:
00025
00026 CbcCompareBase () {test_=NULL;};
00027
00028
00029
00030 virtual void newSolution(CbcModel * model) {};
00031
00032
00033
00034 virtual void newSolution(CbcModel * model,
00035 double objectiveAtContinuous,
00036 int numberInfeasibilitiesAtContinuous) {};
00037
00038
00039
00040
00041 virtual bool every1000Nodes(CbcModel * model,int numberNodes) {return false;};
00042
00044 virtual bool fullScan() const { return false;};
00045
00046 virtual ~CbcCompareBase() {};
00048 virtual void generateCpp( FILE * fp) {};
00049
00050
00051 CbcCompareBase ( const CbcCompareBase & rhs)
00052 {test_=rhs.test_;};
00053
00054
00055 CbcCompareBase & operator=( const CbcCompareBase& rhs)
00056 { if (this!=&rhs) {test_=rhs.test_;}
00057 return *this;
00058 };
00059
00061 virtual CbcCompareBase * clone() const=0;
00062
00064 virtual bool test (CbcNode * x, CbcNode * y) {return true;};
00065
00067 virtual bool alternateTest (CbcNode * x, CbcNode * y) {return test(x,y);};
00068
00069 bool operator() (CbcNode * x, CbcNode * y) {
00070 return test(x,y);
00071 }
00072 protected:
00073 CbcCompareBase * test_;
00074 };
00075 class CbcCompare {
00076 public:
00077 CbcCompareBase * test_;
00078
00079 CbcCompare () {test_=NULL;};
00080
00081 virtual ~CbcCompare() {};
00082
00083 bool operator() (CbcNode * x, CbcNode * y) {
00084 return test_->test(x,y);
00085 }
00087 inline bool alternateTest (CbcNode * x, CbcNode * y) {return test_->alternateTest(x,y);};
00088
00090 inline CbcCompareBase * comparisonObject() const
00091 { return test_;};
00092 };
00093
00094
00095
00096
00097
00098 class CbcChooseVariable {
00099 public:
00100
00101 CbcChooseVariable () {};
00102
00103 virtual ~CbcChooseVariable() {};
00109 virtual int chosen (const CbcModel * model,int numberToLookAt,
00110 const int * which, const double * downMovement,
00111 const double * upMovement, const double * solution,
00112 int & way, double & value)=0;
00113
00114 };
00115 #endif