- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/svn-release/Alps-1.4.8/Osi/src/Osi/OsiCut.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2000, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    00003 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00004
    00005 #ifndef OsiCut_H
    00006 #define OsiCut_H
    00007
    00008 #include "OsiCollections.hpp"
    00009 #include "OsiSolverInterface.hpp"
    00010
    00019 /*
    00020   COIN_NOTEST_DUPLICATE is rooted in CoinUtils. Check there before you
    00021   meddle here.
    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   / // Set times used
    00079   inline void setTimesUsed( int t );
    00080   / // Increment times used
    00081   inline void incrementTimesUsed();
    00082   / // Get times used
    00083   inline int timesUsed() const;
    00084   / /@}
    00085
    00086   / **@name Times tested */
    00087   / /@{
    00088   / // Set times tested
    00089   inline void setTimesTested( int t );
    00090   / // Increment times tested
    00091   inline void incrementTimesTested();
    00092   / // Get times tested
    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   // consistent() - returns true if the cut is consistent with repect to itself.
    00113   //         This might include checks to ensure that a packed vector
    00114   //         itself does not have a negative index.
    00115   // consistent(const OsiSolverInterface& si) - returns true if cut is consistent with
    00116   //         respect to the solver interface's model. This might include a check to
    00117   //         make sure a column index is not greater than the number
    00118   //         of columns in the problem.
    00119   // infeasible(const OsiSolverInterface& si) - returns true if the cut is infeasible
    00120   //         "with respect to itself". This might include a check to ensure
    00121   //         the lower bound is greater than the upper bound, or if the
    00122   //         cut simply replaces bounds that the new bounds are feasible with
    00123   //         respect to the old bounds.
    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 // Set/Get member data
    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 // == operator
    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