Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:25

0001 // @(#)root/minuit2:$Id$
0002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005
0003 
0004 /**********************************************************************
0005  *                                                                    *
0006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
0007  *                                                                    *
0008  **********************************************************************/
0009 
0010 #ifndef ROOT_Minuit2_MnStrategy
0011 #define ROOT_Minuit2_MnStrategy
0012 
0013 namespace ROOT {
0014 
0015 namespace Minuit2 {
0016 
0017 //_________________________________________________________________________
0018 /**
0019     API class for defining four levels of strategies: low (0), medium (1),
0020     high (2), very high (>=3);
0021     acts on: Migrad (behavioural),
0022              Minos (lowers strategy by 1 for Minos-own minimization),
0023              Hesse (iterations),
0024              Numerical2PDerivative (iterations)
0025  */
0026 
0027 class MnStrategy {
0028 
0029 public:
0030    // default strategy
0031    MnStrategy();
0032 
0033    // user defined strategy (0, 1, 2, >=3)
0034    explicit MnStrategy(unsigned int);
0035 
0036    ~MnStrategy() {}
0037 
0038    unsigned int Strategy() const { return fStrategy; }
0039 
0040    unsigned int GradientNCycles() const { return fGradNCyc; }
0041    double GradientStepTolerance() const { return fGradTlrStp; }
0042    double GradientTolerance() const { return fGradTlr; }
0043 
0044    unsigned int HessianNCycles() const { return fHessNCyc; }
0045    double HessianStepTolerance() const { return fHessTlrStp; }
0046    double HessianG2Tolerance() const { return fHessTlrG2; }
0047    unsigned int HessianGradientNCycles() const { return fHessGradNCyc; }
0048    unsigned int HessianCentralFDMixedDerivatives() const { return fHessCFDG2; }
0049    unsigned int HessianForcePosDef() const { return fHessForcePosDef; }
0050 
0051    int StorageLevel() const { return fStoreLevel; }
0052 
0053    bool IsLow() const { return fStrategy == 0; }
0054    bool IsMedium() const { return fStrategy == 1; }
0055    bool IsHigh() const { return fStrategy == 2; }
0056    bool IsVeryHigh() const { return fStrategy >= 3; }
0057 
0058    void SetLowStrategy();
0059    void SetMediumStrategy();
0060    void SetHighStrategy();
0061    void SetVeryHighStrategy();
0062 
0063    void SetGradientNCycles(unsigned int n) { fGradNCyc = n; }
0064    void SetGradientStepTolerance(double stp) { fGradTlrStp = stp; }
0065    void SetGradientTolerance(double toler) { fGradTlr = toler; }
0066 
0067    void SetHessianNCycles(unsigned int n) { fHessNCyc = n; }
0068    void SetHessianStepTolerance(double stp) { fHessTlrStp = stp; }
0069    void SetHessianG2Tolerance(double toler) { fHessTlrG2 = toler; }
0070    void SetHessianGradientNCycles(unsigned int n) { fHessGradNCyc = n; }
0071 
0072    // 1 = calculate central finite difference mixed derivatives (involves 3 extra evaluations per derivative)
0073    // 0 = use forward finite difference (default)
0074    void SetHessianCentralFDMixedDerivatives(unsigned int flag) { fHessCFDG2 = flag; }
0075 
0076    // 1 = returned matrix from Hesse should be forced positive definite (default)
0077    // 0 = do not force matrix positive definite
0078    void SetHessianForcePosDef(unsigned int flag) { fHessForcePosDef = flag; }
0079 
0080    // set storage level of iteration quantities
0081    // 0 = store only last iterations 1 = full storage (default)
0082    void SetStorageLevel(unsigned int level) { fStoreLevel = level; }
0083 
0084 private:
0085    unsigned int fStrategy;
0086 
0087    unsigned int fGradNCyc;
0088    double fGradTlrStp;
0089    double fGradTlr;
0090    unsigned int fHessNCyc;
0091    double fHessTlrStp;
0092    double fHessTlrG2;
0093    unsigned int fHessGradNCyc;
0094    int fHessCFDG2;
0095    int fHessForcePosDef;
0096    int fStoreLevel;
0097 };
0098 
0099 } // namespace Minuit2
0100 
0101 } // namespace ROOT
0102 
0103 #endif // ROOT_Minuit2_MnStrategy