22 #include <boost/format.hpp>
29 const std::string& algorithmType,
30 const std::string& optionString)
34 if (minimizerName ==
"Minuit2") {
38 else if (minimizerName ==
"GSLLMA") {
42 else if (minimizerName ==
"GSLSimAn") {
46 else if (minimizerName ==
"GSLMultiMin") {
50 else if (minimizerName ==
"Genetic") {
54 else if (minimizerName ==
"Test") {
59 std::ostringstream ostr;
60 ostr <<
"MinimizerFactory::MinimizerFactory() -> Error! Can't create minimizer for given "
62 << minimizerName <<
"' or algorithm '" << algorithmType <<
"'" << std::endl;
63 ostr <<
"Possible names are:" << std::endl;
66 throw std::runtime_error(ostr.str());
69 if (!optionString.empty())
93 const int text_width = 80;
94 std::ostringstream result;
95 const std::string fmt(
"%-20s| %-65s\n");
97 for (
const auto& minimizerName :
catalog().minimizerNames()) {
100 result << std::string(text_width,
'-') <<
"\n";
102 result << std::string(text_width,
'-') <<
"\n";
105 result <<
"\nAlgorithm names\n";
108 for (
size_t i = 0; i < algorithmNames.size(); ++i)
109 result << boost::format(fmt) % algorithmNames[i] % algorithmDescription[i];
110 if (algorithmNames.size() > 1)
111 result << boost::format(fmt) %
"Default algorithm" % info.
algorithmName();
116 result <<
"\nOptions\n";
117 for (
auto option : rootMinimizer->options()) {
118 std::ostringstream opt;
119 opt << std::setw(5) << std::left << option->value() << option->description();
120 result << boost::format(fmt) % option->name() % opt.str();
Declares class GSLLevenbergMarquardtMinimizer.
Declares class GSLMultiMinimizer.
Declares class GeneticMinimizer.
Defines class MinimizerFactory.
Declares class Minuit2Minimizer.
Declares class SimAnMinimizer.
Defines class TestMinimizer.
It's a facade to ROOT::Math::GSLNLSMinimizer which, in turn, is a facade to the actual GSL's gsl_mult...
Wrapper for the CERN ROOT facade of the GSL multi minimizer family (gradient descent based).
Wrapper for the CERN ROOT Genetic minimizer.
Pure virtual interface for all kind minimizers.
virtual void setOptions(const std::string &options)
Sets option string to the minimizer.
Hard-coded information about all minimizers available.
const MinimizerInfo & minimizerInfo(const std::string &minimizerName) const
Returns info for minimizer with given name.
std::string toString() const
Returns multiline string representing catalog content.
static void printCatalog()
static const MinimizerCatalog & catalog()
static std::string catalogDetailsToString()
Returns multi-line string representing detailed catalog content: minimizer names, list of their algor...
static std::string catalogToString()
Returns multi-line string representing catalog content: minimizer names and list of their algorithms.
static IMinimizer * createMinimizer(const std::string &minimizerName, const std::string &algorithmType="", const std::string &optionString="")
Info about a minimizer, including list of defined minimization algorithms.
std::string algorithmName() const
std::vector< std::string > algorithmDescriptions() const
Returns list of string with description of all available algorithms.
std::string description() const
std::vector< std::string > algorithmNames() const
Return list of defined algorithm names.
Wrapper for the CERN ROOT facade of the Minuit2 minimizer.
Pure virtual interface that adapts the CERN ROOT minimizer to our IMinimizer.
Wrapper for the CERN ROOT facade of the GSL simmulated annealing minimizer.
A trivial minimizer that calls the objective function once. Used to test the whole chain.