How can I set the tuning parameters for GSLSimAnMinimizer when using ROOT::Fit::Fitter?

Hello,

Digging through the docs and the code I realised that the only way to set simulated annealing parameters (e.g. iters_fixed_T) is to call the ROOT::Math::GSLSimAnMinimizer::SetOptions() method which is not even a virtual override of ROOT::Math::Minimizer::SetOptions() (as the latter is not virtual).

I cannot figure out how to do it using the ROOT::Fit::Fitter where it seems there is no way to pass the options to the minimizer even if ROOT::Math::Minimizer::SetOptions() was virtual, because FitConfig::CreateMinimizer() does not call SetOptions()

Either I am missing something or the management of the minimizer in the Fitter should be improved (and possibly SetOptions should be made virtual).

Cheers,
Antoni

I guess @moneta can help you.

Hi,

Thank you for pointing to this. I see a problem to the inconsistency of the GSLSimAnMinimizer::SetOption and the base class (that is not virtual).

The idea is that if you are using the class GSLSimAnMinimizer directly you can set the parameters using the GSLSimAnMinimizer::SetParameters function.
If you do not have access to that class you can use the ROOT::Math::Minimizer::SetOptions or if using the ROOT::Fit classes, by calling FitConfig::MinimizerOptions or setting a default options calling the static function ROOT::Math::MinimizerOptions::SetDefaultExtraOptions(...).
Here is an example showing all available options (see the GSL documentation for the meaning):

// define here the possible tuning parameters
// you can define only the one you want to change 
ROOT::Math::GenAlgoOptions simanOpt;
simanOpt.SetValue("n_tries", n_tries);
simanOpt.SetValue("iters_fixed_T", iters_fixed_T);
simanOpt.SetValue("step_size", step_size);
simanOpt.SetValue("k", k);
simanOpt.SetValue("t_initial", t_initial);
simanOpt.SetValue("mu_t", mu_t);
simanOpt.SetValue("t_min", t_min);
// set these new options
ROOT::Math::MinimizerOptions & opt = fitter.Config().MinimizerOptions();
opt.SetExtraOptions(simanOpt);

// or just call 
// ROOT::Math::MinimizerOptions::SetDefaultExtraOptions(simanOpt);

Unfortunately this above will not work until the GSLSimAnMinimizer class is fixed to use the user given options set by Minimizer::SetOptions. I will make a PR for this
Thank for reporting this issue

Lorenzo

@moneta Did you create a PR and/or an issue in github to track the progress of this?

Hi,

The PR is Fix setting the Minimizer options in GSLSimAnMinimizer by lmoneta · Pull Request #8510 · root-project/root · GitHub.
It is now merged in ROOT master

Cheers

Lorenzo

Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.