Biorithm  1.1
Classes | Public Member Functions | Protected Member Functions | Protected Attributes
PosLattice Class Reference

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 <PosLattice.h>

Inheritance diagram for PosLattice:
Lattice

List of all members.

Classes

struct  assoc

Public Member Functions

 PosLattice (BinaryMatrix *bm=NULL, unsigned int bufferSize=1000, Evaluator *evaluator=NULL, bool order=false)
 PosLattice (const PosLattice &src)
virtual ~PosLattice ()
virtual PosLatticeoperator= (const PosLattice &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 ItemsetgetNextCandidate ()
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 ItemsetgetItemset (unsigned int level, unsigned int index) const
virtual const ItemsetgetItemset (unsigned int level, unsigned int index, unsigned int &upperBound) const
virtual void generatePositiveBorder (unsigned int level)
virtual bool hasNextPositiveBorder () const
virtual const ItemsetgetNextPositiveBorder ()
virtual void destroy ()
virtual unsigned int getWidth () const

Protected Member Functions

virtual void generateCandidatesNonzero ()
virtual void generateCandidatesZero ()
virtual void candidateRotate ()
virtual void candidateRotateZero ()
virtual void candidateRotorStart (unsigned int pos)
virtual void candidateRotorStartZero (unsigned int pos)
virtual bool testCandidateRotor (unsigned int pos)
virtual bool testCandidateRotorZero (unsigned int pos)
virtual void createCandidate ()
virtual void candidateTick (unsigned int pos)
virtual bool badCandidateRotor (unsigned int pos) const
virtual bool createCandidateRotate (vector< unsigned int > &rotorPool, vector< unsigned int > &isRotor)
virtual bool testCreateCandidateRotor (vector< unsigned int > &isRotor, vector< unsigned int > &rotorPool, unsigned int pos, bool &success)
virtual bool createCandidateRotorStart (vector< unsigned int > &isRotor, vector< unsigned int > &rotorPool, unsigned int pos)
virtual void countSubsets (Itemset *is)
virtual void flushCountBuffer ()
virtual void countSets (const vector< Itemset * > &sets, unsigned int size)
virtual void getRowSetCounts (const Itemset *is, vector< unsigned int > &counts)
virtual void makeNotPositiveSubsets (const Itemset *is)
virtual int generateSupport (const Itemset &pos, const Itemset &neg, unsigned int start)
virtual void generateSupports (const Itemset &is, const Itemset &pos, const Itemset &neg, vector< unsigned int > &counts)

Protected Attributes

vector< ItemsetLevel< struct
assoc > > 
levels
BinaryMatrixbm
vector< Itemset * > cBuffer
Evaluatorevaluator
bool order
unsigned int targetCandidate
unsigned int lowerCandidate
unsigned int kCandidate
vector< unsigned int > candidateRotor
ItemsetnextCandidate
unsigned int cBufferPos
vector< Itemset * > eBuffer
unsigned int eBufferPos
unsigned int borderPos
unsigned int borderLevel
vector< unsigned int > successful
unsigned int maxlev

Detailed Description

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 PosLattice

Author:
Conley Owens ibcliffo@vt.edu
Date:
2007-10-17

Constructor & Destructor Documentation

PosLattice::PosLattice ( BinaryMatrix bm = NULL,
unsigned int  bufferSize = 1000,
Evaluator evaluator = NULL,
bool  order = false 
)

The PosLattice

Author:
Conley Owens ibcliffo@vt.edu
Date:
2007-10-30 The constructor

------------------------------- Parameters ------------------------------- BinaryMatrix* bm The truth matrix unsigned int bs The buffer size Evaluator* evaluator The evaluator

The copy constructor

------------------------------- Parameters ------------------------------- const PosLattice& src The source lattice

PosLattice::~PosLattice ( ) [virtual]

The destructor


Member Function Documentation

unsigned int PosLattice::analyzeLevel ( unsigned int  level) [virtual]

Analyzes the entire level

------------------------------- Parameters ------------------------------- unsigned int level The level that we want to analyze

Implements Lattice.

unsigned int PosLattice::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 PosLattice::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 PosLattice::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.

bool PosLattice::badCandidateRotor ( unsigned int  pos) const [protected, virtual]

Sees if the rotor is bad at this position

------------------------------- Parameters ------------------------------- unsigned int pos The position in the rotor

--------------------------------- Return --------------------------------- true: The rotor position is invalid false: The rotor position is valid

void PosLattice::candidateRotate ( ) [protected, virtual]

Rotates the candidate rotor until we have created a new candidate

void PosLattice::candidateRotateZero ( ) [protected, virtual]

Rotates the candidate rotor until we have created a new candidate

void PosLattice::candidateRotorStart ( unsigned int  pos) [protected, virtual]

Starts off the rotor

------------------------------- Parameters ------------------------------- unsigned int pos The position in the rotor

void PosLattice::candidateRotorStartZero ( unsigned int  pos) [protected, virtual]

Starts off the rotor

------------------------------- Parameters ------------------------------- unsigned int pos The position in the rotor

void PosLattice::candidateTick ( unsigned int  pos) [protected, virtual]

Ticks the rotor at a given position until we have a valid index Note: one step outside of the possible indecies is considered valid for

------------------------------- Parameters ------------------------------- unsigned int pos The position in the rotor

void PosLattice::countSets ( const vector< Itemset * > &  sets,
unsigned int  size 
) [protected, virtual]

Counts itemsets and adds them to the lattice

------------------------------ Preconditions ----------------------------- We have a truth matrix

------------------------------- Parameters ------------------------------- const vector<Itemset*>& sets The itemsets unsigned int size The number of sets to evaluate

void PosLattice::countSubsets ( Itemset is) [protected, virtual]

Counts the subsets of an itemset

------------------------------- Parameters ------------------------------- Itemset* is The itemset

void PosLattice::createCandidate ( ) [protected, virtual]

Takes the union of the candidate rotor and sees if every correct size subset exists within it

bool PosLattice::createCandidateRotate ( vector< unsigned int > &  isRotor,
vector< unsigned int > &  rotorPool 
) [protected, virtual]

Rotates the rotor on the itemset where we need to verify itemsets with the hashmap

------------------------------- Parameters ------------------------------- vector<unsigned int>& isRotor The itemset rotor vector<unsigned int>& rotorPool The pool of values for the rotor

--------------------------------- Return --------------------------------- true: All rotor combinations tested passed false: A rotor combination tested failed

bool PosLattice::createCandidateRotorStart ( vector< unsigned int > &  isRotor,
vector< unsigned int > &  rotorPool,
unsigned int  pos 
) [protected, virtual]

Starts off the creation rotor

------------------------------- Parameters ------------------------------- vector<unsigned int>& isRotor The itemset rotor vector<unsigned int>& rotorPool The pool of values for the rotor unsigned int pos The position

--------------------------------- Return --------------------------------- true: All rotor combinations tested passed false: A rotor combination tested failed

void PosLattice::destroy ( ) [virtual]

Destroys all the memory in the lattice

Implements Lattice.

void PosLattice::evaluateItemset ( Itemset is) [virtual]

Adds an itemset to the evaluation buffer

------------------------------- Parameters ------------------------------- Itemset* is The itemset

Implements Lattice.

void PosLattice::flushCountBuffer ( ) [protected, virtual]

Evaluates the itemsets

------------------------------- Parameters ------------------------------- const vector<Itemset*>& sets The itemsets unsigned int size The number of sets to evaluate

Evaluates all the itemsets in the evaluation buffer

Implements Lattice.

void PosLattice::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 PosLattice::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 PosLattice::generateCandidatesNonzero ( ) [protected, virtual]

Sets in motion generating candidates

void PosLattice::generateCandidatesZero ( ) [protected, virtual]

Sets in motion generating candidates

void PosLattice::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.

int PosLattice::generateSupport ( const Itemset pos,
const Itemset neg,
unsigned int  start 
) [protected, virtual]

Generates support recursively

------------------------------- Parameters ------------------------------- const Itemset& pos The itemset with all positive items const Itemset& neg The itemset with all negative items unsigned int start The start position

void PosLattice::generateSupports ( const Itemset is,
const Itemset pos,
const Itemset neg,
vector< unsigned int > &  counts 
) [protected, virtual]

Generates supports recursively

------------------------------- Parameters ------------------------------- const Itemset& is The itemset items that have not been allocated as positive or negative const Itemset& pos The itemset with all positive items const Itemset& neg The itemset with all negative items vector<unsigned int>& counts The rowset sizes

const Itemset * PosLattice::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 * PosLattice::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.

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.

Gets the next itemset on the positive border er

--------------------------------- Return --------------------------------- The next itemset on the positive border

Implements Lattice.

void PosLattice::getRowSetCounts ( const Itemset is,
vector< unsigned int > &  counts 
) [protected, virtual]

Gets the specific rowset counts

------------------------------- Parameters ------------------------------- unsigned int bufferSize The new size of the evaluation buffers

unsigned int PosLattice::getSize ( ) const [virtual]

Gets the number of levels (not counting the 0 level)

--------------------------------- Return --------------------------------- The number of levels

Implements Lattice.

unsigned int PosLattice::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 PosLattice::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 PosLattice::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 PosLattice::getWidth ( ) const [virtual]

Gets the width of the truth matrix

--------------------------------- Return --------------------------------- The width of the truth matrix

Implements Lattice.

bool PosLattice::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 PosLattice::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 PosLattice::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 PosLattice::makeNotPositiveSubsets ( const Itemset is) [protected, virtual]

Makes all the subsets of this itemset not part of the positive border

------------------------------- Parameters ------------------------------- Itemset* is The itemset

PosLattice & PosLattice::operator= ( const PosLattice rhs) [virtual]

The = operator

------------------------------- Parameters ------------------------------- const PosLattice& rhs The right hand side

--------------------------------- Return --------------------------------- A reference to the lattice

void PosLattice::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 PosLattice::setBufferSize ( unsigned int  bufferSize) [virtual]

Resizes the buffers

------------------------------- Parameters ------------------------------- unsigned int bufferSize The new size of the evaluation buffers

Implements Lattice.

void PosLattice::setEvaluator ( Evaluator evaluator) [virtual]

Sets the evaluator

------------------------------- Parameters ------------------------------- Evaluator* evaluator The evaluator

Implements Lattice.

bool PosLattice::testCandidateRotor ( unsigned int  pos) [protected, virtual]

Tests if the rotor position is valid

It also fixes the problem if it is not

------------------------------- Parameters ------------------------------- unsigned int pos The position in the rotor

bool PosLattice::testCandidateRotorZero ( unsigned int  pos) [protected, virtual]

Tests if the rotor position is valid

It also fixes the problem if it is not

------------------------------- Parameters ------------------------------- unsigned int pos The position in the rotor

bool PosLattice::testCreateCandidateRotor ( vector< unsigned int > &  isRotor,
vector< unsigned int > &  rotorPool,
unsigned int  pos,
bool &  success 
) [protected, virtual]

Checks to see if the position is valid

------------------------------- Parameters ------------------------------- vector<unsigned int>& isRotor The itemset rotor vector<unsigned int>& rotorPool The pool of values for the rotor unsigned int pos The position bool success Whether or not all tested rotor combinations passed

--------------------------------- Return --------------------------------- true: Something was invalid false: Nothing was invalid, keep moving


The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Friends