Version: 9.16.0
YACS::ENGINE::PluginSimplex Class Reference

#include <PluginSimplex.hxx>

Inheritance diagram for YACS::ENGINE::PluginSimplex:
Collaboration diagram for YACS::ENGINE::PluginSimplex:

Public Member Functions

 PluginSimplex (Pool *pool)
 
virtual ~PluginSimplex ()
 
TypeCode * getTCForIn () const
 returns typecode of type expected as Input. OwnerShip of returned pointer is held by this. More...
 
TypeCode * getTCForOut () const
 returns typecode of type expected as Output. OwnerShip of returned pointer is held by this. More...
 
void parseFileToInit (const std::string &fileName)
 
void start ()
 
void takeDecision ()
 Update _pool attribute before performing anything. More...
 
void initialize (const Any *input)
 
void finish ()
 
- Public Member Functions inherited from YACS::ENGINE::OptimizerAlgBase
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 Attributes

SalomeEventLoop * dst
 
LinearDecoder * dec
 
Maestro * mtr
 
Simplex * solv
 
- Protected Attributes inherited from YACS::ENGINE::OptimizerAlgBase
Pool * _pool
 
Proc * _proc
 
std::string _errorMessage
 
int _nbOfBranches
 
- Protected Attributes inherited from YACS::ENGINE::RefCounter
unsigned int _cnt
 

Private Attributes

int _idTest
 
TypeCode * _tc
 
TypeCode * _tcOut
 

Additional Inherited Members

- Static Public Attributes inherited from YACS::ENGINE::RefCounter
static unsigned int _totalCnt =0
 
- Protected Member Functions inherited from YACS::ENGINE::OptimizerAlgBase
 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 ()
 

Detailed Description

Definition at line 39 of file PluginSimplex.hxx.

Constructor & Destructor Documentation

◆ PluginSimplex()

PluginSimplex::PluginSimplex ( Pool *  pool)

Definition at line 32 of file PluginSimplex.cxx.

32 :OptimizerAlgSync(pool),_tc(0)
33{
34 // type
35 TypeCode *tctmp=new TypeCode(Double);
36 _tc=new TypeCodeSeq("", "", tctmp);
37 tctmp->decrRef();
38 // distribution
39 dst = (SalomeEventLoop *) NULL;
40 dec = (LinearDecoder *) NULL;
41 mtr = (Maestro *) NULL;
42 // swarm
43 solv = (Simplex *) NULL;
44
45}
Class for sequence objects.
Definition: TypeCode.hxx:160
Base class for all type objects.
Definition: TypeCode.hxx:68
OptimizerAlgBase OptimizerAlgSync

References _tc, dec, YACS::ENGINE::RefCounter::decrRef(), YACS::ENGINE::Double, dst, mtr, and solv.

◆ ~PluginSimplex()

PluginSimplex::~PluginSimplex ( )
virtual

Definition at line 47 of file PluginSimplex.cxx.

48{
49 _tc->decrRef();
50 // distribution
51 delete dst;
52 delete dec;
53 delete mtr;
54 // swarm
55 delete solv;
56}

References _tc, dec, YACS::ENGINE::RefCounter::decrRef(), dst, mtr, and solv.

Member Function Documentation

◆ finish()

void PluginSimplex::finish ( )
virtual

_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 from YACS::ENGINE::OptimizerAlgBase.

Definition at line 103 of file PluginSimplex.cxx.

104{
105 Solution *res;
106
107 solv->finish();
108 res = solv->solution();
109 dec->echo(*res);
110}
void echo(Solution &)
Definition: decode.cxx:25
void finish(void)
Definition: simplex.cxx:90
Solution * solution(void)
Definition: simplex.cxx:96

References dec, Decoder::echo(), Simplex::finish(), Simplex::solution(), and solv.

◆ getTCForIn()

TypeCode * PluginSimplex::getTCForIn ( ) const
virtual

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

Implements YACS::ENGINE::OptimizerAlgBase.

Definition at line 58 of file PluginSimplex.cxx.

59{
60 return _tc;
61}

References _tc.

◆ getTCForOut()

TypeCode * PluginSimplex::getTCForOut ( ) const
virtual

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

Implements YACS::ENGINE::OptimizerAlgBase.

Definition at line 63 of file PluginSimplex.cxx.

64{
65 return _tc;
66}

References _tc.

◆ initialize()

void PluginSimplex::initialize ( const Any *  input)
virtual

Reimplemented from YACS::ENGINE::OptimizerAlgBase.

Definition at line 99 of file PluginSimplex.cxx.

100{
101}

◆ parseFileToInit()

void PluginSimplex::parseFileToInit ( const std::string &  fileName)

Definition at line 68 of file PluginSimplex.cxx.

69{
70 std::vector<std::pair<double, double> > dom(NBGENE);
71 long i;
72
73 // domaine de recherche
74 for (i=0; i<NBGENE; i++) {
75 dom[i].first = BORNEMIN;
76 dom[i].second = BORNEMAX;
77 }
78 // distribution
80 dec = new LinearDecoder(dom);
81 mtr = new Maestro((Decoder &) *dec, (Critere *) NULL, (Distrib &) *dst);
82 // swarm
83 solv = new Simplex(NBNODE, NBGENE, *mtr);
84
86}
void setStop(long)
Definition: simplex.cxx:47
#define NBEVAL
Definition: saconst.h:34
#define BORNEMAX
Definition: saconst.h:56
#define NBGENE
Definition: saconst.h:50
#define BORNEMIN
Definition: saconst.h:55
#define NBNODE
Definition: saconst.h:29

References YACS::ENGINE::OptimizerAlgBase::_pool, BORNEMAX, BORNEMIN, dec, dst, yacsorb.CORBAEngineTest::i, mtr, NBEVAL, NBGENE, NBNODE, Simplex::setStop(), and solv.

◆ start()

void PluginSimplex::start ( )
virtual

Implements YACS::ENGINE::OptimizerAlgBase.

Definition at line 88 of file PluginSimplex.cxx.

89{
90 solv->start();
91}
void start(void)
Definition: simplex.cxx:52

References solv, and Simplex::start().

◆ takeDecision()

void PluginSimplex::takeDecision ( )
virtual

Update _pool attribute before performing anything.

Implements YACS::ENGINE::OptimizerAlgBase.

Definition at line 93 of file PluginSimplex.cxx.

94{
95 int rien;
96 rien = solv->next();
97}
int next(void)
Definition: simplex.cxx:65

References Simplex::next(), and solv.

Member Data Documentation

◆ _idTest

int YACS::ENGINE::PluginSimplex::_idTest
private

Definition at line 42 of file PluginSimplex.hxx.

◆ _tc

TypeCode* YACS::ENGINE::PluginSimplex::_tc
private

Definition at line 43 of file PluginSimplex.hxx.

Referenced by getTCForIn(), getTCForOut(), PluginSimplex(), and ~PluginSimplex().

◆ _tcOut

TypeCode* YACS::ENGINE::PluginSimplex::_tcOut
private

Definition at line 44 of file PluginSimplex.hxx.

◆ dec

LinearDecoder* YACS::ENGINE::PluginSimplex::dec
protected

Definition at line 49 of file PluginSimplex.hxx.

Referenced by finish(), parseFileToInit(), PluginSimplex(), and ~PluginSimplex().

◆ dst

SalomeEventLoop* YACS::ENGINE::PluginSimplex::dst
protected

Definition at line 48 of file PluginSimplex.hxx.

Referenced by parseFileToInit(), PluginSimplex(), and ~PluginSimplex().

◆ mtr

Maestro* YACS::ENGINE::PluginSimplex::mtr
protected

Definition at line 50 of file PluginSimplex.hxx.

Referenced by parseFileToInit(), PluginSimplex(), and ~PluginSimplex().

◆ solv

Simplex* YACS::ENGINE::PluginSimplex::solv
protected

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