Cgl  0.59.9
 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 1201 2014-03-07 17:24:04Z forrest $
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;
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,
107  int numberExtraCliques=0,const int * starts=NULL,
108  const CliqueEntry * entries=NULL,const char * type=NULL);
112  virtual bool fixes(int variable, int toValue, int fixedVariable,bool fixedToLower);
115  virtual int initializeFixing(const OsiSolverInterface * model) ;
117  int fixColumns(OsiSolverInterface & si) const;
119  int fixColumns(int iColumn, int value, OsiSolverInterface & si) const;
121  int packDown();
123  void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
124  const CglTreeInfo info) const;
127  { convert(); return fixEntry_;}
129  inline int * toZero()
130  { convert(); return toZero_;}
132  inline int * toOne()
133  { convert(); return toOne_;}
135  inline int * integerVariable() const
136  { return integerVariable_;}
138  inline int * backward() const
139  { return backward_;}
141  inline int numberVariables() const
142  { return numberVariables_;}
144  inline int numberIntegers() const
145  { return numberIntegers_;}
146 private:
148  void convert();
149 protected:
153  int * toZero_;
155  int * toOne_;
159  int * backward_;
170 };
171 inline int sequenceInCliqueEntry(const CliqueEntry & cEntry)
172 { return cEntry.fixes&0x7fffffff;}
173 inline void setSequenceInCliqueEntry(CliqueEntry & cEntry,int sequence)
174 { cEntry.fixes = sequence|(cEntry.fixes&0x80000000);}
175 inline bool oneFixesInCliqueEntry(const CliqueEntry & cEntry)
176 { return (cEntry.fixes&0x80000000)!=0;}
177 inline void setOneFixesInCliqueEntry(CliqueEntry & cEntry,bool oneFixes)
178 { cEntry.fixes = (oneFixes ? 0x80000000 : 0)|(cEntry.fixes&0x7fffffff);}
179 
180 #endif
int * toZero()
Starts of integer variable going to zero.
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.
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 * 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_.
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:79
OsiSolverInterface * analyze(const OsiSolverInterface &si, int createSolver=0, int numberExtraCliques=0, const int *starts=NULL, const CliqueEntry *entries=NULL, const char *type=NULL)
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.
CglTreeInfo()
Default constructor.
unsigned int fixes
Definition: CglTreeInfo.hpp:82
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
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:74
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:71
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.
Class for thread specific random numbers.
CoinThreadRandom * randomNumberGenerator
Optional pointer to thread specific random number generator.
Definition: CglTreeInfo.hpp:52