00001
00002
00003 #ifndef OsiCut_H
00004 #define OsiCut_H
00005
00006 #include "OsiCollections.hpp"
00007 #include "OsiSolverInterface.hpp"
00008
00017 #if 0
00018 /
00019 /
00020 #endif
00021
00022 #ifndef COIN_NOTEST_DUPLICATE
00023 #define COIN_DEFAULT_VALUE_FOR_DUPLICATE true
00024 #else
00025 #define COIN_DEFAULT_VALUE_FOR_DUPLICATE false
00026 #endif
00027
00028
00029 class OsiCut {
00030
00031 public:
00032
00033
00036
00037 inline void setEffectiveness( double e );
00039 inline double effectiveness() const;
00041
00044
00045 inline void setGloballyValid( bool trueFalse )
00046 { globallyValid_=trueFalse ? 1 : 0;}
00047 inline void setGloballyValid( )
00048 { globallyValid_=1;}
00049 inline void setNotGloballyValid( )
00050 { globallyValid_=0;}
00052 inline bool globallyValid() const
00053 { return globallyValid_!=0;}
00055 inline void setGloballyValidAsInteger( int trueFalse )
00056 { globallyValid_=trueFalse;}
00058 inline int globallyValidAsInteger() const
00059 { return globallyValid_;}
00061
00064
00065 virtual void print() const {}
00067
00068 #if 0
00069 / **@name Times used */
00070 / /@{
00071 /
00072 inline void setTimesUsed( int t );
00073 /
00074 inline void incrementTimesUsed();
00075 /
00076 inline int timesUsed() const;
00077 / /@}
00078
00079 / **@name Times tested */
00080 / /@{
00081 /
00082 inline void setTimesTested( int t );
00083 /
00084 inline void incrementTimesTested();
00085 /
00086 inline int timesTested() const;
00087 / /@}
00088 #endif
00089
00090
00091
00094
00095 inline virtual bool operator==(const OsiCut& rhs) const;
00097 inline virtual bool operator!=(const OsiCut& rhs) const;
00099 inline virtual bool operator< (const OsiCut& rhs) const;
00101 inline virtual bool operator> (const OsiCut& rhs) const;
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00125 inline virtual bool consistent() const=0;
00126
00132 inline virtual bool consistent(const OsiSolverInterface& si) const=0;
00133
00155 inline virtual bool infeasible(const OsiSolverInterface &si) const=0;
00156
00161 virtual double violated(const double * solution) const=0;
00163
00164 protected:
00165
00168
00169 OsiCut ();
00170
00172 OsiCut ( const OsiCut &);
00173
00175 OsiCut & operator=( const OsiCut& rhs);
00176
00178 virtual ~OsiCut ();
00180
00181 private:
00182
00185
00186 double effectiveness_;
00188 int globallyValid_;
00189 #if 0
00191 int timesUsed_;
00193 int timesTested_;
00194 #endif
00195
00196 };
00197
00198
00199
00200
00201
00202 void OsiCut::setEffectiveness(double e) { effectiveness_=e; }
00203 double OsiCut::effectiveness() const { return effectiveness_; }
00204
00205 #if 0
00206 void OsiCut::setTimesUsed( int t ) { timesUsed_=t; }
00207 void OsiCut::incrementTimesUsed() { timesUsed_++; }
00208 int OsiCut::timesUsed() const { return timesUsed_; }
00209
00210 void OsiCut::setTimesTested( int t ) { timesTested_=t; }
00211 void OsiCut::incrementTimesTested() { timesTested_++; }
00212 int OsiCut::timesTested() const{ return timesTested_; }
00213 #endif
00214
00215
00216
00217
00218 bool
00219 OsiCut::operator==(const OsiCut& rhs) const
00220 {
00221 return effectiveness()==rhs.effectiveness();
00222 }
00223 bool
00224 OsiCut::operator!=(const OsiCut& rhs) const
00225 {
00226 return !( (*this)==rhs );
00227 }
00228 bool
00229 OsiCut::operator< (const OsiCut& rhs) const
00230 {
00231 return effectiveness()<rhs.effectiveness();
00232 }
00233 bool
00234 OsiCut::operator> (const OsiCut& rhs) const
00235 {
00236 return effectiveness()>rhs.effectiveness();
00237 }
00238 #endif