00001
00002
00003
00004
00005
00006 #ifndef CglTreeInfo_H
00007 #define CglTreeInfo_H
00008
00009 #include "OsiCuts.hpp"
00010 #include "OsiSolverInterface.hpp"
00011 #include "CoinHelperFunctions.hpp"
00012 class CglStored;
00015 class CglTreeInfo {
00016 public:
00018 int level;
00021 int pass;
00024 int formulation_rows;
00038 int options;
00040 bool inTree;
00050 OsiRowCut ** strengthenRow;
00052 CoinThreadRandom * randomNumberGenerator;
00054 CglTreeInfo ();
00055
00057 CglTreeInfo (
00058 const CglTreeInfo &);
00060 virtual CglTreeInfo * clone() const;
00061
00063 CglTreeInfo &
00064 operator=(
00065 const CglTreeInfo& rhs);
00066
00068 virtual
00069 ~CglTreeInfo ();
00071 virtual bool fixes(int , int , int ,bool) {return false;}
00074 virtual int initializeFixing(const OsiSolverInterface * ) {return 0;}
00075
00076 };
00077
00079 typedef struct {
00080
00081
00082 unsigned int fixes;
00083 } CliqueEntry;
00084
00085 class CglTreeProbingInfo : public CglTreeInfo {
00086 public:
00088 CglTreeProbingInfo ();
00090 CglTreeProbingInfo (const OsiSolverInterface * model);
00091
00093 CglTreeProbingInfo (
00094 const CglTreeProbingInfo &);
00096 virtual CglTreeInfo * clone() const;
00097
00099 CglTreeProbingInfo &
00100 operator=(
00101 const CglTreeProbingInfo& rhs);
00102
00104 virtual
00105 ~CglTreeProbingInfo ();
00106 OsiSolverInterface * analyze(const OsiSolverInterface & si, int createSolver=0,
00107 int numberExtraCliques=0,const int * starts=NULL,
00108 const CliqueEntry * entries=NULL,const char * type=NULL);
00112 virtual bool fixes(int variable, int toValue, int fixedVariable,bool fixedToLower);
00115 virtual int initializeFixing(const OsiSolverInterface * model) ;
00117 int fixColumns(OsiSolverInterface & si) const;
00119 int fixColumns(int iColumn, int value, OsiSolverInterface & si) const;
00121 int packDown();
00123 void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
00124 const CglTreeInfo info) const;
00126 inline CliqueEntry * fixEntries()
00127 { convert(); return fixEntry_;}
00129 inline int * toZero()
00130 { convert(); return toZero_;}
00132 inline int * toOne()
00133 { convert(); return toOne_;}
00135 inline int * integerVariable() const
00136 { return integerVariable_;}
00138 inline int * backward() const
00139 { return backward_;}
00141 inline int numberVariables() const
00142 { return numberVariables_;}
00144 inline int numberIntegers() const
00145 { return numberIntegers_;}
00146 private:
00148 void convert();
00149 protected:
00151 CliqueEntry * fixEntry_;
00153 int * toZero_;
00155 int * toOne_;
00157 int * integerVariable_;
00159 int * backward_;
00161 int * fixingEntry_;
00163 int numberVariables_;
00165 int numberIntegers_;
00167 int maximumEntries_;
00169 int numberEntries_;
00170 };
00171 inline int sequenceInCliqueEntry(const CliqueEntry & cEntry)
00172 { return cEntry.fixes&0x7fffffff;}
00173 inline void setSequenceInCliqueEntry(CliqueEntry & cEntry,int sequence)
00174 { cEntry.fixes = sequence|(cEntry.fixes&0x80000000);}
00175 inline bool oneFixesInCliqueEntry(const CliqueEntry & cEntry)
00176 { return (cEntry.fixes&0x80000000)!=0;}
00177 inline void setOneFixesInCliqueEntry(CliqueEntry & cEntry,bool oneFixes)
00178 { cEntry.fixes = (oneFixes ? 0x80000000 : 0)|(cEntry.fixes&0x7fffffff);}
00179
00180 #endif