Feature Selection ToolboxFST3 Library / Documentation

FST::Candidate_Evaluator_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, max_threads > Class Template Reference

Implements concurrent evaluation of a criterion on a set of subset candidates. More...

#include <candidate_evaluator_threaded.hpp>

Collaboration diagram for FST::Candidate_Evaluator_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, max_threads >:

List of all members.

Classes

struct  CandidateResult
 temporary storage of subset candidate evaluation results More...
struct  ThreadLocal
 thread-local storage of current subset candidate, criterion clone, and tracker clone More...

Public Types

typedef boost::shared_ptr
< CRITERION > 
PCriterion
typedef boost::shared_ptr< SUBSET > PSubset
typedef boost::shared_ptr
< Result_Tracker< RETURNTYPE,
SUBSET > > 
PResultTracker

Public Member Functions

void initialize (const PCriterion &crit, const DIMTYPE max_candidates)
 to prevent race conditions due to vector resizing max_candidates must be set greater or equal than the maximum number of candidates that will be added
bool add_candidate (const PSubset &sub, const DIMTYPE feature=0)
 adds candidate subset to the evaluation pool
bool getBestResult (RETURNTYPE &result, PSubset &sub, DIMTYPE &feature)
 returns pointer to (does not copy sub contents) whichever candidate yielded the highest criterion value (first waits for all threads to finish)
bool getFirstResult (RETURNTYPE &result, PSubset &sub, DIMTYPE &feature)
 iterator, returns pointer (does not copy sub contents)
bool getNextResult (RETURNTYPE &result, PSubset &sub, DIMTYPE &feature)
 iterator
bool results_to_tracker (const PResultTracker tracker)
virtual std::ostream & print (std::ostream &os) const

Protected Member Functions

void evaluator_thread (unsigned int tidx)
bool get_candidate (DIMTYPE &idx)
 points the calling thread to next candidate to be processed

Protected Attributes

PCriterion template_crit
 to detect change of employed criterion inbetween search() calls
bool initialized
bool working
ThreadLocal tlocal [max_threads]
ThreadPool< max_threads > tp
DIMTYPE _processed_candidates
volatile DIMTYPE _available_candidates
 to sychronize get_candidate() with adding new candidates to cres[]
boost::mutex mutex_candidate_getter
 to sychronize threads when requesting new cres[] candidate through get_candidate()
boost::condition condition_available
 to announce availability of new candidate for processing
volatile bool stop_all_threads
vector< CandidateResultcres
DIMTYPE _reading_result
 iterating index for get*Result readers

Detailed Description

template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION, unsigned int max_threads = 2>
class FST::Candidate_Evaluator_Threaded< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, max_threads >

Implements concurrent evaluation of a criterion on a set of subset candidates.

Concurrently evaluates each subset candidate using clones of the supplied criterion and at most max_threads worker threads. Returns the one subset that yiels highest criterion value, or iterates through all obtained results


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

Generated on Thu Mar 31 11:38:40 2011 for FST3Library by  doxygen 1.6.1