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

This class implements a scattered dataset lookup sample evaluator. More...

Inheritance diagram for ScatteredDatasetDataSource:
Inheritance graph
[legend]

Public Member Functions

 ScatteredDatasetDataSource (Config config) throws DataSourceException
 
Dataset getData ()
 
void submitSamplesForEvaluation (SamplePoint[] points)
 Schedule points for evaluation. 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 ()
 Get the average time in seconds to simulate one data point. More...
 
void addToInputQueue (EvaluationUnit unit)
 Since this class uses a data file to evaluate points this method immediately evaluates the incoming unit and puts it back on the evaluated queue. More...
 
SamplePoint fetchEvaluatedSample ()
 Get the next evaluated point. More...
 
DataSourceStatus getStatus ()
 Get the status of the sample evaluator. More...
 
void cleanup ()
 Clean up the threads started and the resources used by the sample evaluator. More...
 
void submitNewSamples (SamplePoint[] points)
 Prepare the passed sample points for evaluation and add them to the queue. More...
 
void submitNewSample (SamplePoint point)
 Add & process one new sample. More...
 
int pendingSamples ()
 Return the number of samples that are currently waiting to be evaluated. More...
 
int evaluatedSamples ()
 Return the number of samples that have been evaluated already. More...
 
double averageEvaluationTime ()
 Get the average time it takes to evaluate one single sample. More...
 
void submitEvaluatedSample (EvaluationUnit unit)
 Signal that a set of samples have been evaluated Valid termination states include: EVALUATED: The point was evaluated correctly. More...
 
SamplePoint requestEvaluatedSample ()
 Get a newly evaluated sample. More...
 

Protected Member Functions

Dataset construct ()
 
void load (Config config, String fileName) throws DataSourceException
 
void flagAsPending (EvaluationUnit unit)
 

Detailed Description

This class implements a scattered dataset lookup sample evaluator.

When given a sample point, this evaluator looks in a KDTree for a simulation of a point as close to the given point as possible. It returns the output parameters at the closest point, and changes the input parameters to match the closest point that was used.

Constructor & Destructor Documentation

Member Function Documentation

void addToInputQueue ( EvaluationUnit  unit)
inlineinherited

Since this class uses a data file to evaluate points this method immediately evaluates the incoming unit and puts it back on the evaluated queue.

We do this since we assume such a dataset lookup is fast, thus blocking is permitted.

double averageEvaluationTime ( )
inlineinherited

Get the average time it takes to evaluate one single sample.

void cleanup ( )
inlineinherited

Clean up the threads started and the resources used by the sample evaluator.

Called automatically when the DataSource is not to be used anymore.

Implements DataSource.

Dataset construct ( )
inlineprotected
int evaluatedSamples ( )
inlineinherited

Return the number of samples that have been evaluated already.

Returns
The number of samples.
SamplePoint fetchEvaluatedSample ( )
inlineinherited

Get the next evaluated point.

Implements DataSource.

void flagAsPending ( EvaluationUnit  unit)
inlineprotectedinherited
double getAverageEvaluationTime ( )
inlineinherited

Get the average time in seconds to simulate one data point.

Implements DataSource.

Dataset getData ( )
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.

DataSourceStatus getStatus ( )
inlineinherited

Get the status of the sample evaluator.

This status contains, for example, if the sample evaluator is still capable of evaluating samples and how many it can evaluate at once.

Returns
The status.

Implements DataSource.

void load ( Config  config,
String  fileName 
) throws DataSourceException
inlineprotectedinherited
int pendingSamples ( )
inlineinherited

Return the number of samples that are currently waiting to be evaluated.

Returns
The number of samples.
SamplePoint requestEvaluatedSample ( )
inlineinherited

Get a newly evaluated sample.

Returns null if the queue is empty.

Returns
The evaluated sample.
void submitEvaluatedSample ( EvaluationUnit  unit)
inlineinherited

Signal that a set of samples have been evaluated Valid termination states include: EVALUATED: The point was evaluated correctly.

AGAIN: The point wasn't evaluated, but might succeed a next time (for cluster failover, reintroduce in new samples queue). FAILED: The point can't be evaluated.

void submitNewSample ( SamplePoint  point)
inlineinherited

Add & process one new sample.

Parameters
pointThe sample to be submitted.
void submitNewSamples ( SamplePoint[]  points)
inlineinherited

Prepare the passed sample points for evaluation and add them to the queue.

void submitSamplesForEvaluation ( SamplePoint[]  points)
inlineinherited

Schedule points for evaluation.

Implements DataSource.


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