Empirical
Public Member Functions | List of all members
emp::SolveState Class Reference

#include <SolveState.h>

Public Member Functions

 SolveState (size_t state_size=0)
 
 SolveState (const SolveState &in)
 
 ~SolveState ()
 
SolveStateoperator= (const SolveState &in)
 Set this SolveState to be identical to another. More...
 
size_t GetSize () const
 How many items are being considered in the current SolveState? More...
 
bool IsIn (size_t id) const
 
bool IsUnk (size_t id) const
 
bool IsOut (size_t id) const
 
bool IsFinal () const
 Test if all items have been decided upon (none are still in the "unknown" state) More...
 
size_t CountIn () const
 How many items have been included for sure? More...
 
size_t CountUnk () const
 How many items have yet to be decided upon (are "unknown") More...
 
size_t CountOut () const
 How many items have been excluded for sure. More...
 
const BitVectorGetInVector () const
 Get the BitVector associated with which items have been included for sure. More...
 
const BitVectorGetUnkVector () const
 Get the BitVector associated with which items have yet to be decided upon. More...
 
BitVector GetOutVector () const
 Get the BitVector associated with which iterm have been excluded for sure. More...
 
int GetNextUnk (size_t prev_unk) const
 Get the ID of the next unknown item. More...
 
void Include (size_t id)
 Mark a specific item as to be included. More...
 
void Exclude (size_t id)
 Mark a specific item as to be excluded. More...
 
void ForceExclude (size_t id)
 
void IncludeSet (const BitVector &inc_set)
 Include ALL of the items specified in the provided BitVector. More...
 
void ExcludeSet (const BitVector &inc_set)
 Exclude ALL of the items specified in the provided BitVector. More...
 

Detailed Description

Often in a branch-and-bound algorithm, we need to identify the sub-set of items that maximizes (or minimizes) an optimization metric. SolveState keeps track of the current state for which items have been locked in as "included" in the current branks, which have been "excluded", and which are still "unknown" (still to be decided upon.) All tracking is performed with BitVectors for high efficiency.

Constructor & Destructor Documentation

emp::SolveState::SolveState ( size_t  state_size = 0)
inline
emp::SolveState::SolveState ( const SolveState in)
inline
emp::SolveState::~SolveState ( )
inline

Member Function Documentation

size_t emp::SolveState::CountIn ( ) const
inline

How many items have been included for sure?

size_t emp::SolveState::CountOut ( ) const
inline

How many items have been excluded for sure.

size_t emp::SolveState::CountUnk ( ) const
inline

How many items have yet to be decided upon (are "unknown")

void emp::SolveState::Exclude ( size_t  id)
inline

Mark a specific item as to be excluded.

void emp::SolveState::ExcludeSet ( const BitVector inc_set)
inline

Exclude ALL of the items specified in the provided BitVector.

void emp::SolveState::ForceExclude ( size_t  id)
inline

Change our mind about a potentially included node (Be careful since many algorithms don't requite this type of changes to be made.)

const BitVector& emp::SolveState::GetInVector ( ) const
inline

Get the BitVector associated with which items have been included for sure.

int emp::SolveState::GetNextUnk ( size_t  prev_unk) const
inline

Get the ID of the next unknown item.

BitVector emp::SolveState::GetOutVector ( ) const
inline

Get the BitVector associated with which iterm have been excluded for sure.

size_t emp::SolveState::GetSize ( ) const
inline

How many items are being considered in the current SolveState?

const BitVector& emp::SolveState::GetUnkVector ( ) const
inline

Get the BitVector associated with which items have yet to be decided upon.

void emp::SolveState::Include ( size_t  id)
inline

Mark a specific item as to be included.

void emp::SolveState::IncludeSet ( const BitVector inc_set)
inline

Include ALL of the items specified in the provided BitVector.

bool emp::SolveState::IsFinal ( ) const
inline

Test if all items have been decided upon (none are still in the "unknown" state)

bool emp::SolveState::IsIn ( size_t  id) const
inline

Test if a particular item is going to be included for sure in the current solve state. (If it has been excluded -OR- is yet to be decided upon, false will be returned)

bool emp::SolveState::IsOut ( size_t  id) const
inline

Test if a particular item is going to be excluded for sure in the current solve state. (If it has been included -OR- is yet to be decided upon, false will be returned)

bool emp::SolveState::IsUnk ( size_t  id) const
inline

Test if a particular item is yet to be decided upon in the current solve state. (If it has been excluded -OR- is included for sure, false will be returned)

SolveState& emp::SolveState::operator= ( const SolveState in)
inline

Set this SolveState to be identical to another.


The documentation for this class was generated from the following file: