Version: 9.16.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 TypeCode * getTCForInProxy () const
 
virtual TypeCode * getTCForOutProxy () const
 
virtual TypeCode * getTCForAlgoInitProxy () const
 
virtual TypeCode * getTCForAlgoResultProxy () const
 
virtual void initializeProxy (const Any *input)
 
virtual void startProxy ()
 
virtual void takeDecisionProxy ()
 
virtual void finishProxy ()
 
virtual Any * getAlgoResultProxy ()
 
virtual void setPool (Pool *pool)
 
virtual void setProc (Proc *proc)
 
virtual Proc * getProc ()
 
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 () const
 

Protected Member Functions

 OptimizerAlgBase (Pool *pool)
 
virtual ~OptimizerAlgBase ()
 
virtual TypeCode * getTCForIn () const =0
 returns typecode of type expected as Input. OwnerShip of returned pointer is held by this. More...
 
virtual TypeCode * getTCForOut () const =0
 returns typecode of type expected as Output. OwnerShip of returned pointer is held by this. More...
 
virtual TypeCode * getTCForAlgoInit () const
 returns typecode of type expected for algo initialization. OwnerShip of returned pointer is held by this. More...
 
virtual TypeCode * getTCForAlgoResult () const
 returns typecode of type expected as algo result. OwnerShip of returned pointer is held by this. More...
 
virtual void initialize (const Any *input)
 
virtual void start ()=0
 
virtual void takeDecision ()=0
 Update _pool attribute before performing anything. More...
 
virtual void finish ()
 
virtual Any * getAlgoResult ()
 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::OptimizerAlgBase ( Pool *  pool)
protected

Definition at line 26 of file OptimizerAlg.cxx.

◆ ~OptimizerAlgBase()

OptimizerAlgBase::~OptimizerAlgBase ( )
protectedvirtual

Definition at line 30 of file OptimizerAlg.cxx.

31{
32}

Member Function Documentation

◆ finish()

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.

39{
40}

Referenced by finishProxy().

◆ finishProxy()

◆ getAlgoResult()

Any * OptimizerAlgBase::getAlgoResult ( )
protectedvirtual

Called when optimization has succeed.

Definition at line 52 of file OptimizerAlg.cxx.

53{
54 return NULL;
55}

Referenced by getAlgoResultProxy().

◆ getAlgoResultProxy()

Any * OptimizerAlgBase::getAlgoResultProxy ( )
virtual

Reimplemented in YACS::ENGINE::PyOptimizerAlgBase.

Definition at line 98 of file OptimizerAlg.cxx.

99{
100 return getAlgoResult();
101}
virtual Any * getAlgoResult()
Called when optimization has succeed.

References getAlgoResult().

Referenced by YACS::ENGINE::FakeNodeForOptimizerLoop::execute(), YACS::ENGINE::OptimizerLoop::finalize(), and YACS::ENGINE::PyOptimizerAlgBase::getAlgoResultProxy().

◆ getError()

const std::string & OptimizerAlgBase::getError ( ) const
virtual

◆ getNbOfBranches()

int OptimizerAlgBase::getNbOfBranches ( ) const

Definition at line 138 of file OptimizerAlg.cxx.

139{
140 return _nbOfBranches;
141}

References _nbOfBranches.

◆ getProc()

Proc * OptimizerAlgBase::getProc ( )
virtual

Definition at line 113 of file OptimizerAlg.cxx.

114{
115 return _proc;
116}

References _proc.

◆ getTCForAlgoInit()

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.

43{
45}
static YACS::ENGINE::TypeCode * _tc_string
Definition: Runtime.hxx:139

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

Referenced by getTCForAlgoInitProxy().

◆ getTCForAlgoInitProxy()

TypeCode * OptimizerAlgBase::getTCForAlgoInitProxy ( ) const
virtual

Reimplemented in YACS::ENGINE::PyOptimizerAlgBase.

Definition at line 67 of file OptimizerAlg.cxx.

68{
69 return getTCForAlgoInit();
70}
virtual TypeCode * getTCForAlgoInit() const
returns typecode of type expected for algo initialization. OwnerShip of returned pointer is held by t...

References getTCForAlgoInit().

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

◆ getTCForAlgoResult()

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.

48{
50}

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

Referenced by getTCForAlgoResultProxy().

◆ getTCForAlgoResultProxy()

TypeCode * OptimizerAlgBase::getTCForAlgoResultProxy ( ) const
virtual

Reimplemented in YACS::ENGINE::PyOptimizerAlgBase.

Definition at line 72 of file OptimizerAlg.cxx.

73{
74 return getTCForAlgoResult();
75}
virtual TypeCode * getTCForAlgoResult() const
returns typecode of type expected as algo result. OwnerShip of returned pointer is held by this.

References getTCForAlgoResult().

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

◆ getTCForIn()

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

◆ getTCForInProxy()

TypeCode * OptimizerAlgBase::getTCForInProxy ( ) const
virtual

Reimplemented in YACS::ENGINE::PyOptimizerAlgBase.

Definition at line 57 of file OptimizerAlg.cxx.

58{
59 return getTCForIn();
60}
virtual TypeCode * getTCForIn() const =0
returns typecode of type expected as Input. OwnerShip of returned pointer is held by this.

References getTCForIn().

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

◆ getTCForOut()

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

◆ getTCForOutProxy()

TypeCode * OptimizerAlgBase::getTCForOutProxy ( ) const
virtual

Reimplemented in YACS::ENGINE::PyOptimizerAlgBase.

Definition at line 62 of file OptimizerAlg.cxx.

63{
64 return getTCForOut();
65}
virtual TypeCode * getTCForOut() const =0
returns typecode of type expected as Output. OwnerShip of returned pointer is held by this.

References getTCForOut().

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

◆ hasError()

bool OptimizerAlgBase::hasError ( ) const
virtual

Definition at line 118 of file OptimizerAlg.cxx.

119{
120 return (_errorMessage.length() > 0);
121}

References _errorMessage.

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

◆ initialize()

void OptimizerAlgBase::initialize ( const Any *  input)
protectedvirtual

Reimplemented in YACS::ENGINE::PluginSimplex.

Definition at line 34 of file OptimizerAlg.cxx.

35{
36}

Referenced by initializeProxy().

◆ initializeProxy()

void OptimizerAlgBase::initializeProxy ( const Any *  input)
virtual

Reimplemented in YACS::ENGINE::PyOptimizerAlgBase.

Definition at line 77 of file OptimizerAlg.cxx.

78{
79 initialize(input);
80}
virtual void initialize(const Any *input)

References initialize().

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

◆ setError()

void OptimizerAlgBase::setError ( const std::string &  message)
virtual

Definition at line 128 of file OptimizerAlg.cxx.

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

References _errorMessage.

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

◆ setNbOfBranches()

void OptimizerAlgBase::setNbOfBranches ( int  nbOfBranches)

Definition at line 133 of file OptimizerAlg.cxx.

134{
135 _nbOfBranches=nbOfBranches;
136}

References _nbOfBranches.

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

◆ setPool()

void OptimizerAlgBase::setPool ( Pool *  pool)
virtual

Definition at line 103 of file OptimizerAlg.cxx.

104{
105 _pool=pool;
106}

References _pool.

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

◆ setProc()

void OptimizerAlgBase::setProc ( Proc *  proc)
virtual

Definition at line 108 of file OptimizerAlg.cxx.

109{
110 _proc = proc;
111}

References _proc.

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

◆ start()

virtual void YACS::ENGINE::OptimizerAlgBase::start ( )
protectedpure virtual

◆ startProxy()

void OptimizerAlgBase::startProxy ( )
virtual

◆ takeDecision()

virtual void YACS::ENGINE::OptimizerAlgBase::takeDecision ( )
protectedpure virtual

Update _pool attribute before performing anything.

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

Referenced by takeDecisionProxy().

◆ takeDecisionProxy()

void OptimizerAlgBase::takeDecisionProxy ( )
virtual

Reimplemented in YACS::ENGINE::PyOptimizerAlgBase, and YACS::ENGINE::PyOptimizerAlgASync.

Definition at line 87 of file OptimizerAlg.cxx.

88{
90}
virtual void takeDecision()=0
Update _pool attribute before performing anything.

References takeDecision().

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

Member Data Documentation

◆ _errorMessage

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

Definition at line 46 of file OptimizerAlg.hxx.

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

◆ _nbOfBranches

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

Definition at line 47 of file OptimizerAlg.hxx.

Referenced by getNbOfBranches(), and setNbOfBranches().

◆ _pool

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

◆ _proc

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: