The SUMO toolbox  2018a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
ThreadedBatchDataSource Class Referenceabstract

Adds threading capabilities to BatchDataSource. More...

Inheritance diagram for ThreadedBatchDataSource:
Inheritance graph
[legend]

Public Member Functions

 ThreadedBatchDataSource (Config config)
 
int getNumThreads ()
 
void cleanup ()
 Cleanup procedure called when the sample queue thread is aborted. More...
 
abstract void evaluate (EvaluationUnitBatch point) throws DataSourceException
 Evaluate one batch. More...
 
EvaluationUnitBatch requestNewBatch ()
 Request a new batch of SamplePoints from the queue. More...
 
void setBatchSize (int size)
 
void submitSamplesForEvaluation (SamplePoint[] points)
 Schedule points for evaluation. More...
 
SamplePoint fetchEvaluatedSample ()
 Get the next evaluated point. More...
 
int getNumPendingSamples ()
 Return the number of poitns pending evaluation. More...
 
int getNumEvaluatedSamples ()
 Return the number of evaluated points waiting to be fetched. More...
 
double getAverageEvaluationTime ()
 Return the average evaluation time (in seconds) for one data point. More...
 
DataSourceStatus getStatus ()
 Returns default status. More...
 
int getInputDimension ()
 
int getOutputDimension ()
 

Static Public Attributes

static final int MAX_THREADS = 20
 Max number of threads. More...
 

Protected Member Functions

void startThreads ()
 
final void submitEvaluatedBatch (EvaluationUnitBatch batch)
 This function is called by the derived subclass whenever a successfully evaluated batch of points needs to be added to the queue. More...
 
final void submitFailedBatch (EvaluationUnitBatch batch)
 This function is called by the derived subclass whenever a FAILED batch of points needs to be added to the queue. More...
 
AbstractSampleQueueManager getSampleQueueManager ()
 Get the sample queue manager for this sample evaluator. More...
 

Detailed Description

Adds threading capabilities to BatchDataSource.

The number of threads can be chosen up to a maximum of MAX_THREADS

Constructor & Destructor Documentation

ThreadedBatchDataSource ( Config  config)
inline

Member Function Documentation

void cleanup ( )
inline

Cleanup procedure called when the sample queue thread is aborted.

Stops all threads

Implements DataSource.

abstract void evaluate ( EvaluationUnitBatch  point) throws DataSourceException
abstractinherited

Evaluate one batch.

This function is called in a separate thread so it is non-blocking for the main thread.

SamplePoint fetchEvaluatedSample ( )
inlineinherited

Get the next evaluated point.

Implements DataSource.

double getAverageEvaluationTime ( )
inlineinherited

Return the average evaluation time (in seconds) for one data point.

Implements DataSource.

int getInputDimension ( )
inlineinherited
int getNumEvaluatedSamples ( )
inlineinherited

Return the number of evaluated points waiting to be fetched.

Implements DataSource.

int getNumPendingSamples ( )
inlineinherited

Return the number of poitns pending evaluation.

Implements DataSource.

int getNumThreads ( )
inline
int getOutputDimension ( )
inlineinherited
AbstractSampleQueueManager getSampleQueueManager ( )
inlineprotectedinherited

Get the sample queue manager for this sample evaluator.

DataSourceStatus getStatus ( )
inlineinherited

Returns default status.

Can be overrided if other than default behaviour is desired.

Implements DataSource.

EvaluationUnitBatch requestNewBatch ( )
inlineinherited

Request a new batch of SamplePoints from the queue.

Returns null if the queue is empty.

void setBatchSize ( int  size)
inlineinherited
void startThreads ( )
inlineprotected
final void submitEvaluatedBatch ( EvaluationUnitBatch  batch)
inlineprotectedinherited

This function is called by the derived subclass whenever a successfully evaluated batch of points needs to be added to the queue.

Parameters
pointEvaluated point to be added.
final void submitFailedBatch ( EvaluationUnitBatch  batch)
inlineprotectedinherited

This function is called by the derived subclass whenever a FAILED batch of points needs to be added to the queue.

void submitSamplesForEvaluation ( SamplePoint[]  points)
inlineinherited

Schedule points for evaluation.

Implements DataSource.

Member Data Documentation

final int MAX_THREADS = 20
static

Max number of threads.


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