// @(#)root/minuit2:$Id$
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
 *                                                                    *
 **********************************************************************/

#ifndef ROOT_Minuit2_FumiliMinimizer
#define ROOT_Minuit2_FumiliMinimizer

#include "Minuit2/ModularFunctionMinimizer.h"
#include "Minuit2/MnSeedGenerator.h"
#include "Minuit2/FumiliBuilder.h"

namespace ROOT {

   namespace Minuit2 {



class MinimumSeedGenerator;
class MinimumBuilder;
class MinimumSeed;
class MnFcn;
class FumiliFcnBase;
class GradientCalculator;
class MnUserParameterState;
class MnUserParameters;
class MnUserCovariance;
class MnStrategy;



//______________________________________________________________
/**

Instantiates the seed generator and Minimum builder for the
Fumili minimization method. Produces the Minimum via the
Minimize methods inherited from ModularFunctionMinimizer.

@author Andras Zsenei and Lorenzo Moneta, Creation date: 28 Sep 2004

@ingroup Minuit

*/


class FumiliMinimizer : public ModularFunctionMinimizer {

public:


   /**

      Constructor initializing the FumiliMinimizer by instantiatiating
      the SeedGenerator and MinimumBuilder for the Fumili minimization method.

      @see MnSeedGenerator

      @see FumiliBuilder

   */

   FumiliMinimizer() : fMinSeedGen(MnSeedGenerator()),
                       fMinBuilder(FumiliBuilder()) {}

   ~FumiliMinimizer() {}


   /**

      Accessor to the seed generator of the minimizer.

      @return A reference to the seed generator used by the minimizer

   */

   const MinimumSeedGenerator& SeedGenerator() const {return fMinSeedGen;}


   /**

      Accessor to the Minimum builder of the minimizer.

      @return a reference to the Minimum builder.

   */

   const FumiliBuilder& Builder() const {return fMinBuilder;}
   FumiliBuilder& Builder()  {return fMinBuilder;}


   // for Fumili

   FunctionMinimum Minimize(const FCNBase&, const MnUserParameterState&, const MnStrategy&, unsigned int maxfcn = 0, double toler = 0.1) const;

   virtual FunctionMinimum Minimize(const FCNGradientBase&, const MnUserParameterState&, const MnStrategy&, unsigned int maxfcn = 0, double toler = 0.1) const;

   // need to re-implement all function in ModularFuncitionMinimizer otherwise they will be hided

   virtual FunctionMinimum Minimize(const FCNBase& fcn, const std::vector<double>& par, const std::vector<double>& err, unsigned int stra = 1, unsigned int maxfcn = 0, double toler = 0.1) const {
      return ModularFunctionMinimizer::Minimize(fcn, par, err, stra, maxfcn,toler);
   }

   virtual FunctionMinimum Minimize(const FCNGradientBase&fcn, const std::vector<double>&par, const std::vector<double>&err, unsigned int stra=1, unsigned int maxfcn = 0, double toler = 0.1) const {
      return ModularFunctionMinimizer::Minimize(fcn,par,err,stra,maxfcn,toler);
   }

   virtual FunctionMinimum Minimize(const FCNBase& fcn, const std::vector<double>&par, unsigned int nrow, const std::vector<double>&cov, unsigned int stra=1, unsigned int maxfcn = 0, double toler = 0.1) const {
      return ModularFunctionMinimizer::Minimize(fcn,par,nrow,cov,stra,maxfcn,toler);
   }

   virtual FunctionMinimum Minimize(const FCNGradientBase& fcn, const std::vector<double>&par, unsigned int nrow, const std::vector<double>&cov, unsigned int stra=1, unsigned int maxfcn = 0, double toler = 0.1) const {
      return ModularFunctionMinimizer::Minimize(fcn,par,nrow,cov,stra,maxfcn,toler);
   }


   virtual FunctionMinimum Minimize(const FCNBase& fcn, const MnUserParameters& par, const MnStrategy& stra, unsigned int maxfcn = 0, double toler = 0.1) const {
      return ModularFunctionMinimizer::Minimize(fcn,par,stra,maxfcn,toler);
   }

   virtual FunctionMinimum Minimize(const FCNGradientBase& fcn, const MnUserParameters& par, const MnStrategy& stra, unsigned int maxfcn = 0, double toler = 0.1) const {
      return ModularFunctionMinimizer::Minimize(fcn,par,stra,maxfcn,toler);
   }

   virtual FunctionMinimum Minimize(const FCNBase& fcn, const MnUserParameters& par, const MnUserCovariance& cov, const MnStrategy& stra, unsigned int maxfcn = 0, double toler = 0.1) const {
      return ModularFunctionMinimizer::Minimize(fcn,par,cov,stra,maxfcn,toler);
   }

   virtual FunctionMinimum Minimize(const FCNGradientBase& fcn, const MnUserParameters& par, const MnUserCovariance& cov, const MnStrategy& stra, unsigned int maxfcn = 0, double toler = 0.1) const {
      return ModularFunctionMinimizer::Minimize(fcn,par,cov,stra,maxfcn,toler);
   }



   virtual FunctionMinimum Minimize(const MnFcn& mfcn, const GradientCalculator& gc, const MinimumSeed& seed, const MnStrategy& stra, unsigned int maxfcn, double toler) const {
      return ModularFunctionMinimizer::Minimize(mfcn, gc, seed, stra, maxfcn, toler);
   }


private:

   MnSeedGenerator fMinSeedGen;
   FumiliBuilder fMinBuilder;

};

  }  // namespace Minuit2

}  // namespace ROOT

#endif  // ROOT_Minuit2_FumiliMinimizer
 FumiliMinimizer.h:1
 FumiliMinimizer.h:2
 FumiliMinimizer.h:3
 FumiliMinimizer.h:4
 FumiliMinimizer.h:5
 FumiliMinimizer.h:6
 FumiliMinimizer.h:7
 FumiliMinimizer.h:8
 FumiliMinimizer.h:9
 FumiliMinimizer.h:10
 FumiliMinimizer.h:11
 FumiliMinimizer.h:12
 FumiliMinimizer.h:13
 FumiliMinimizer.h:14
 FumiliMinimizer.h:15
 FumiliMinimizer.h:16
 FumiliMinimizer.h:17
 FumiliMinimizer.h:18
 FumiliMinimizer.h:19
 FumiliMinimizer.h:20
 FumiliMinimizer.h:21
 FumiliMinimizer.h:22
 FumiliMinimizer.h:23
 FumiliMinimizer.h:24
 FumiliMinimizer.h:25
 FumiliMinimizer.h:26
 FumiliMinimizer.h:27
 FumiliMinimizer.h:28
 FumiliMinimizer.h:29
 FumiliMinimizer.h:30
 FumiliMinimizer.h:31
 FumiliMinimizer.h:32
 FumiliMinimizer.h:33
 FumiliMinimizer.h:34
 FumiliMinimizer.h:35
 FumiliMinimizer.h:36
 FumiliMinimizer.h:37
 FumiliMinimizer.h:38
 FumiliMinimizer.h:39
 FumiliMinimizer.h:40
 FumiliMinimizer.h:41
 FumiliMinimizer.h:42
 FumiliMinimizer.h:43
 FumiliMinimizer.h:44
 FumiliMinimizer.h:45
 FumiliMinimizer.h:46
 FumiliMinimizer.h:47
 FumiliMinimizer.h:48
 FumiliMinimizer.h:49
 FumiliMinimizer.h:50
 FumiliMinimizer.h:51
 FumiliMinimizer.h:52
 FumiliMinimizer.h:53
 FumiliMinimizer.h:54
 FumiliMinimizer.h:55
 FumiliMinimizer.h:56
 FumiliMinimizer.h:57
 FumiliMinimizer.h:58
 FumiliMinimizer.h:59
 FumiliMinimizer.h:60
 FumiliMinimizer.h:61
 FumiliMinimizer.h:62
 FumiliMinimizer.h:63
 FumiliMinimizer.h:64
 FumiliMinimizer.h:65
 FumiliMinimizer.h:66
 FumiliMinimizer.h:67
 FumiliMinimizer.h:68
 FumiliMinimizer.h:69
 FumiliMinimizer.h:70
 FumiliMinimizer.h:71
 FumiliMinimizer.h:72
 FumiliMinimizer.h:73
 FumiliMinimizer.h:74
 FumiliMinimizer.h:75
 FumiliMinimizer.h:76
 FumiliMinimizer.h:77
 FumiliMinimizer.h:78
 FumiliMinimizer.h:79
 FumiliMinimizer.h:80
 FumiliMinimizer.h:81
 FumiliMinimizer.h:82
 FumiliMinimizer.h:83
 FumiliMinimizer.h:84
 FumiliMinimizer.h:85
 FumiliMinimizer.h:86
 FumiliMinimizer.h:87
 FumiliMinimizer.h:88
 FumiliMinimizer.h:89
 FumiliMinimizer.h:90
 FumiliMinimizer.h:91
 FumiliMinimizer.h:92
 FumiliMinimizer.h:93
 FumiliMinimizer.h:94
 FumiliMinimizer.h:95
 FumiliMinimizer.h:96
 FumiliMinimizer.h:97
 FumiliMinimizer.h:98
 FumiliMinimizer.h:99
 FumiliMinimizer.h:100
 FumiliMinimizer.h:101
 FumiliMinimizer.h:102
 FumiliMinimizer.h:103
 FumiliMinimizer.h:104
 FumiliMinimizer.h:105
 FumiliMinimizer.h:106
 FumiliMinimizer.h:107
 FumiliMinimizer.h:108
 FumiliMinimizer.h:109
 FumiliMinimizer.h:110
 FumiliMinimizer.h:111
 FumiliMinimizer.h:112
 FumiliMinimizer.h:113
 FumiliMinimizer.h:114
 FumiliMinimizer.h:115
 FumiliMinimizer.h:116
 FumiliMinimizer.h:117
 FumiliMinimizer.h:118
 FumiliMinimizer.h:119
 FumiliMinimizer.h:120
 FumiliMinimizer.h:121
 FumiliMinimizer.h:122
 FumiliMinimizer.h:123
 FumiliMinimizer.h:124
 FumiliMinimizer.h:125
 FumiliMinimizer.h:126
 FumiliMinimizer.h:127
 FumiliMinimizer.h:128
 FumiliMinimizer.h:129
 FumiliMinimizer.h:130
 FumiliMinimizer.h:131
 FumiliMinimizer.h:132
 FumiliMinimizer.h:133
 FumiliMinimizer.h:134
 FumiliMinimizer.h:135
 FumiliMinimizer.h:136
 FumiliMinimizer.h:137
 FumiliMinimizer.h:138
 FumiliMinimizer.h:139
 FumiliMinimizer.h:140
 FumiliMinimizer.h:141
 FumiliMinimizer.h:142
 FumiliMinimizer.h:143
 FumiliMinimizer.h:144
 FumiliMinimizer.h:145
 FumiliMinimizer.h:146
 FumiliMinimizer.h:147
 FumiliMinimizer.h:148
 FumiliMinimizer.h:149
 FumiliMinimizer.h:150
 FumiliMinimizer.h:151
 FumiliMinimizer.h:152
 FumiliMinimizer.h:153
 FumiliMinimizer.h:154