Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-12 09:08:55

0001 // @(#)root/mathmore:$Id$
0002 // Author: L. Moneta Wed Dec 20 17:16:32 2006
0003 
0004 /**********************************************************************
0005  *                                                                    *
0006  * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
0007  *                                                                    *
0008  * This library is free software; you can redistribute it and/or      *
0009  * modify it under the terms of the GNU General Public License        *
0010  * as published by the Free Software Foundation; either version 2     *
0011  * of the License, or (at your option) any later version.             *
0012  *                                                                    *
0013  * This library is distributed in the hope that it will be useful,    *
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
0016  * General Public License for more details.                           *
0017  *                                                                    *
0018  * You should have received a copy of the GNU General Public License  *
0019  * along with this library (see file COPYING); if not, write          *
0020  * to the Free Software Foundation, Inc., 59 Temple Place, Suite      *
0021  * 330, Boston, MA 02111-1307 USA, or contact the author.             *
0022  *                                                                    *
0023  **********************************************************************/
0024 
0025 // Header file for class GSLSimAnMinimizer
0026 
0027 #ifndef ROOT_Math_GSLSimAnMinimizer
0028 #define ROOT_Math_GSLSimAnMinimizer
0029 
0030 
0031 
0032 #include "Math/BasicMinimizer.h"
0033 
0034 
0035 #include "Math/IFunctionfwd.h"
0036 
0037 #include "Math/IParamFunctionfwd.h"
0038 
0039 
0040 
0041 #include "Math/GSLSimAnnealing.h"
0042 
0043 
0044 
0045 
0046 namespace ROOT {
0047 
0048    namespace Math {
0049 
0050 
0051 
0052 //_____________________________________________________________________________________
0053    /**
0054       GSLSimAnMinimizer class for minimization using simulated annealing
0055       using the algorithm from
0056       <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Simulated-Annealing.html">
0057       GSL</A>.
0058       It implements the ROOT::Minimizer interface and
0059       a plug-in (name "GSLSimAn") exists to instantiate this class via the plug-in manager
0060       Configuration (Setting/getting) the options is done through the methods defined in the
0061       ROOT::Math::Minimizer class.
0062       The user needs to call the base class method ROOT::Math::Minimizer::SetOptions to set the
0063       corresponding options.
0064       Here is some code example for increasing n_tries from 200 (default) to 1000
0065        ```
0066          ROOT::Math::GenAlgoOptions simanOpt;
0067          simanOpt.SetValue("n_tries", 1000);
0068          ROOT::Math::MinimizerOptions opt;
0069          opt.SetExtraOptions(simanOpt);
0070          minimizer->SetOptions(opt);
0071        ```
0072 
0073       @ingroup MultiMin
0074    */
0075    class GSLSimAnMinimizer : public ROOT::Math::BasicMinimizer {
0076 
0077    public:
0078       /**
0079          Default constructor
0080       */
0081       GSLSimAnMinimizer(int type = 0);
0082 
0083       /**
0084          Destructor (no operations)
0085       */
0086       ~GSLSimAnMinimizer() override;
0087 
0088       /// method to perform the minimization
0089       bool Minimize() override;
0090 
0091       /// number of calls
0092       unsigned int NCalls() const override;
0093 
0094       /// Get current minimizer option parameters
0095       const GSLSimAnParams &MinimizerParameters() const { return fSolver.Params(); }
0096 
0097       /// set new minimizer option parameters using directly the GSLSimAnParams structure
0098       void SetParameters(const GSLSimAnParams &params)
0099       {
0100          fSolver.SetParams(params);
0101          DoSetMinimOptions(params); // store new parameters also in MinimizerOptions
0102       }
0103 
0104    protected:
0105       /// set minimizer option parameters from stored ROOT::Math::MinimizerOptions (fOpt)
0106       void DoSetSimAnParameters(const MinimizerOptions &opt);
0107 
0108       /// Set the Minimizer options from the simulated annealing parameters
0109       void DoSetMinimOptions(const GSLSimAnParams &params);
0110 
0111    private:
0112       ROOT::Math::GSLSimAnnealing fSolver;
0113 
0114 
0115 };
0116 
0117    } // end namespace Math
0118 
0119 } // end namespace ROOT
0120 
0121 
0122 #endif /* ROOT_Math_GSLSimAnMinimizer */