Version: 8.3.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 ()
 
TypeCodegetTCForIn () const
 returns typecode of type expected as Input. OwnerShip of returned pointer is held by this. More...
 
TypeCodegetTCForOut () 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) throw (Exception)
 
void finish ()
 
- Public Member Functions inherited from YACS::ENGINE::OptimizerAlgBase
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 Attributes

SalomeEventLoopdst
 
LinearDecoderdec
 
Maestromtr
 
Simplexsolv
 
- 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 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 AnygetAlgoResult ()
 Called when optimization has succeed. More...
 

Detailed Description

Definition at line 39 of file PluginSimplex.hxx.

Constructor & Destructor Documentation

PluginSimplex::PluginSimplex ( Pool pool)

Definition at line 32 of file PluginSimplex.cxx.

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

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 }
PluginSimplex::~PluginSimplex ( )
virtual

Definition at line 47 of file PluginSimplex.cxx.

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

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

Member Function Documentation

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.

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

104 {
105  Solution *res;
106 
107  solv->finish();
108  res = solv->solution();
109  dec->echo(*res);
110 }
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.

References _tc.

59 {
60  return _tc;
61 }
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.

References _tc.

64 {
65  return _tc;
66 }
void PluginSimplex::initialize ( const Any input) throw (Exception)
virtual

Reimplemented from YACS::ENGINE::OptimizerAlgBase.

Definition at line 99 of file PluginSimplex.cxx.

100 {
101 }
void PluginSimplex::parseFileToInit ( const std::string &  fileName)

Definition at line 68 of file PluginSimplex.cxx.

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

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
79  dst = new SalomeEventLoop(_pool);
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 PluginSimplex::start ( )
virtual

Implements YACS::ENGINE::OptimizerAlgBase.

Definition at line 88 of file PluginSimplex.cxx.

References solv, and Simplex::start().

89 {
90  solv->start();
91 }
void PluginSimplex::takeDecision ( )
virtual

Update _pool attribute before performing anything.

Implements YACS::ENGINE::OptimizerAlgBase.

Definition at line 93 of file PluginSimplex.cxx.

References Simplex::next(), and solv.

94 {
95  int rien;
96  rien = solv->next();
97 }

Member Data Documentation

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

Definition at line 42 of file PluginSimplex.hxx.

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

Definition at line 43 of file PluginSimplex.hxx.

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

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

Definition at line 44 of file PluginSimplex.hxx.

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

Definition at line 49 of file PluginSimplex.hxx.

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

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

Definition at line 48 of file PluginSimplex.hxx.

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

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

Definition at line 50 of file PluginSimplex.hxx.

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

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

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