fitbenchmarking.controllers.ceres_controller module

Implements a controller for the Ceres fitting software.

class fitbenchmarking.controllers.ceres_controller.CeresController(cost_func)

Bases: Controller

Controller for Ceres Solver

algorithm_check = {'MCMC': [], 'all': ['Levenberg_Marquardt', 'Dogleg', 'BFGS', 'LBFGS', 'steepest_descent', 'Fletcher_Reeves', 'Polak_Ribiere', 'Hestenes_Stiefel'], 'bfgs': ['BFGS', 'LBFGS'], 'conjugate_gradient': ['Fletcher_Reeves', 'Polak_Ribiere', 'Hestenes_Stiefel'], 'deriv_free': [], 'gauss_newton': [], 'general': [], 'global_optimization': [], 'levenberg-marquardt': [], 'ls': ['Levenberg_Marquardt', 'Dogleg', 'BFGS', 'LBFGS', 'steepest_descent', 'Fletcher_Reeves', 'Polak_Ribiere', 'Hestenes_Stiefel'], 'simplex': [], 'steepest_descent': ['steepest_descent'], 'trust_region': ['Levenberg_Marquardt', 'Dogleg']}

Within the controller class, you must initialize a dictionary, algorithm_check, such that the keys are given by:

  • all - all minimizers

  • ls - least-squares fitting algorithms

  • deriv_free - derivative free algorithms (these are algorithms that cannot use information about derivatives – e.g., the Simplex method in Mantid)

  • general - minimizers which solve a generic min f(x)

  • simplex - derivative free simplex based algorithms e.g. Nelder-Mead

  • trust_region - algorithms which employ a trust region approach

  • levenberg-marquardt - minimizers that use the Levenberg-Marquardt algorithm

  • gauss_newton - minimizers that use the Gauss Newton algorithm

  • bfgs - minimizers that use the BFGS algorithm

  • conjugate_gradient - Conjugate Gradient algorithms

  • steepest_descent - Steepest Descent algorithms

  • global_optimization - Global Optimization algorithms

  • MCMC - Markov Chain Monte Carlo algorithms

The values of the dictionary are given as a list of minimizers for that specific controller that fit into each of the above categories. See for example the GSL controller.

The algorithm_check dictionary is used to determine which minimizers to run given the algorithm_type selected in Fitting Options. For guidance on how to categorise minimizers, see the Optimization Algorithms section of the FitBenchmarking docs.

cleanup()

Convert the result to a numpy array and populate the variables results will be read from

fit()

Run problem with Ceres solver

jacobian_enabled_solvers = ['Levenberg_Marquardt', 'Dogleg', 'BFGS', 'LBFGS', 'steepest_descent', 'Fletcher_Reeves', 'Polak_Ribiere', 'Hestenes_Stiefel']

Within the controller class, you must define the list jacobian_enabled_solvers if any of the minimizers for the specific software are able to use jacobian information.

  • jacobian_enabled_solvers: a list of minimizers in a specific software that allow Jacobian information to be passed into the fitting algorithm

setup()

Setup problem ready to be run with Ceres solver

support_for_bounds = True

Used to check whether the fitting software has support for bounded problems, set as True if at least some minimizers in the fitting software have support for bounds

class fitbenchmarking.controllers.ceres_controller.CeresCostFunction(*args: Any, **kwargs: Any)

Bases: CostFunction

Cost function for Ceres solver

Evaluate(parameters, residuals, jacobians)

Evaluate for Ceres solver