1 #ifndef __OPTIMIZERALG_HXX__
2 #define __OPTIMIZERALG_HXX__
4 #include "RefCounter.hxx"
5 #include "Exception.hxx"
6 #include "DrivenCondition.hxx"
21 NOT_EVENT_ORIENTED = 28
25 * \brief Base class factorizing common methods for all algorithms interfaces.
27 class OptimizerAlgBase : public RefCounter
32 OptimizerAlgBase(Pool *pool);
33 virtual ~OptimizerAlgBase();
35 //! returns typecode of type expected as Input. OwnerShip of returned pointer is held by this.
36 virtual TypeCode *getTCForIn() const = 0;
37 //! returns typecode of type expected as Output. OwnerShip of returned pointer is held by this.
38 virtual TypeCode *getTCForOut() const = 0;
39 virtual void parseFileToInit(const std::string& fileName) = 0;
40 virtual TypeOfAlgInterface getType() const = 0;
41 virtual void initialize(const Any *input) throw (Exception) = 0;
42 virtual void finish() = 0;//! Called when optimization has succeed.
46 * \brief Base class to implement in external dynamic lib in case of optimizer event oriented.
48 class OptimizerAlgSync : public OptimizerAlgBase
51 OptimizerAlgSync(Pool *pool);
53 TypeOfAlgInterface getType() const;
54 virtual ~OptimizerAlgSync();
55 virtual void start() = 0;//! Update _pool attribute before performing anything.
56 virtual void takeDecision() = 0;//! _pool->getCurrentId gives the \b id at the origin of this call.
57 //! Perform the job of analysing to know what new jobs to do (_pool->pushInSample)
58 //! or in case of convergence _pool->destroyAll
62 * \brief Base class to implement in external dynamic lib in case of optimizer non event oriented.
64 class OptimizerAlgASync : public OptimizerAlgBase
67 OptimizerAlgASync(Pool *pool);
69 TypeOfAlgInterface getType() const;
70 virtual ~OptimizerAlgASync();
71 virtual void startToTakeDecision(::YACS::BASES::DrivenCondition *condition) = 0;//! _pool->getCurrentId gives the \b id at the origin of this call.
72 //! Perform the job between 2 'condition->wait()' of analysing to know what new jobs to do
73 //! (_pool->pushInSample) or in case of convergence _pool->destroyAll
74 //! WARNING ! 'condition->wait()' must be called before any analyse of Pool.
77 typedef OptimizerAlgBase *(*OptimizerAlgBaseFactory)(Pool *pool);