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

- File List
- File Members

# /home/coin/SVN-release/Alps-1.2.1/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 #ifndef OsiCut_H
    00004 #define OsiCut_H
    00005
    00006 #include "OsiCollections.hpp"
    00007 #include "OsiSolverInterface.hpp"
    00008
    00017 #if 0
    00018 / // count of how many times the cut has been used
    00019 / // count of how many times the cut has been tested
    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   / // Set times used
    00072   inline void setTimesUsed( int t );
    00073   / // Increment times used
    00074   inline void incrementTimesUsed();
    00075   / // Get times used
    00076   inline int timesUsed() const;
    00077   / /@}
    00078
    00079   / **@name Times tested */
    00080   / /@{
    00081   / // Set times tested
    00082   inline void setTimesTested( int t );
    00083   / // Increment times tested
    00084   inline void incrementTimesTested();
    00085   / // Get times tested
    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   // consistent() - returns true if the cut is consistent with repect to itself.
    00106   //         This might include checks to ensure that a packed vector
    00107   //         itself does not have a negative index.
    00108   // consistent(const OsiSolverInterface& si) - returns true if cut is consistent with
    00109   //         respect to the solver interface's model. This might include a check to
    00110   //         make sure a column index is not greater than the number
    00111   //         of columns in the problem.
    00112   // infeasible(const OsiSolverInterface& si) - returns true if the cut is infeasible
    00113   //         "with respect to itself". This might include a check to ensure
    00114   //         the lower bound is greater than the upper bound, or if the
    00115   //         cut simply replaces bounds that the new bounds are feasible with
    00116   //         respect to the old bounds.
    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 // Set/Get member data
    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 // == operator
    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