Cgl 0.60.3
Loading...
Searching...
No Matches
CglTreeInfo.hpp
Go to the documentation of this file.
1// $Id$
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"
12class CglStored;
16public:
18 int level;
21 int pass;
40 bool inTree;
47 OsiSolverInterface *parentSolver;
59 OsiRowCut **strengthenRow;
61 CoinThreadRandom *randomNumberGenerator;
64
67 const CglTreeInfo &);
69 virtual CglTreeInfo *clone() const;
70
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
86typedef 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;
91
93public:
97 CglTreeProbingInfo(const OsiSolverInterface *model);
98
101 const CglTreeProbingInfo &);
103 virtual CglTreeInfo *clone() const;
104
108 const CglTreeProbingInfo &rhs);
109
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
170private:
172 void convert();
173
174protected:
180 int *toOne_;
195};
196inline int sequenceInCliqueEntry(const CliqueEntry &cEntry)
197{
198 return cEntry.fixes & 0x7fffffff;
199}
200inline void setSequenceInCliqueEntry(CliqueEntry &cEntry, int sequence)
201{
202 cEntry.fixes = sequence | (cEntry.fixes & 0x80000000);
203}
204inline bool oneFixesInCliqueEntry(const CliqueEntry &cEntry)
205{
206 return (cEntry.fixes & 0x80000000) != 0;
207}
208inline 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*/
bool oneFixesInCliqueEntry(const CliqueEntry &cEntry)
int sequenceInCliqueEntry(const CliqueEntry &cEntry)
void setSequenceInCliqueEntry(CliqueEntry &cEntry, int sequence)
void setOneFixesInCliqueEntry(CliqueEntry &cEntry, bool oneFixes)
Stored Cut Generator Class.
Definition: CglStored.hpp:16
Information about where the cut generator is invoked from.
Definition: CglTreeInfo.hpp:15
int level
The level of the search tree node.
Definition: CglTreeInfo.hpp:18
int pass
How many times the cut generator was already invoked in this search tree node.
Definition: CglTreeInfo.hpp:21
CoinThreadRandom * randomNumberGenerator
Optional pointer to thread specific random number generator.
Definition: CglTreeInfo.hpp:61
CglTreeInfo(const CglTreeInfo &)
Copy constructor.
bool inTree
Set true if in tree (to avoid ambiguity at first branch)
Definition: CglTreeInfo.hpp:40
OsiRowCut ** strengthenRow
Replacement array.
Definition: CglTreeInfo.hpp:59
int * originalColumns
Original columns (if preprocessed)
Definition: CglTreeInfo.hpp:49
int options
Options 1 - treat costed integers as important 2 - switch off some stuff as variables semi-integer 4 ...
Definition: CglTreeInfo.hpp:38
OsiSolverInterface * parentSolver
parent solver
Definition: CglTreeInfo.hpp:47
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:82
virtual ~CglTreeInfo()
Destructor.
virtual CglTreeInfo * clone() const
Clone.
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
CglTreeInfo()
Default constructor.
CglTreeInfo & operator=(const CglTreeInfo &rhs)
Assignment operator.
int hasParent
nonzero if called from child of main model 1 if heuristic run 2 if doing full search
Definition: CglTreeInfo.hpp:45
int formulation_rows
The number of rows in the original formulation.
Definition: CglTreeInfo.hpp:24
void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info) const
Generate cuts from implications.
int numberEntries_
Number entries in fixingEntry_ (and fixEntry_) or -2 if correct style.
int maximumEntries_
Maximum number in fixEntry_.
int packDown()
Packs down entries.
void convert()
Converts to ordered.
int * backward_
Backward look up.
int fixColumns(OsiSolverInterface &si) const
Fix entries in a solver using implications.
CliqueEntry * fixEntries()
Entries for fixing variables.
int * fixingEntry_
Entries for fixing variable when collecting.
int * toOne_
Starts of integer variable going to one.
virtual ~CglTreeProbingInfo()
Destructor.
int numberIntegers_
Number of 0-1 variables.
virtual CglTreeInfo * clone() const
Clone.
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 * integerVariable() const
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...
int * toZero()
Starts of integer variable going to zero.
OsiSolverInterface * analyze(const OsiSolverInterface &si, int createSolver=0, int numberExtraCliques=0, const CoinBigIndex *starts=NULL, const CliqueEntry *entries=NULL, const char *type=NULL)
int * integerVariable_
List of 0-1 integer variables.
int * toZero_
Starts of integer variable going to zero.
CglTreeProbingInfo(const CglTreeProbingInfo &)
Copy constructor.
int fixColumns(int iColumn, int value, OsiSolverInterface &si) const
Fix entries in a solver using implications for one variable.
int numberIntegers() const
Number of 0-1 variables.
CglTreeProbingInfo & operator=(const CglTreeProbingInfo &rhs)
Assignment operator.
int numberVariables_
Number of variables.
int numberVariables() const
Number of variables.
int * backward() const
Backward look up.
CglTreeProbingInfo(const OsiSolverInterface *model)
Constructor from model.
CliqueEntry * fixEntry_
Entries for fixing variables.
int * toOne()
Starts of integer variable going to one.
CglTreeProbingInfo()
Default constructor.
Derived class to pick up probing info.
Definition: CglTreeInfo.hpp:86
unsigned int fixes
Definition: CglTreeInfo.hpp:89