/home/coin/SVN-release/Osi-0.96.1/Osi/src/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 
00023 class OsiCut  {
00024   
00025 public:
00026     
00027   //-------------------------------------------------------------------
00030 
00031   inline void setEffectiveness( double e ); 
00033   inline double effectiveness() const; 
00035 
00038 
00039   inline void setGloballyValid( bool trueFalse ) 
00040   { globallyValid_=trueFalse ? 1 : 0;};
00041   inline void setGloballyValid( ) 
00042   { globallyValid_=1;};
00043   inline void setNotGloballyValid( ) 
00044   { globallyValid_=0;};
00046   inline bool globallyValid() const
00047   { return globallyValid_!=0;};
00049   inline void setGloballyValidAsInteger( int trueFalse ) 
00050   { globallyValid_=trueFalse;};
00052   inline int globallyValidAsInteger() const
00053   { return globallyValid_;};
00055 
00058 
00059   virtual void print() const {};
00061    
00062 #if 0
00063   / **@name Times used */
00064   / /@{
00065   / // Set times used
00066   inline void setTimesUsed( int t );
00067   / // Increment times used
00068   inline void incrementTimesUsed();
00069   / // Get times used
00070   inline int timesUsed() const;
00071   / /@}
00072   
00073   / **@name Times tested */
00074   / /@{
00075   / // Set times tested
00076   inline void setTimesTested( int t );
00077   / // Increment times tested
00078   inline void incrementTimesTested();
00079   / // Get times tested
00080   inline int timesTested() const;
00081   / /@}
00082 #endif
00083 
00084   //----------------------------------------------------------------
00085 
00088 
00089     inline virtual bool operator==(const OsiCut& rhs) const; 
00091     inline virtual bool operator!=(const OsiCut& rhs) const; 
00093     inline virtual bool operator< (const OsiCut& rhs) const; 
00095     inline virtual bool operator> (const OsiCut& rhs) const; 
00097 
00098   //----------------------------------------------------------------
00099   // consistent() - returns true if the cut is consistent with repect to itself.
00100   //         This might include checks to ensure that a packed vector
00101   //         itself does not have a negative index.
00102   // consistent(const OsiSolverInterface& si) - returns true if cut is consistent with
00103   //         respect to the solver interface's model. This might include a check to 
00104   //         make sure a column index is not greater than the number
00105   //         of columns in the problem.
00106   // infeasible(const OsiSolverInterface& si) - returns true if the cut is infeasible 
00107   //         "with respect to itself". This might include a check to ensure 
00108   //         the lower bound is greater than the upper bound, or if the
00109   //         cut simply replaces bounds that the new bounds are feasible with 
00110   //         respect to the old bounds.
00111   //-----------------------------------------------------------------
00119   inline virtual bool consistent() const=0; 
00120 
00126   inline virtual bool consistent(const OsiSolverInterface& si) const=0;
00127 
00149   inline virtual bool infeasible(const OsiSolverInterface &si) const=0;
00150 
00155   virtual double violated(const double * solution) const=0;
00157 
00158 protected:
00159 
00162 
00163   OsiCut ();
00164   
00166   OsiCut ( const OsiCut &);
00167    
00169   OsiCut & operator=( const OsiCut& rhs);
00170 
00172   virtual ~OsiCut ();
00174   
00175 private:
00176   
00179 
00180   double effectiveness_;
00182   int globallyValid_;
00183 #if 0
00185   int timesUsed_;
00187   int timesTested_;
00188 #endif
00189 
00190 };
00191 
00192 
00193 //-------------------------------------------------------------------
00194 // Set/Get member data
00195 //-------------------------------------------------------------------
00196 void OsiCut::setEffectiveness(double e)  { effectiveness_=e; }
00197 double OsiCut::effectiveness() const { return effectiveness_; }
00198 
00199 #if 0
00200 void OsiCut::setTimesUsed( int t ) { timesUsed_=t; }
00201 void OsiCut::incrementTimesUsed() { timesUsed_++; }
00202 int OsiCut::timesUsed() const { return timesUsed_; }
00203 
00204 void OsiCut::setTimesTested( int t ) { timesTested_=t; }
00205 void OsiCut::incrementTimesTested() { timesTested_++; }
00206 int OsiCut::timesTested() const{ return timesTested_; }
00207 #endif
00208 
00209 //----------------------------------------------------------------
00210 // == operator 
00211 //-------------------------------------------------------------------
00212 bool
00213 OsiCut::operator==(const OsiCut& rhs) const
00214 {
00215   return effectiveness()==rhs.effectiveness();
00216 }
00217 bool
00218 OsiCut::operator!=(const OsiCut& rhs) const
00219 {
00220   return !( (*this)==rhs );
00221 }
00222 bool
00223 OsiCut::operator< (const OsiCut& rhs) const
00224 {
00225   return effectiveness()<rhs.effectiveness();
00226 }
00227 bool
00228 OsiCut::operator> (const OsiCut& rhs) const
00229 {
00230   return effectiveness()>rhs.effectiveness();
00231 }
00232 #endif

Generated on Fri May 16 00:13:03 2008 by  doxygen 1.4.7