Pool used to manage the samples of the optimizer loop plugin. More...
#include <Pool.hxx>
Classes | |
class | ExpData |
Public Member Functions | |
int | getCurrentId () const |
Any * | getCurrentInSample () const |
Any * | getCurrentOutSample () const |
Any * | getOutSample (int id) |
void | pushInSample (int id, Any *inSample, unsigned char priority=0) |
Push a sample. WARNING inSample ownership is released to current Pool instance (this) ! More... | |
void | destroyAll () |
Private Member Functions | |
void | destroyCurrentCase () |
void | checkConsistency () throw (Exception) |
void | setCurrentId (int id) throw (Exception) |
void | putOutSampleAt (int id, Any *outValue) throw (Exception) |
Any * | getNextSampleWithHighestPriority (int &id, unsigned char &priority) const |
void | markIdAsInUse (int id) |
bool | empty () const |
Private Attributes | |
std::list< std::pair< int, ExpData > > | _container |
std::list< std::pair< int, ExpData > >::iterator | _currentCase |
Static Private Attributes | |
static const char | MESSAGEFORUNXSTNGID [] ="The id specified not exists. Unable to handle with. Either internal error, or invalid use of Pool from Optimizer Algorithm" |
Friends | |
class | OptimizerLoop |
Pool used to manage the samples of the optimizer loop plugin.
Every sample has an identifier (Id), a priority, an initial value (In) and an evaluation value (Out). The current sample is the sample used by the latest terminated evaluation.
|
private |
This method is typically called by OptimizerNode to check the consistency, that is to say that optimizer algorithm has not corrupted 'this'.
Definition at line 140 of file Pool.cxx.
References _container.
void Pool::destroyAll | ( | void | ) |
Definition at line 123 of file Pool.cxx.
References _container.
Referenced by YACS::ENGINE::OptimizerLoop::exUpdateState(), YACS::ENGINE::OptimizerAlgASync::run(), and YACS::ENGINE::OptimizerLoop::updateStateOnFailedEventFrom().
|
private |
Definition at line 128 of file Pool.cxx.
References _container, and _currentCase.
Referenced by YACS::ENGINE::OptimizerLoop::updateStateOnFinishedEventFrom().
|
private |
Typically called after takeDecision of OptimizerAlg as been performed. If true is returned, that is to say that convergence has been reached.
Definition at line 247 of file Pool.cxx.
References _container.
Referenced by getCurrentId(), getCurrentInSample(), getCurrentOutSample(), getOutSample(), and YACS::ENGINE::OptimizerLoop::updateStateOnFinishedEventFrom().
int Pool::getCurrentId | ( | void | ) | const |
Any * Pool::getCurrentInSample | ( | ) | const |
Any * Pool::getCurrentOutSample | ( | ) | const |
|
private |
This method is typically called by OptimizerNode instance owner of 'this' that wants to launch an another job on one branch.
Definition at line 205 of file Pool.cxx.
References _container.
Referenced by YACS::ENGINE::OptimizerLoop::exUpdateState(), YACS::ENGINE::OptimizerLoop::launchMaxOfSamples(), and YACS::ENGINE::OptimizerLoop::updateStateOnFinishedEventFrom().
Any * Pool::getOutSample | ( | int | id | ) |
|
private |
Typically called after 'this->destroyCurrentCase' 'this->checkConsistency' and 'this->getNextSampleWithHighestPriority' have been called. At this point the case with id id is marked as in use in order to avoid to be used by an another branch of OptimizerNode.
Definition at line 233 of file Pool.cxx.
References _container.
Referenced by YACS::ENGINE::OptimizerLoop::launchMaxOfSamples().
void Pool::pushInSample | ( | int | id, |
Any * | inSample, | ||
unsigned char | priority = 0 |
||
) |
Push a sample. WARNING inSample ownership is released to current Pool instance (this) !
Definition at line 116 of file Pool.cxx.
References _container, and YACS::ENGINE::RefCounter::decrRef().
Push a result of case discriminated by id. It also sets the _currentCase pointer on the case discriminated by id. So after this call, the call to setCurrentId with the same id is useless.
When | case id is not found in 'this'. This is particulary true, if not an internal error, when optimizer algorithm has destroyed a case id different from its id. |
Definition at line 181 of file Pool.cxx.
References _container, _currentCase, and MESSAGEFORUNXSTNGID.
Referenced by YACS::ENGINE::OptimizerLoop::updateStateOnFinishedEventFrom().
|
private |
See | the throw case of pushOutSampleAt method. |
Definition at line 160 of file Pool.cxx.
References _container, _currentCase, and MESSAGEFORUNXSTNGID.
Referenced by YACS::ENGINE::OptimizerLoop::updateStateOnFinishedEventFrom().
|
friend |
|
private |
Definition at line 66 of file Pool.hxx.
Referenced by checkConsistency(), destroyAll(), destroyCurrentCase(), empty(), getNextSampleWithHighestPriority(), getOutSample(), markIdAsInUse(), pushInSample(), putOutSampleAt(), and setCurrentId().
|
private |
Definition at line 67 of file Pool.hxx.
Referenced by destroyCurrentCase(), getCurrentId(), putOutSampleAt(), and setCurrentId().
|
staticprivate |
Definition at line 86 of file Pool.hxx.
Referenced by putOutSampleAt(), and setCurrentId().