Biorithm
1.1
|
This class holds a table of item sets. It is important to maintain a hash hash table and a vector at the same time to manage fast lookups and keep everything in order. More...
#include <GenericLattice.h>
Classes | |
struct | assoc |
Public Member Functions | |
GenericLattice (BinaryMatrix *bm=NULL, unsigned int bufferSize=1000, Evaluator *evaluator=NULL, bool order=false, bool keepFailures=false) | |
GenericLattice (const GenericLattice &src) | |
virtual | ~GenericLattice () |
virtual GenericLattice & | operator= (const GenericLattice &rhs) |
virtual void | setBinaryMatrix (BinaryMatrix *bm) |
virtual void | generateCandidates (unsigned int level) |
virtual void | generateCandidates (unsigned int level, unsigned int k) |
virtual bool | hasNextCandidate () const |
virtual Itemset * | getNextCandidate () |
virtual void | evaluateItemset (Itemset *is) |
virtual void | flushEvaluationBuffer () |
virtual unsigned int | getUpperBound () const |
virtual void | setEvaluator (Evaluator *evaluator) |
virtual void | setBufferSize (unsigned int bufferSize) |
virtual unsigned int | analyzeLevel (unsigned int level) |
virtual unsigned int | analyzeLevel (unsigned int level, double &status) |
virtual unsigned int | analyzeLevel (unsigned int level, unsigned int k) |
virtual unsigned int | analyzeLevel (unsigned int level, unsigned int k, double &status) |
virtual bool | isEmpty (unsigned int level) const |
virtual unsigned int | getSize () const |
virtual unsigned int | getSize (unsigned int level) const |
virtual unsigned int | getSuccessful (unsigned int level) const |
virtual const Itemset * | getItemset (unsigned int level, unsigned int index) const |
virtual const Itemset * | getItemset (unsigned int level, unsigned int index, unsigned int &upperBound) const |
virtual void | generatePositiveBorder (unsigned int level) |
virtual bool | hasNextPositiveBorder () const |
virtual const Itemset * | getNextPositiveBorder () |
virtual void | destroy () |
virtual unsigned int | getWidth () const |
void | dontKeepFailures () |
void | keepFailures () |
Protected Member Functions | |
virtual void | createCandidate () |
virtual void | candidateTick () |
virtual void | makeNotPositiveSubsets (const Itemset *is) |
virtual void | fillDnevals (Itemset *is) |
Protected Attributes | |
vector< ItemsetLevel< struct assoc > > | levels |
ItemsetLevel< bool > | dnevals |
BinaryMatrix * | bm |
Evaluator * | evaluator |
bool | order |
unsigned int | targetCandidate |
unsigned int | lowerCandidate |
unsigned int | kCandidate |
unsigned int | upperDneval |
Rotor | candidateRotor |
Itemset * | nextCandidate |
vector< Itemset * > | eBuffer |
unsigned int | eBufferPos |
unsigned int | borderPos |
unsigned int | borderLevel |
vector< unsigned int > | successful |
unsigned int | maxlev |
ItemsetLevel< bool >::iterator | dnevaliter |
bool | keepFs |
This class holds a table of item sets. It is important to maintain a hash hash table and a vector at the same time to manage fast lookups and keep everything in order.
Header for the GenericLattice
GenericLattice::GenericLattice | ( | BinaryMatrix * | bm = NULL , |
unsigned int | bufferSize = 1000 , |
||
Evaluator * | evaluator = NULL , |
||
bool | order = false , |
||
bool | keepFs = false |
||
) |
GenericLattice.cpp The GenericLattice
------------------------------- Parameters ------------------------------- BinaryMatrix* bm The truth matrix unsigned int bs The buffer size Evaluator* evaluator The evaluator
GenericLattice::GenericLattice | ( | const GenericLattice & | src | ) |
The copy constructor
------------------------------- Parameters ------------------------------- const GenericLattice& src The source lattice
GenericLattice::~GenericLattice | ( | ) | [virtual] |
The destructor
unsigned int GenericLattice::analyzeLevel | ( | unsigned int | level | ) | [virtual] |
Analyzes the entire level
------------------------------- Parameters ------------------------------- unsigned int level The level that we want to analyze
Implements Lattice.
unsigned int GenericLattice::analyzeLevel | ( | unsigned int | level, |
double & | status | ||
) | [virtual] |
Analyzes the entire level
------------------------------- Parameters ------------------------------- unsigned int level The level that we want to analyze double& status The current status in analyzing the level
Implements Lattice.
unsigned int GenericLattice::analyzeLevel | ( | unsigned int | level, |
unsigned int | k | ||
) | [virtual] |
Analyzes the entire level
------------------------------- Parameters ------------------------------- unsigned int level The level that we want to analyze unsigned int k The target level
Implements Lattice.
unsigned int GenericLattice::analyzeLevel | ( | unsigned int | level, |
unsigned int | k, | ||
double & | status | ||
) | [virtual] |
Analyzes the entire level
------------------------------- Parameters ------------------------------- unsigned int level The level that we want to analyze unsigned int k The target level double& status The current status in analyzing the level
Implements Lattice.
void GenericLattice::candidateTick | ( | ) | [protected, virtual] |
Moves the candidate rotor to the next valid position
void GenericLattice::createCandidate | ( | ) | [protected, virtual] |
Takes the union of the candidate rotor and sees if every correct size subset exists within it
void GenericLattice::destroy | ( | ) | [virtual] |
Destroys all the memory in the lattice
Implements Lattice.
void GenericLattice::dontKeepFailures | ( | ) |
Tells the lattice not to keep failures
void GenericLattice::evaluateItemset | ( | Itemset * | is | ) | [virtual] |
Adds an itemset to the evaluation buffer
------------------------------- Parameters ------------------------------- Itemset* is The itemset
Implements Lattice.
void GenericLattice::fillDnevals | ( | Itemset * | is | ) | [protected, virtual] |
Fills the dnevals with the subsets of the given itemset
------------------------------- Parameters ------------------------------- Itemset* is The itemset that we need to generate subsets for
void GenericLattice::flushEvaluationBuffer | ( | ) | [virtual] |
Evaluates all the itemsets in the evaluation buffer
Implements Lattice.
void GenericLattice::generateCandidates | ( | unsigned int | level | ) | [virtual] |
Sets in motion generating candidates
This won't actually work if we aren't doing something that evaluates one level at a time (though not necessarily in order)
------------------------------ Preconditions ----------------------------- We have a truth matrix
We have completed a level somewhere below the level we are trying to generate candidates for
We have been adding the items lexicographically in order
------------------------------- Parameters ------------------------------- unsigned int level The level
Implements Lattice.
void GenericLattice::generateCandidates | ( | unsigned int | level, |
unsigned int | k | ||
) | [virtual] |
Sets in motion generating candidates
This won't actually work if we aren't doing something that evaluates one level at a time (though not necessarily in order)
------------------------------ Preconditions ----------------------------- We have a truth matrix
We have completed a level somewhere below the level we are trying to generate candidates for
We have been adding the items lexicographically in order
------------------------------- Parameters ------------------------------- unsigned int level The level unsigned int k The target level
Implements Lattice.
void GenericLattice::generatePositiveBorder | ( | unsigned int | level | ) | [virtual] |
Generates the positive border
------------------------------- Parameters ------------------------------- unsigned int level The level that we want to check
--------------------------------- Return --------------------------------- The size of the level
Implements Lattice.
const Itemset * GenericLattice::getItemset | ( | unsigned int | level, |
unsigned int | index | ||
) | const [virtual] |
Gets the itemset requested
------------------------------ Preconditions ----------------------------- level < levels.size() index < levels[level].size() !ordered
------------------------------- Parameters ------------------------------- unsigned int level The level from which we should pull this itemset unsigned int index The index at which this itemset resides
--------------------------------- Return --------------------------------- That itemset
Implements Lattice.
const Itemset * GenericLattice::getItemset | ( | unsigned int | level, |
unsigned int | index, | ||
unsigned int & | upperBound | ||
) | const [virtual] |
Gets the itemset requested
------------------------------ Preconditions ----------------------------- level < levels.size() index < levels[level].size() !ordered
------------------------------- Parameters ------------------------------- unsigned int level The level from which we should pull this itemset unsigned int index The index at which this itemset resides unsigned int& upperBound The upperBound of the itemset
--------------------------------- Return --------------------------------- That itemset
Implements Lattice.
Itemset * GenericLattice::getNextCandidate | ( | ) | [virtual] |
Sees if there is a candidate queued up
------------------------------ Preconditions ----------------------------- There must be another candidate
--------------------------------- Return --------------------------------- true: There is another candidate false: There is not another candidate
Implements Lattice.
const Itemset * GenericLattice::getNextPositiveBorder | ( | ) | [virtual] |
Gets the next itemset on the positive border er
--------------------------------- Return --------------------------------- The next itemset on the positive border
Implements Lattice.
unsigned int GenericLattice::getSize | ( | ) | const [virtual] |
Gets the number of levels (not counting the 0 level)
--------------------------------- Return --------------------------------- The number of levels
Implements Lattice.
unsigned int GenericLattice::getSize | ( | unsigned int | level | ) | const [virtual] |
Gets the size of a certain level
------------------------------ Preconditions ----------------------------- We have to have this many levels actually in the lattice
------------------------------- Parameters ------------------------------- unsigned int level The level that we want to check
--------------------------------- Return --------------------------------- The size of the level
Implements Lattice.
unsigned int GenericLattice::getSuccessful | ( | unsigned int | level | ) | const [virtual] |
Gets the number of successful itemsets at a given level
------------------------------- Parameters ------------------------------- unsigned int level The level that we want to check
--------------------------------- Return --------------------------------- The number of successful itemsets
Implements Lattice.
unsigned int GenericLattice::getUpperBound | ( | ) | const [virtual] |
Gets the upper bound for an itemset
------------------------------- Parameters ------------------------------- unsigned int level The level the itemset is at unsigned int index The index of the itemset
--------------------------------- Return --------------------------------- The upper bound of the itemset
Implements Lattice.
unsigned int GenericLattice::getWidth | ( | ) | const [virtual] |
Gets the width of the truth matrix
--------------------------------- Return --------------------------------- The width of the truth matrix
Implements Lattice.
bool GenericLattice::hasNextCandidate | ( | ) | const [virtual] |
Sees if there is a candidate queued up
--------------------------------- Return --------------------------------- true: There is another candidate false: There is not another candidate
Implements Lattice.
bool GenericLattice::hasNextPositiveBorder | ( | ) | const [virtual] |
Sees if the lattice has another positive border
--------------------------------- Return --------------------------------- true: there is another positive border element false: there is not another positive border element
Implements Lattice.
bool GenericLattice::isEmpty | ( | unsigned int | level | ) | const [virtual] |
Sees if a certain level is empty
------------------------------- Parameters ------------------------------- unsigned int level The level that we want to check
--------------------------------- Return --------------------------------- true: The level is empty false: The level is not empty
Implements Lattice.
void GenericLattice::keepFailures | ( | ) |
Tells the lattice not to keep failures
void GenericLattice::makeNotPositiveSubsets | ( | const Itemset * | is | ) | [protected, virtual] |
Makes all the subsets of this itemset not part of the positive border
------------------------------- Parameters ------------------------------- Itemset* is The itemset
GenericLattice & GenericLattice::operator= | ( | const GenericLattice & | rhs | ) | [virtual] |
The = operator
------------------------------- Parameters ------------------------------- const GenericLattice& rhs The right hand side
--------------------------------- Return --------------------------------- A reference to the lattice
void GenericLattice::setBinaryMatrix | ( | BinaryMatrix * | bm | ) | [virtual] |
sets the truth matrix
------------------------------ Preconditions ----------------------------- We have not had a previous binary matrix or we have successfully destroyed the previous itemsets
------------------------------- Parameters ------------------------------- BinaryMatrix* bm The truth matrix
Implements Lattice.
void GenericLattice::setBufferSize | ( | unsigned int | bufferSize | ) | [virtual] |
Resizes the buffers
------------------------------- Parameters ------------------------------- unsigned int bufferSize The new size of the evaluation buffers
Implements Lattice.
void GenericLattice::setEvaluator | ( | Evaluator * | evaluator | ) | [virtual] |
Sets the evaluator
------------------------------- Parameters ------------------------------- Evaluator* evaluator The evaluator
Implements Lattice.