//////////////////////////////////////////////////////////////////////// /// \class RAT::OptimisedComponent /// /// \brief Base class for OptimisedComponents /// /// \author Phil G Jones \n /// \author Matt Mottram < m.mottram@qmul.ac.uk> -- contact person /// /// REVISION HISTORY:\n /// 2013-10-26 : P G Jones - New file \n /// /// \details Fitter components that are optimised should inherit from this /// base class. The optimiser will call the GetParams first, then a /// operator() call for each trial set of parameters until it is satisfied. /// //////////////////////////////////////////////////////////////////////// #ifndef __RAT_OptimisedComponent__ #define __RAT_OptimisedComponent__ #include #include namespace RAT { namespace Optimisers { class Optimiser; } class OptimisedComponent { public: OptimisedComponent() : fOptimiser( NULL) { }; virtual ~OptimisedComponent() { }; /// Called by the optimiser to get the starting/seed parameters to optimise virtual std::vector GetParams() const = 0; /// Called by the optimiser to get the starting errors on the parameters virtual std::vector GetPositiveErrors() const = 0; /// Called by the optimiser to get the starting errors on the parameters virtual std::vector GetNegativeErrors() const = 0; /// Called by the optimiser to invoke the method algorithm, optimiser will pass current parameters virtual double operator()( const std::vector& params ) = 0; /// Set the optimiser void SetOptimiser( Optimisers::Optimiser* optimiser ) { fOptimiser = optimiser; } /// May be called by the optimiser to save a fit quality FOM or other relevant data virtual void SetFOM( const std::string& fomName, const double fom ) = 0; protected: Optimisers::Optimiser* fOptimiser; ///< The optimiser }; } //::RAT #endif