Cbc  2.10.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CglTreeInfo.hpp
Go to the documentation of this file.
1 // $Id: CglTreeInfo.hpp 1442 2019-01-06 16:39:41Z unxusr $
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;
45  int hasParent;
63  CglTreeInfo();
64 
67  const CglTreeInfo &);
69  virtual CglTreeInfo *clone() const;
70 
72  CglTreeInfo &
73  operator=(
74  const CglTreeInfo &rhs);
75 
77  virtual ~CglTreeInfo();
79  virtual bool fixes(int, int, int, bool) { return false; }
82  virtual int initializeFixing(const OsiSolverInterface *) { return 0; }
83 };
84 
86 typedef struct {
87  //unsigned int oneFixed:1; // nonzero if variable to 1 fixes all
88  //unsigned int sequence:31; // variable (in matrix) (but also see cliqueRow_)
89  unsigned int fixes;
90 } CliqueEntry;
91 
93 public:
98 
101  const CglTreeProbingInfo &);
103  virtual CglTreeInfo *clone() const;
104 
107  operator=(
108  const CglTreeProbingInfo &rhs);
109 
111  virtual ~CglTreeProbingInfo();
112  OsiSolverInterface *analyze(const OsiSolverInterface &si, int createSolver = 0,
113  int numberExtraCliques = 0, const CoinBigIndex *starts = NULL,
114  const CliqueEntry *entries = NULL, const char *type = NULL);
118  virtual bool fixes(int variable, int toValue, int fixedVariable, bool fixedToLower);
121  virtual int initializeFixing(const OsiSolverInterface *model);
123  int fixColumns(OsiSolverInterface &si) const;
125  int fixColumns(int iColumn, int value, OsiSolverInterface &si) const;
127  int packDown();
129  void generateCuts(const OsiSolverInterface &si, OsiCuts &cs,
130  const CglTreeInfo info) const;
133  {
134  convert();
135  return fixEntry_;
136  }
138  inline int *toZero()
139  {
140  convert();
141  return toZero_;
142  }
144  inline int *toOne()
145  {
146  convert();
147  return toOne_;
148  }
150  inline int *integerVariable() const
151  {
152  return integerVariable_;
153  }
155  inline int *backward() const
156  {
157  return backward_;
158  }
160  inline int numberVariables() const
161  {
162  return numberVariables_;
163  }
165  inline int numberIntegers() const
166  {
167  return numberIntegers_;
168  }
169 
170 private:
172  void convert();
173 
174 protected:
178  int *toZero_;
180  int *toOne_;
184  int *backward_;
195 };
196 inline int sequenceInCliqueEntry(const CliqueEntry &cEntry)
197 {
198  return cEntry.fixes & 0x7fffffff;
199 }
200 inline void setSequenceInCliqueEntry(CliqueEntry &cEntry, int sequence)
201 {
202  cEntry.fixes = sequence | (cEntry.fixes & 0x80000000);
203 }
204 inline bool oneFixesInCliqueEntry(const CliqueEntry &cEntry)
205 {
206  return (cEntry.fixes & 0x80000000) != 0;
207 }
208 inline void setOneFixesInCliqueEntry(CliqueEntry &cEntry, bool oneFixes)
209 {
210  cEntry.fixes = (oneFixes ? 0x80000000 : 0) | (cEntry.fixes & 0x7fffffff);
211 }
212 
213 #endif
214 
215 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
216 */
int * toZero()
Starts of integer variable going to zero.
OsiRowCut ** strengthenRow
Replacement array.
Definition: CglTreeInfo.hpp:59
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.
CliqueEntry * fixEntries()
Entries for fixing variables.
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.
void setSequenceInCliqueEntry(CliqueEntry &cEntry, int sequence)
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
void convert()
Converts to ordered.
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
int hasParent
nonzero if called from child of main model 1 if heuristic run 2 if doing full search ...
Definition: CglTreeInfo.hpp:45
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_.
OsiSolverInterface * analyze(const OsiSolverInterface &si, int createSolver=0, int numberExtraCliques=0, const CoinBigIndex *starts=NULL, const CliqueEntry *entries=NULL, const char *type=NULL)
int * backward_
Backward look up.
int formulation_rows
The number of rows in the original formulation.
Definition: CglTreeInfo.hpp:24
Abstract Base Class for describing an interface to a solver.
bool oneFixesInCliqueEntry(const CliqueEntry &cEntry)
int * backward() const
Backward look up.
Derived class to pick up probing info.
Definition: CglTreeInfo.hpp:86
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 use...
CliqueEntry * fixEntry_
Entries for fixing variables.
int numberEntries_
Number entries in fixingEntry_ (and fixEntry_) or -2 if correct style.
CglTreeInfo & operator=(const CglTreeInfo &rhs)
Assignment operator.
OsiSolverInterface * parentSolver
parent solver
Definition: CglTreeInfo.hpp:47
CglTreeInfo()
Default constructor.
unsigned int fixes
Definition: CglTreeInfo.hpp:89
int * integerVariable_
List of 0-1 integer variables.
Row Cut Class.
Definition: OsiRowCut.hpp:29
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...
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
int CoinBigIndex
virtual ~CglTreeProbingInfo()
Destructor.
int sequenceInCliqueEntry(const CliqueEntry &cEntry)
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 use...
Definition: CglTreeInfo.hpp:82
void setOneFixesInCliqueEntry(CliqueEntry &cEntry, bool oneFixes)
CglTreeProbingInfo & operator=(const CglTreeProbingInfo &rhs)
Assignment operator.
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:79
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.
int * originalColumns
Original columns (if preprocessed)
Definition: CglTreeInfo.hpp:49
Class for thread specific random numbers.
CoinThreadRandom * randomNumberGenerator
Optional pointer to thread specific random number generator.
Definition: CglTreeInfo.hpp:61