coin-Cgl
|
00001 // Copyright (C) 2000, International Business Machines 00002 // Corporation and others. All Rights Reserved. 00003 00004 #ifndef CglTreeInfo_H 00005 #define CglTreeInfo_H 00006 00007 #include "OsiCuts.hpp" 00008 #include "OsiSolverInterface.hpp" 00009 #include "CoinHelperFunctions.hpp" 00010 class CglStored; 00013 class CglTreeInfo { 00014 public: 00016 int level; 00019 int pass; 00022 int formulation_rows; 00033 int options; 00035 bool inTree; 00045 OsiRowCut ** strengthenRow; 00047 CoinThreadRandom * randomNumberGenerator; 00049 CglTreeInfo (); 00050 00052 CglTreeInfo ( 00053 const CglTreeInfo &); 00055 virtual CglTreeInfo * clone() const; 00056 00058 CglTreeInfo & 00059 operator=( 00060 const CglTreeInfo& rhs); 00061 00063 virtual 00064 ~CglTreeInfo (); 00066 virtual bool fixes(int , int , int ,bool) {return false;} 00069 virtual int initializeFixing(const OsiSolverInterface * ) {return 0;} 00070 00071 }; 00072 00074 typedef struct { 00075 //unsigned int oneFixed:1; // nonzero if variable to 1 fixes all 00076 //unsigned int sequence:31; // variable (in matrix) (but also see cliqueRow_) 00077 unsigned int fixes; 00078 } cliqueEntry; 00079 00080 class CglTreeProbingInfo : public CglTreeInfo { 00081 public: 00083 CglTreeProbingInfo (); 00085 CglTreeProbingInfo (const OsiSolverInterface * model); 00086 00088 CglTreeProbingInfo ( 00089 const CglTreeProbingInfo &); 00091 virtual CglTreeInfo * clone() const; 00092 00094 CglTreeProbingInfo & 00095 operator=( 00096 const CglTreeProbingInfo& rhs); 00097 00099 virtual 00100 ~CglTreeProbingInfo (); 00101 OsiSolverInterface * analyze(const OsiSolverInterface & si, int createSolver=0); 00105 virtual bool fixes(int variable, int toValue, int fixedVariable,bool fixedToLower); 00108 virtual int initializeFixing(const OsiSolverInterface * model) ; 00110 int fixColumns(OsiSolverInterface & si) const; 00112 int fixColumns(int iColumn, int value, OsiSolverInterface & si) const; 00114 int packDown(); 00116 void generateCuts(const OsiSolverInterface & si, OsiCuts & cs, 00117 const CglTreeInfo info) const; 00119 inline cliqueEntry * fixEntries() const 00120 { convert(); return fixEntry_;} 00122 inline int * toZero() const 00123 { convert(); return toZero_;} 00125 inline int * toOne() const 00126 { convert(); return toOne_;} 00128 inline int * integerVariable() const 00129 { return integerVariable_;} 00131 inline int * backward() const 00132 { return backward_;} 00134 inline int numberVariables() const 00135 { return numberVariables_;} 00137 inline int numberIntegers() const 00138 { return numberIntegers_;} 00139 private: 00141 void convert() const; 00142 protected: 00144 mutable cliqueEntry * fixEntry_; 00146 mutable int * toZero_; 00148 mutable int * toOne_; 00150 int * integerVariable_; 00152 int * backward_; 00154 mutable int * fixingEntry_; 00156 int numberVariables_; 00158 int numberIntegers_; 00160 int maximumEntries_; 00162 mutable int numberEntries_; 00163 }; 00164 inline int sequenceInCliqueEntry(const cliqueEntry & cEntry) 00165 { return cEntry.fixes&0x7fffffff;} 00166 inline void setSequenceInCliqueEntry(cliqueEntry & cEntry,int sequence) 00167 { cEntry.fixes = sequence|(cEntry.fixes&0x80000000);} 00168 inline bool oneFixesInCliqueEntry(const cliqueEntry & cEntry) 00169 { return (cEntry.fixes&0x80000000)!=0;} 00170 inline void setOneFixesInCliqueEntry(cliqueEntry & cEntry,bool oneFixes) 00171 { cEntry.fixes = (oneFixes ? 0x80000000 : 0)|(cEntry.fixes&0x7fffffff);} 00172 00173 #endif