1 // Copyright (C) 2000, International Business Machines 2 // Corporation and others. All Rights Reserved. 3 // This code is licensed under the terms of the Eclipse Public License (EPL). 4 5 #ifndef CglLiftAndProject_H 6 #define CglLiftAndProject_H 7 8 #include <string> 9 10 #include "CglCutGenerator.hpp" 11 12 /** Lift And Project Cut Generator Class */ 13 class CglLiftAndProject : public CglCutGenerator { 14 friend void CglLiftAndProjectUnitTest(const OsiSolverInterface * siP, 15 const std::string mpdDir ); 16 17 public: 18 /**@name Generate Cuts */ 19 //@{ 20 /** Generate lift-and-project cuts for the 21 model of the solver interface, si. 22 Insert the generated cuts into OsiCut, cs. 23 */ 24 virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, 25 const CglTreeInfo info = CglTreeInfo()); 26 27 /** Get the normalization : Either beta=+1 or beta=-1. 28 */ 29 getBeta() const30 double getBeta() const { 31 return beta_; 32 } 33 34 /** Set the normalization : Either beta=+1 or beta=-1. 35 Default value is 1. 36 */ setBeta(int oneOrMinusOne)37 void setBeta(int oneOrMinusOne){ 38 if (oneOrMinusOne==1 || oneOrMinusOne==-1){ 39 beta_= static_cast<double>(oneOrMinusOne); 40 } 41 else { 42 throw CoinError("Unallowable value. Beta must be 1 or -1", 43 "cutGeneration","CglLiftAndProject"); 44 } 45 } 46 47 //@} 48 49 /**@name Constructors and destructors */ 50 //@{ 51 /// Default constructor 52 CglLiftAndProject (); 53 54 /// Copy constructor 55 CglLiftAndProject ( 56 const CglLiftAndProject &); 57 58 /// Clone 59 virtual CglCutGenerator * clone() const; 60 61 /// Assignment operator 62 CglLiftAndProject & 63 operator=( 64 const CglLiftAndProject& rhs); 65 66 /// Destructor 67 virtual 68 ~CglLiftAndProject (); 69 /// Create C++ lines to get to current state 70 virtual std::string generateCpp( FILE * fp); 71 //@} 72 73 private: 74 75 // Private member methods 76 77 /**@name Private methods */ 78 //@{ 79 80 //@} 81 82 // Private member data 83 84 /**@name Private member data */ 85 //@{ 86 /// The normalization is beta_=1 or beta_=-1 87 double beta_; 88 /// epsilon 89 double epsilon_; 90 /// 1-epsilon 91 double onetol_; 92 //@} 93 }; 94 95 //############################################################################# 96 /** A function that tests the methods in the CglLiftAndProject class. The 97 only reason for it not to be a member method is that this way it doesn't 98 have to be compiled into the library. And that's a gain, because the 99 library should be compiled with optimization on, but this method should be 100 compiled with debugging. */ 101 void CglLiftAndProjectUnitTest(const OsiSolverInterface * siP, 102 const std::string mpdDir ); 103 104 #endif 105