Loading...
Searching...
No Matches
CglTreeInfo.hpp
Go to the documentation of this file.
// $Id$
// Copyright (C) 2000, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef CglTreeInfo_H
#define CglTreeInfo_H
#include "OsiCuts.hpp"
#include "OsiSolverInterface.hpp"
#include "CoinHelperFunctions.hpp"
class CglStored;
class CglTreeInfo {
public:
int level;
int pass;
int formulation_rows;
int options;
bool inTree;
int hasParent;
OsiSolverInterface *parentSolver;
int *originalColumns;
OsiRowCut **strengthenRow;
CoinThreadRandom *randomNumberGenerator;
CglTreeInfo();
CglTreeInfo(
const CglTreeInfo &);
virtual CglTreeInfo *clone() const;
CglTreeInfo &
operator=(
const CglTreeInfo &rhs);
virtual ~CglTreeInfo();
virtual bool fixes(int, int, int, bool) { return false; }
virtual int initializeFixing(const OsiSolverInterface *) { return 0; }
};
typedef struct {
//unsigned int oneFixed:1; // nonzero if variable to 1 fixes all
//unsigned int sequence:31; // variable (in matrix) (but also see cliqueRow_)
unsigned int fixes;
} CliqueEntry;
class CglTreeProbingInfo : public CglTreeInfo {
public:
CglTreeProbingInfo();
CglTreeProbingInfo(const OsiSolverInterface *model);
CglTreeProbingInfo(
const CglTreeProbingInfo &);
virtual CglTreeInfo *clone() const;
CglTreeProbingInfo &
operator=(
const CglTreeProbingInfo &rhs);
virtual ~CglTreeProbingInfo();
OsiSolverInterface *analyze(const OsiSolverInterface &si, int createSolver = 0,
int numberExtraCliques = 0, const CoinBigIndex *starts = NULL,
const CliqueEntry *entries = NULL, const char *type = NULL);
virtual bool fixes(int variable, int toValue, int fixedVariable, bool fixedToLower);
virtual int initializeFixing(const OsiSolverInterface *model);
int fixColumns(OsiSolverInterface &si) const;
int fixColumns(int iColumn, int value, OsiSolverInterface &si) const;
int packDown();
void generateCuts(const OsiSolverInterface &si, OsiCuts &cs,
const CglTreeInfo info) const;
inline CliqueEntry *fixEntries()
{
convert();
return fixEntry_;
}
inline int *toZero()
{
convert();
return toZero_;
}
inline int *toOne()
{
convert();
return toOne_;
}
inline int *integerVariable() const
{
return integerVariable_;
}
inline int *backward() const
{
return backward_;
}
inline int numberVariables() const
{
return numberVariables_;
}
inline int numberIntegers() const
{
return numberIntegers_;
}
private:
void convert();
protected:
CliqueEntry *fixEntry_;
int *toZero_;
int *toOne_;
int *integerVariable_;
int *backward_;
int *fixingEntry_;
int numberVariables_;
int numberIntegers_;
int maximumEntries_;
int numberEntries_;
};
inline int sequenceInCliqueEntry(const CliqueEntry &cEntry)
{
return cEntry.fixes & 0x7fffffff;
}
inline void setSequenceInCliqueEntry(CliqueEntry &cEntry, int sequence)
{
cEntry.fixes = sequence | (cEntry.fixes & 0x80000000);
}
inline bool oneFixesInCliqueEntry(const CliqueEntry &cEntry)
{
return (cEntry.fixes & 0x80000000) != 0;
}
inline void setOneFixesInCliqueEntry(CliqueEntry &cEntry, bool oneFixes)
{
cEntry.fixes = (oneFixes ? 0x80000000 : 0) | (cEntry.fixes & 0x7fffffff);
}
#endif
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/
oneFixesInCliqueEntry
bool oneFixesInCliqueEntry(const CliqueEntry &cEntry)
Definition CglTreeInfo.hpp:204
sequenceInCliqueEntry
int sequenceInCliqueEntry(const CliqueEntry &cEntry)
Definition CglTreeInfo.hpp:196
setSequenceInCliqueEntry
void setSequenceInCliqueEntry(CliqueEntry &cEntry, int sequence)
Definition CglTreeInfo.hpp:200
setOneFixesInCliqueEntry
void setOneFixesInCliqueEntry(CliqueEntry &cEntry, bool oneFixes)
Definition CglTreeInfo.hpp:208
CglStored
Stored Cut Generator Class.
Definition CglStored.hpp:16
CglTreeInfo::level
int level
The level of the search tree node.
Definition CglTreeInfo.hpp:18
CglTreeInfo::pass
int pass
How many times the cut generator was already invoked in this search tree node.
Definition CglTreeInfo.hpp:21
CglTreeInfo::randomNumberGenerator
CoinThreadRandom * randomNumberGenerator
Optional pointer to thread specific random number generator.
Definition CglTreeInfo.hpp:61
CglTreeInfo::CglTreeInfo
CglTreeInfo(const CglTreeInfo &)
Copy constructor.
CglTreeInfo::inTree
bool inTree
Set true if in tree (to avoid ambiguity at first branch).
Definition CglTreeInfo.hpp:40
CglTreeInfo::strengthenRow
OsiRowCut ** strengthenRow
Replacement array.
Definition CglTreeInfo.hpp:59
CglTreeInfo::originalColumns
int * originalColumns
Original columns (if preprocessed).
Definition CglTreeInfo.hpp:49
CglTreeInfo::options
int options
Options 1 - treat costed integers as important 2 - switch off some stuff as variables semi-integer 4 ...
Definition CglTreeInfo.hpp:38
CglTreeInfo::parentSolver
OsiSolverInterface * parentSolver
parent solver
Definition CglTreeInfo.hpp:47
CglTreeInfo::initializeFixing
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
CglTreeInfo::~CglTreeInfo
virtual ~CglTreeInfo()
Destructor.
CglTreeInfo::clone
virtual CglTreeInfo * clone() const
Clone.
CglTreeInfo::fixes
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::CglTreeInfo
CglTreeInfo()
Default constructor.
CglTreeInfo::operator=
CglTreeInfo & operator=(const CglTreeInfo &rhs)
Assignment operator.
CglTreeInfo::hasParent
int hasParent
nonzero if called from child of main model 1 if heuristic run 2 if doing full search
Definition CglTreeInfo.hpp:45
CglTreeInfo::formulation_rows
int formulation_rows
The number of rows in the original formulation.
Definition CglTreeInfo.hpp:24
CglTreeProbingInfo::generateCuts
void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info) const
Generate cuts from implications.
CglTreeProbingInfo::numberEntries_
int numberEntries_
Number entries in fixingEntry_ (and fixEntry_) or -2 if correct style.
Definition CglTreeInfo.hpp:194
CglTreeProbingInfo::maximumEntries_
int maximumEntries_
Maximum number in fixEntry_.
Definition CglTreeInfo.hpp:192
CglTreeProbingInfo::packDown
int packDown()
Packs down entries.
CglTreeProbingInfo::convert
void convert()
Converts to ordered.
CglTreeProbingInfo::backward_
int * backward_
Backward look up.
Definition CglTreeInfo.hpp:184
CglTreeProbingInfo::fixColumns
int fixColumns(OsiSolverInterface &si) const
Fix entries in a solver using implications.
CglTreeProbingInfo::fixEntries
CliqueEntry * fixEntries()
Entries for fixing variables.
Definition CglTreeInfo.hpp:132
CglTreeProbingInfo::fixingEntry_
int * fixingEntry_
Entries for fixing variable when collecting.
Definition CglTreeInfo.hpp:186
CglTreeProbingInfo::toOne_
int * toOne_
Starts of integer variable going to one.
Definition CglTreeInfo.hpp:180
CglTreeProbingInfo::~CglTreeProbingInfo
virtual ~CglTreeProbingInfo()
Destructor.
CglTreeProbingInfo::numberIntegers_
int numberIntegers_
Number of 0-1 variables.
Definition CglTreeInfo.hpp:190
CglTreeProbingInfo::clone
virtual CglTreeInfo * clone() const
Clone.
CglTreeProbingInfo::initializeFixing
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...
CglTreeProbingInfo::integerVariable
int * integerVariable() const
List of 0-1 integer variables.
Definition CglTreeInfo.hpp:150
CglTreeProbingInfo::fixes
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...
CglTreeProbingInfo::toZero
int * toZero()
Starts of integer variable going to zero.
Definition CglTreeInfo.hpp:138
CglTreeProbingInfo::analyze
OsiSolverInterface * analyze(const OsiSolverInterface &si, int createSolver=0, int numberExtraCliques=0, const CoinBigIndex *starts=NULL, const CliqueEntry *entries=NULL, const char *type=NULL)
CglTreeProbingInfo::integerVariable_
int * integerVariable_
List of 0-1 integer variables.
Definition CglTreeInfo.hpp:182
CglTreeProbingInfo::toZero_
int * toZero_
Starts of integer variable going to zero.
Definition CglTreeInfo.hpp:178
CglTreeProbingInfo::CglTreeProbingInfo
CglTreeProbingInfo(const CglTreeProbingInfo &)
Copy constructor.
CglTreeProbingInfo::fixColumns
int fixColumns(int iColumn, int value, OsiSolverInterface &si) const
Fix entries in a solver using implications for one variable.
CglTreeProbingInfo::numberIntegers
int numberIntegers() const
Number of 0-1 variables.
Definition CglTreeInfo.hpp:165
CglTreeProbingInfo::operator=
CglTreeProbingInfo & operator=(const CglTreeProbingInfo &rhs)
Assignment operator.
CglTreeProbingInfo::numberVariables_
int numberVariables_
Number of variables.
Definition CglTreeInfo.hpp:188
CglTreeProbingInfo::numberVariables
int numberVariables() const
Number of variables.
Definition CglTreeInfo.hpp:160
CglTreeProbingInfo::backward
int * backward() const
Backward look up.
Definition CglTreeInfo.hpp:155
CglTreeProbingInfo::CglTreeProbingInfo
CglTreeProbingInfo(const OsiSolverInterface *model)
Constructor from model.
CglTreeProbingInfo::fixEntry_
CliqueEntry * fixEntry_
Entries for fixing variables.
Definition CglTreeInfo.hpp:176
CglTreeProbingInfo::toOne
int * toOne()
Starts of integer variable going to one.
Definition CglTreeInfo.hpp:144
CglTreeProbingInfo::CglTreeProbingInfo
CglTreeProbingInfo()
Default constructor.
CliqueEntry
Derived class to pick up probing info.
Definition CglTreeInfo.hpp:86
CliqueEntry::fixes
unsigned int fixes
Definition CglTreeInfo.hpp:89