Version: 8.3.0
YACS::ENGINE::OptimizerAlgBase Class Referenceabstract

Base class factorizing common methods for all algorithms interfaces. More...

#include <OptimizerAlg.hxx>

Inheritance diagram for YACS::ENGINE::OptimizerAlgBase:
Collaboration diagram for YACS::ENGINE::OptimizerAlgBase:

Public Member Functions

virtual TypeCodegetTCForInProxy () const
 
virtual TypeCodegetTCForOutProxy () const
 
virtual TypeCodegetTCForAlgoInitProxy () const
 
virtual TypeCodegetTCForAlgoResultProxy () const
 
virtual void initializeProxy (const Any *input) throw (Exception)
 
virtual void startProxy ()
 
virtual void takeDecisionProxy ()
 
virtual void finishProxy ()
 
virtual AnygetAlgoResultProxy ()
 
virtual void setPool (Pool *pool)
 
virtual void setProc (Proc *proc)
 
virtual ProcgetProc ()
 
virtual bool hasError () const
 
virtual const std::string & getError () const
 
virtual void setError (const std::string &message)
 
void setNbOfBranches (int nbOfBranches)
 
int getNbOfBranches () const
 
- Public Member Functions inherited from YACS::ENGINE::RefCounter
unsigned int getRefCnt () const
 
void incrRef () const
 
bool decrRef ()
 

Protected Member Functions

 OptimizerAlgBase (Pool *pool)
 
virtual ~OptimizerAlgBase ()
 
virtual TypeCodegetTCForIn () const =0
 returns typecode of type expected as Input. OwnerShip of returned pointer is held by this. More...
 
virtual TypeCodegetTCForOut () const =0
 returns typecode of type expected as Output. OwnerShip of returned pointer is held by this. More...
 
virtual TypeCodegetTCForAlgoInit () const
 returns typecode of type expected for algo initialization. OwnerShip of returned pointer is held by this. More...
 
virtual TypeCodegetTCForAlgoResult () const
 returns typecode of type expected as algo result. OwnerShip of returned pointer is held by this. More...
 
virtual void initialize (const Any *input) throw (Exception)
 
virtual void start ()=0
 
virtual void takeDecision ()=0
 Update _pool attribute before performing anything. More...
 
virtual void finish ()
 
virtual AnygetAlgoResult ()
 Called when optimization has succeed. More...
 
- Protected Member Functions inherited from YACS::ENGINE::RefCounter
 RefCounter ()
 
 RefCounter (const RefCounter &other)
 
virtual ~RefCounter ()
 

Protected Attributes

Pool_pool
 
Proc_proc
 
std::string _errorMessage
 
int _nbOfBranches
 
- Protected Attributes inherited from YACS::ENGINE::RefCounter
unsigned int _cnt
 

Additional Inherited Members

- Static Public Attributes inherited from YACS::ENGINE::RefCounter
static unsigned int _totalCnt =0
 

Detailed Description

Base class factorizing common methods for all algorithms interfaces.

Definition at line 41 of file OptimizerAlg.hxx.

Constructor & Destructor Documentation

OptimizerAlgBase::OptimizerAlgBase ( Pool pool)
protected

Definition at line 26 of file OptimizerAlg.cxx.

26  :_pool(pool), _proc(NULL)
27 {
28 }
OptimizerAlgBase::~OptimizerAlgBase ( )
protectedvirtual

Definition at line 30 of file OptimizerAlg.cxx.

31 {
32 }

Member Function Documentation

void OptimizerAlgBase::finish ( )
protectedvirtual

_pool->getCurrentId gives the id at the origin of this call. Perform the job of analysing to know what new jobs to do (_pool->pushInSample) or in case of convergence _pool->destroyAll

Reimplemented in YACS::ENGINE::PluginSimplex.

Definition at line 38 of file OptimizerAlg.cxx.

Referenced by finishProxy().

39 {
40 }
Any * OptimizerAlgBase::getAlgoResult ( )
protectedvirtual

Called when optimization has succeed.

Definition at line 52 of file OptimizerAlg.cxx.

Referenced by getAlgoResultProxy().

53 {
54  return NULL;
55 }
Any * OptimizerAlgBase::getAlgoResultProxy ( )
virtual
const std::string & OptimizerAlgBase::getError ( ) const
virtual
int OptimizerAlgBase::getNbOfBranches ( ) const

Definition at line 138 of file OptimizerAlg.cxx.

References _nbOfBranches.

139 {
140  return _nbOfBranches;
141 }
Proc * OptimizerAlgBase::getProc ( )
virtual

Definition at line 113 of file OptimizerAlg.cxx.

References _proc.

114 {
115  return _proc;
116 }
TypeCode * OptimizerAlgBase::getTCForAlgoInit ( ) const
protectedvirtual

returns typecode of type expected for algo initialization. OwnerShip of returned pointer is held by this.

Definition at line 42 of file OptimizerAlg.cxx.

References YACS::ENGINE::Runtime::_tc_string.

Referenced by getTCForAlgoInitProxy().

43 {
44  return Runtime::_tc_string;
45 }
TypeCode * OptimizerAlgBase::getTCForAlgoInitProxy ( ) const
virtual
TypeCode * OptimizerAlgBase::getTCForAlgoResult ( ) const
protectedvirtual

returns typecode of type expected as algo result. OwnerShip of returned pointer is held by this.

Definition at line 47 of file OptimizerAlg.cxx.

References YACS::ENGINE::Runtime::_tc_string.

Referenced by getTCForAlgoResultProxy().

48 {
49  return Runtime::_tc_string;
50 }
TypeCode * OptimizerAlgBase::getTCForAlgoResultProxy ( ) const
virtual
virtual TypeCode* YACS::ENGINE::OptimizerAlgBase::getTCForIn ( ) const
protectedpure virtual

returns typecode of type expected as Input. OwnerShip of returned pointer is held by this.

Implemented in YACS::ENGINE::PluginSimplex.

Referenced by getTCForInProxy().

TypeCode * OptimizerAlgBase::getTCForInProxy ( ) const
virtual

Reimplemented in YACS::ENGINE::PyOptimizerAlgBase.

Definition at line 57 of file OptimizerAlg.cxx.

References getTCForIn().

Referenced by YACS::ENGINE::PyOptimizerAlgBase::getTCForInProxy(), and YACS::ENGINE::OptimizerLoop::setAlgorithm().

58 {
59  return getTCForIn();
60 }
virtual TypeCode* YACS::ENGINE::OptimizerAlgBase::getTCForOut ( ) const
protectedpure virtual

returns typecode of type expected as Output. OwnerShip of returned pointer is held by this.

Implemented in YACS::ENGINE::PluginSimplex.

Referenced by getTCForOutProxy().

TypeCode * OptimizerAlgBase::getTCForOutProxy ( ) const
virtual

Reimplemented in YACS::ENGINE::PyOptimizerAlgBase.

Definition at line 62 of file OptimizerAlg.cxx.

References getTCForOut().

Referenced by YACS::ENGINE::PyOptimizerAlgBase::getTCForOutProxy(), and YACS::ENGINE::OptimizerLoop::setAlgorithm().

63 {
64  return getTCForOut();
65 }
bool OptimizerAlgBase::hasError ( ) const
virtual

Definition at line 118 of file OptimizerAlg.cxx.

References _errorMessage.

Referenced by YACS::ENGINE::OptimizerLoop::exUpdateState(), and YACS::ENGINE::OptimizerLoop::updateStateOnFinishedEventFrom().

119 {
120  return (_errorMessage.length() > 0);
121 }
void OptimizerAlgBase::initialize ( const Any input) throw (Exception)
protectedvirtual

Reimplemented in YACS::ENGINE::PluginSimplex.

Definition at line 34 of file OptimizerAlg.cxx.

35 {
36 }
void OptimizerAlgBase::initializeProxy ( const Any input) throw (Exception)
virtual
void OptimizerAlgBase::setError ( const std::string &  message)
virtual

Definition at line 128 of file OptimizerAlg.cxx.

References _errorMessage.

Referenced by YACS::ENGINE::OptimizerLoop::updateStateOnFailedEventFrom().

129 {
130  _errorMessage = (message.length() > 0) ? message : "Unknown error";
131 }
void OptimizerAlgBase::setNbOfBranches ( int  nbOfBranches)

Definition at line 133 of file OptimizerAlg.cxx.

References _nbOfBranches.

Referenced by YACS::ENGINE::OptimizerLoop::exUpdateState().

134 {
135  _nbOfBranches=nbOfBranches;
136 }
void OptimizerAlgBase::setPool ( Pool pool)
virtual

Definition at line 103 of file OptimizerAlg.cxx.

References _pool.

Referenced by YACS::ENGINE::SalomeOptimizerLoop::loadAlgorithm().

104 {
105  _pool=pool;
106 }
void OptimizerAlgBase::setProc ( Proc proc)
virtual

Definition at line 108 of file OptimizerAlg.cxx.

References _proc.

Referenced by YACS::ENGINE::OptimizerLoop::setAlgorithm().

109 {
110  _proc = proc;
111 }
virtual void YACS::ENGINE::OptimizerAlgBase::start ( )
protectedpure virtual
void OptimizerAlgBase::startProxy ( )
virtual
virtual void YACS::ENGINE::OptimizerAlgBase::takeDecision ( )
protectedpure virtual

Update _pool attribute before performing anything.

Implemented in YACS::ENGINE::OptimizerAlgASync, YACS::ENGINE::PyOptimizerAlgASync, and YACS::ENGINE::PluginSimplex.

Referenced by takeDecisionProxy().

void OptimizerAlgBase::takeDecisionProxy ( )
virtual

Member Data Documentation

std::string YACS::ENGINE::OptimizerAlgBase::_errorMessage
protected

Definition at line 46 of file OptimizerAlg.hxx.

Referenced by finishProxy(), getError(), hasError(), and setError().

int YACS::ENGINE::OptimizerAlgBase::_nbOfBranches
protected

Definition at line 47 of file OptimizerAlg.hxx.

Referenced by getNbOfBranches(), and setNbOfBranches().

Pool* YACS::ENGINE::OptimizerAlgBase::_pool
protected
Proc* YACS::ENGINE::OptimizerAlgBase::_proc
protected

Definition at line 45 of file OptimizerAlg.hxx.

Referenced by getProc(), and setProc().


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