coin-Cgl
CglTreeInfo.hpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 
4 #ifndef CglTreeInfo_H
5 #define CglTreeInfo_H
6 
7 #include "OsiCuts.hpp"
8 #include "OsiSolverInterface.hpp"
9 #include "CoinHelperFunctions.hpp"
10 class CglStored;
13 class CglTreeInfo {
14 public:
16  int level;
19  int pass;
33  int options;
35  bool inTree;
45  OsiRowCut ** strengthenRow;
47  CoinThreadRandom * randomNumberGenerator;
49  CglTreeInfo ();
50 
52  CglTreeInfo (
53  const CglTreeInfo &);
55  virtual CglTreeInfo * clone() const;
56 
58  CglTreeInfo &
59  operator=(
60  const CglTreeInfo& rhs);
61 
63  virtual
64  ~CglTreeInfo ();
66  virtual bool fixes(int , int , int ,bool) {return false;}
69  virtual int initializeFixing(const OsiSolverInterface * ) {return 0;}
70 
71 };
72 
74 typedef struct {
75  //unsigned int oneFixed:1; // nonzero if variable to 1 fixes all
76  //unsigned int sequence:31; // variable (in matrix) (but also see cliqueRow_)
77  unsigned int fixes;
78 } cliqueEntry;
79 
81 public:
85  CglTreeProbingInfo (const OsiSolverInterface * model);
86 
89  const CglTreeProbingInfo &);
91  virtual CglTreeInfo * clone() const;
92 
95  operator=(
96  const CglTreeProbingInfo& rhs);
97 
99  virtual
101  OsiSolverInterface * analyze(const OsiSolverInterface & si, int createSolver=0);
105  virtual bool fixes(int variable, int toValue, int fixedVariable,bool fixedToLower);
108  virtual int initializeFixing(const OsiSolverInterface * model) ;
110  int fixColumns(OsiSolverInterface & si) const;
112  int fixColumns(int iColumn, int value, OsiSolverInterface & si) const;
114  int packDown();
116  void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
117  const CglTreeInfo info) const;
119  inline cliqueEntry * fixEntries() const
120  { convert(); return fixEntry_;}
122  inline int * toZero() const
123  { convert(); return toZero_;}
125  inline int * toOne() const
126  { convert(); return toOne_;}
128  inline int * integerVariable() const
129  { return integerVariable_;}
131  inline int * backward() const
132  { return backward_;}
134  inline int numberVariables() const
135  { return numberVariables_;}
137  inline int numberIntegers() const
138  { return numberIntegers_;}
139 private:
141  void convert() const;
142 protected:
146  mutable int * toZero_;
148  mutable int * toOne_;
152  int * backward_;
154  mutable int * fixingEntry_;
162  mutable int numberEntries_;
163 };
164 inline int sequenceInCliqueEntry(const cliqueEntry & cEntry)
165 { return cEntry.fixes&0x7fffffff;}
166 inline void setSequenceInCliqueEntry(cliqueEntry & cEntry,int sequence)
167 { cEntry.fixes = sequence|(cEntry.fixes&0x80000000);}
168 inline bool oneFixesInCliqueEntry(const cliqueEntry & cEntry)
169 { return (cEntry.fixes&0x80000000)!=0;}
170 inline void setOneFixesInCliqueEntry(cliqueEntry & cEntry,bool oneFixes)
171 { cEntry.fixes = (oneFixes ? 0x80000000 : 0)|(cEntry.fixes&0x7fffffff);}
172 
173 #endif