00001
00002
00003
00004
00005 #ifndef OsiCut_H
00006 #define OsiCut_H
00007
00008 #include "OsiCollections.hpp"
00009 #include "OsiSolverInterface.hpp"
00010
00019
00020
00021
00022
00023 #ifdef COIN_FAST_CODE
00024 #ifndef COIN_NOTEST_DUPLICATE
00025 #define COIN_NOTEST_DUPLICATE
00026 #endif
00027 #endif
00028
00029 #ifndef COIN_NOTEST_DUPLICATE
00030 #define COIN_DEFAULT_VALUE_FOR_DUPLICATE true
00031 #else
00032 #define COIN_DEFAULT_VALUE_FOR_DUPLICATE false
00033 #endif
00034
00035
00036 class OsiCut {
00037
00038 public:
00039
00040
00043
00044 inline void setEffectiveness( double e );
00046 inline double effectiveness() const;
00048
00051
00052 inline void setGloballyValid( bool trueFalse )
00053 { globallyValid_=trueFalse ? 1 : 0;}
00054 inline void setGloballyValid( )
00055 { globallyValid_=1;}
00056 inline void setNotGloballyValid( )
00057 { globallyValid_=0;}
00059 inline bool globallyValid() const
00060 { return globallyValid_!=0;}
00062 inline void setGloballyValidAsInteger( int trueFalse )
00063 { globallyValid_=trueFalse;}
00065 inline int globallyValidAsInteger() const
00066 { return globallyValid_;}
00068
00071
00072 virtual void print() const {}
00074
00075 #if 0
00076 / **@name Times used */
00077 / /@{
00078 /
00079 inline void setTimesUsed( int t );
00080 /
00081 inline void incrementTimesUsed();
00082 /
00083 inline int timesUsed() const;
00084 / /@}
00085
00086 / **@name Times tested */
00087 / /@{
00088 /
00089 inline void setTimesTested( int t );
00090 /
00091 inline void incrementTimesTested();
00092 /
00093 inline int timesTested() const;
00094 / /@}
00095 #endif
00096
00097
00098
00101
00102 inline virtual bool operator==(const OsiCut& rhs) const;
00104 inline virtual bool operator!=(const OsiCut& rhs) const;
00106 inline virtual bool operator< (const OsiCut& rhs) const;
00108 inline virtual bool operator> (const OsiCut& rhs) const;
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00132 inline virtual bool consistent() const=0;
00133
00139 inline virtual bool consistent(const OsiSolverInterface& si) const=0;
00140
00162 inline virtual bool infeasible(const OsiSolverInterface &si) const=0;
00163
00168 virtual double violated(const double * solution) const=0;
00170
00171 protected:
00172
00175
00176 OsiCut ();
00177
00179 OsiCut ( const OsiCut &);
00180
00182 OsiCut & operator=( const OsiCut& rhs);
00183
00185 virtual ~OsiCut ();
00187
00188 private:
00189
00192
00193 double effectiveness_;
00195 int globallyValid_;
00196 #if 0
00198 int timesUsed_;
00200 int timesTested_;
00201 #endif
00202
00203 };
00204
00205
00206
00207
00208
00209 void OsiCut::setEffectiveness(double e) { effectiveness_=e; }
00210 double OsiCut::effectiveness() const { return effectiveness_; }
00211
00212 #if 0
00213 void OsiCut::setTimesUsed( int t ) { timesUsed_=t; }
00214 void OsiCut::incrementTimesUsed() { timesUsed_++; }
00215 int OsiCut::timesUsed() const { return timesUsed_; }
00216
00217 void OsiCut::setTimesTested( int t ) { timesTested_=t; }
00218 void OsiCut::incrementTimesTested() { timesTested_++; }
00219 int OsiCut::timesTested() const{ return timesTested_; }
00220 #endif
00221
00222
00223
00224
00225 bool
00226 OsiCut::operator==(const OsiCut& rhs) const
00227 {
00228 return effectiveness()==rhs.effectiveness();
00229 }
00230 bool
00231 OsiCut::operator!=(const OsiCut& rhs) const
00232 {
00233 return !( (*this)==rhs );
00234 }
00235 bool
00236 OsiCut::operator< (const OsiCut& rhs) const
00237 {
00238 return effectiveness()<rhs.effectiveness();
00239 }
00240 bool
00241 OsiCut::operator> (const OsiCut& rhs) const
00242 {
00243 return effectiveness()>rhs.effectiveness();
00244 }
00245 #endif