Cgl  0.58.9
CglTreeInfo.hpp
Go to the documentation of this file.
1 // $Id: CglTreeInfo.hpp 1123 2013-04-06 20:47:24Z stefan $
2 // Copyright (C) 2000, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CglTreeInfo_H
7 #define CglTreeInfo_H
8 
9 #include "OsiCuts.hpp"
10 #include "OsiSolverInterface.hpp"
11 #include "CoinHelperFunctions.hpp"
12 class CglStored;
15 class CglTreeInfo {
16 public:
18  int level;
21  int pass;
38  int options;
40  bool inTree;
50  OsiRowCut ** strengthenRow;
52  CoinThreadRandom * randomNumberGenerator;
54  CglTreeInfo ();
55 
57  CglTreeInfo (
58  const CglTreeInfo &);
60  virtual CglTreeInfo * clone() const;
61 
63  CglTreeInfo &
64  operator=(
65  const CglTreeInfo& rhs);
66 
68  virtual
69  ~CglTreeInfo ();
71  virtual bool fixes(int , int , int ,bool) {return false;}
74  virtual int initializeFixing(const OsiSolverInterface * ) {return 0;}
75 
76 };
77 
79 typedef struct {
80  //unsigned int oneFixed:1; // nonzero if variable to 1 fixes all
81  //unsigned int sequence:31; // variable (in matrix) (but also see cliqueRow_)
82  unsigned int fixes;
83 } cliqueEntry;
84 
86 public:
90  CglTreeProbingInfo (const OsiSolverInterface * model);
91 
94  const CglTreeProbingInfo &);
96  virtual CglTreeInfo * clone() const;
97 
100  operator=(
101  const CglTreeProbingInfo& rhs);
102 
104  virtual
106  OsiSolverInterface * analyze(const OsiSolverInterface & si, int createSolver=0);
110  virtual bool fixes(int variable, int toValue, int fixedVariable,bool fixedToLower);
113  virtual int initializeFixing(const OsiSolverInterface * model) ;
115  int fixColumns(OsiSolverInterface & si) const;
117  int fixColumns(int iColumn, int value, OsiSolverInterface & si) const;
119  int packDown();
121  void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
122  const CglTreeInfo info) const;
125  { convert(); return fixEntry_;}
127  inline int * toZero()
128  { convert(); return toZero_;}
130  inline int * toOne()
131  { convert(); return toOne_;}
133  inline int * integerVariable() const
134  { return integerVariable_;}
136  inline int * backward() const
137  { return backward_;}
139  inline int numberVariables() const
140  { return numberVariables_;}
142  inline int numberIntegers() const
143  { return numberIntegers_;}
144 private:
146  void convert();
147 protected:
151  int * toZero_;
153  int * toOne_;
157  int * backward_;
168 };
169 inline int sequenceInCliqueEntry(const cliqueEntry & cEntry)
170 { return cEntry.fixes&0x7fffffff;}
171 inline void setSequenceInCliqueEntry(cliqueEntry & cEntry,int sequence)
172 { cEntry.fixes = sequence|(cEntry.fixes&0x80000000);}
173 inline bool oneFixesInCliqueEntry(const cliqueEntry & cEntry)
174 { return (cEntry.fixes&0x80000000)!=0;}
175 inline void setOneFixesInCliqueEntry(cliqueEntry & cEntry,bool oneFixes)
176 { cEntry.fixes = (oneFixes ? 0x80000000 : 0)|(cEntry.fixes&0x7fffffff);}
177 
178 #endif
int * toZero()
Starts of integer variable going to zero.
unsigned int fixes
Definition: CglTreeInfo.hpp:82
OsiRowCut ** strengthenRow
Replacement array.
Definition: CglTreeInfo.hpp:50
virtual ~CglTreeInfo()
Destructor.
int options
Options 1 - treat costed integers as important 2 - switch off some stuff as variables semi-integer 4 ...
Definition: CglTreeInfo.hpp:38
int * toOne()
Starts of integer variable going to one.
int level
The level of the search tree node.
Definition: CglTreeInfo.hpp:18
virtual CglTreeInfo * clone() const
Clone.
int numberVariables() const
Number of variables.
virtual CglTreeInfo * clone() const
Clone.
bool oneFixesInCliqueEntry(const cliqueEntry &cEntry)
Stored Cut Generator Class.
Definition: CglStored.hpp:16
void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info) const
Generate cuts from implications.
Information about where the cut generator is invoked from.
Definition: CglTreeInfo.hpp:15
int * toZero_
Starts of integer variable going to zero.
int numberIntegers_
Number of 0-1 variables.
int numberIntegers() const
Number of 0-1 variables.
int maximumEntries_
Maximum number in fixEntry_.
Derived class to pick up probing info.
Definition: CglTreeInfo.hpp:79
int * backward_
Backward look up.
int formulation_rows
The number of rows in the original formulation.
Definition: CglTreeInfo.hpp:24
int * backward() const
Backward look up.
int * integerVariable() const
List of 0-1 integer variables.
virtual int initializeFixing(const OsiSolverInterface *model)
Initalizes fixing arrays etc - returns >0 if we want to save info 0 if we don't and -1 if is to be us...
int numberEntries_
Number entries in fixingEntry_ (and fixEntry_) or -2 if correct style.
CglTreeInfo & operator=(const CglTreeInfo &rhs)
Assignment operator.
CglTreeInfo()
Default constructor.
cliqueEntry * fixEntry_
Entries for fixing variables.
int * integerVariable_
List of 0-1 integer variables.
virtual bool fixes(int variable, int toValue, int fixedVariable, bool fixedToLower)
Take action if cut generator can fix a variable (toValue -1 for down, +1 for up) Returns true if stil...
void setSequenceInCliqueEntry(cliqueEntry &cEntry, int sequence)
int numberVariables_
Number of variables.
CglTreeProbingInfo()
Default constructor.
int pass
How many times the cut generator was already invoked in this search tree node.
Definition: CglTreeInfo.hpp:21
virtual ~CglTreeProbingInfo()
Destructor.
bool inTree
Set true if in tree (to avoid ambiguity at first branch)
Definition: CglTreeInfo.hpp:40
int * toOne_
Starts of integer variable going to one.
virtual int initializeFixing(const OsiSolverInterface *)
Initalizes fixing arrays etc - returns >0 if we want to save info 0 if we don't and -1 if is to be us...
Definition: CglTreeInfo.hpp:74
CglTreeProbingInfo & operator=(const CglTreeProbingInfo &rhs)
Assignment operator.
int sequenceInCliqueEntry(const cliqueEntry &cEntry)
virtual bool fixes(int, int, int, bool)
Take action if cut generator can fix a variable (toValue -1 for down, +1 for up)
Definition: CglTreeInfo.hpp:71
void setOneFixesInCliqueEntry(cliqueEntry &cEntry, bool oneFixes)
int * fixingEntry_
Entries for fixing variable when collecting.
int fixColumns(OsiSolverInterface &si) const
Fix entries in a solver using implications.
int packDown()
Packs down entries.
OsiSolverInterface * analyze(const OsiSolverInterface &si, int createSolver=0)
cliqueEntry * fixEntries()
Entries for fixing variables.
CoinThreadRandom * randomNumberGenerator
Optional pointer to thread specific random number generator.
Definition: CglTreeInfo.hpp:52