Optimizers

class ionworkspipeline.optimizers.Optimizer(solver_args)

Base class for all optimizers.

Parameters

ftolfloat, optional

The tolerance for the change in the value of the objective function.

xtolfloat, optional

The tolerance for the change in the value of the independent variables.

method :

The method to use for the optimization.

verbosebool, optional

Whether to print information at runtime. Default is False.

property cost

Default cost function to use if none is provided

optimize(x0)

Optimize the objective function.

Parameters

x0array_like

Initial guess for the independent variables.

Returns

resscipy.optimize.OptimizeResult

The result of the optimization.

set_bounds(bounds)

Set the bounds using the correct format for the optimizer.

Parameters

boundstuple of arrays

The bounds for the parameters being fit.

set_eq_constraints(eq_constraints)

Set the equality constraint function: the output of this function should evaluate to zero.

Parameters

eq_constraintsdict or tuple or list

The equality constraints to be satisfied.

set_objective(objective)

Set the objective function.

Parameters

objectivecallable

The objective function to be minimized.

class ionworkspipeline.optimizers.Dummy

Dummy optimizer, returns the initial guess

Extends: ionworkspipeline.data_fits.optimizers.optimizer.Optimizer

optimize(x0)

Return the initial guess

Parameters

x0array_like

Initial guess for the independent variables.

Returns

resscipy.optimize.OptimizeResult

The result of the optimization.

class ionworkspipeline.optimizers.GridSearch(npts=10)

Optimizer using a brute force grid search approach.

Parameters

nptsint, optional

The number of points to use in each dimension. Default is 10.

Extends: ionworkspipeline.data_fits.optimizers.optimizer.Optimizer

optimize(x0)

Optimize the objective function.

Parameters

x0 : array_like

class ionworkspipeline.optimizers.ScipyDifferentialEvolution(**solver_args)

Optimizer using the scipy differential_evolution function.

Parameters

solver_argsdict, optional

Parameters are passed to the scipy differential_evolution function. See the documentation for scipy.optimize.differential_evolution for details.

Extends: ionworkspipeline.data_fits.optimizers.optimizer.Optimizer

optimize(x0)

Optimize the objective function.

Parameters

x0 : array_like

Returns

resscipy.optimize.OptimizeResult

The result of the optimization.

class ionworkspipeline.optimizers.ScipyLeastSquares(**solver_args)

Optimizer using the scipy least_squares function.

Parameters

solver_argsdict, optional

Parameters are passed to the scipy least_squares function. See the documentation for scipy.optimize.least_squares for details.

Extends: ionworkspipeline.data_fits.optimizers.optimizer.Optimizer

optimize(x0)

Optimize the objective function.

Parameters

x0array_like

Initial guess.

Returns

resscipy.optimize.OptimizeResult

The result of the optimization.

class ionworkspipeline.optimizers.ScipyMinimize(**solver_args)

Optimizer using the scipy minimize function.

Parameters

solver_argsdict, optional

Parameters are passed to the scipy minimize function. See the documentation for scipy.optimize.minimize for details.

Extends: ionworkspipeline.data_fits.optimizers.optimizer.Optimizer

optimize(x0)

Optimize the objective function.

Parameters

x0 : array_like

Returns

resscipy.optimize.OptimizeResult

The result of the optimization.

class ionworkspipeline.optimizers.ScipyShgo(**solver_args)

Optimizer using the scipy SHGO (Simplicial Homology Global Optimization) function.

Parameters

solver_argsdict, optional

Parameters are passed to the scipy shgo function. See the documentation for scipy.optimize.shgo for details.

Extends: ionworkspipeline.data_fits.optimizers.optimizer.Optimizer

optimize(x0)

Optimize the objective function.

Parameters

x0array_like

Initial guess. Note that SHGO is a global optimizer and doesn’t strictly require an initial guess, but it can be used to set the dimensionality of the problem.

Returns

resscipy.optimize.OptimizeResult

The result of the optimization.

class ionworkspipeline.optimizers.ScipyDualAnnealing(**solver_args)

Optimizer using the scipy Dual Annealing function.

Parameters

solver_argsdict, optional

Parameters are passed to the scipy dual_annealing function. See the documentation for scipy.optimize.dual_annealing for details.

Extends: ionworkspipeline.data_fits.optimizers.optimizer.Optimizer

optimize(x0)

Optimize the objective function.

Parameters

x0array_like

Initial guess. Note that Dual Annealing is a global optimizer and doesn’t strictly require an initial guess, but it can be used to set the dimensionality of the problem.

Returns

resscipy.optimize.OptimizeResult

The result of the optimization.

class ionworkspipeline.optimizers.PDFO(**solver_args)

Optimizer using the library PDFO: Powell’s Derivative-Free Optimization solvers.

Parameters

solver_argsdict, optional

Parameters are passed to the pdfo function. See the pdfo documentation for details.

Extends: ionworkspipeline.data_fits.optimizers.optimizer.Optimizer

optimize(x0)

Optimize the objective function.

Parameters

x0 : array_like

class ionworkspipeline.optimizers.Pints(method='CMAES', log_to_screen=False, max_iterations=1000, max_unchanged_iterations=200, max_unchanged_iterations_threshold=1e-11, threshold=None, **solver_args)

Optimizer using the library pints: Probabilistic Inference for Bayesian Models. This is a wrapper around the pints OptimisationController class.

Parameters

methodstr, optional

The method to use for the optimization. Default is “CMAES”.

log_to_screenbool, optional

Whether to print information at runtime. Default is False.

max_iterationsint, optional

The maximum number of iterations. Default is 1000.

max_unchanged_iterationsint, optional

The maximum number of unchanged iterations. Default is 200.

max_unchanged_iterations_thresholdfloat, optional

The threshold for the maximum number of unchanged iterations. Default is 1e-11.

solver_argsdict, optional

Parameters are passed to the pints function. See the pints documentation for details.

Extends: ionworkspipeline.data_fits.optimizers.optimizer.Optimizer

optimize(x0)

Optimize the objective function.

Parameters

x0 : array_like

class ionworkspipeline.optimizers.Chain(*optimizers)

Chain of optimizers to be run in sequence, where the output of one optimizer is the initial guess for the next optimizer.

Parameters

*optimizerslist of Optimizer objects

The optimizers to be run in sequence.

Extends: builtins.list

property cost

If all optimizers have the same default cost function, return it. Otherwise, raise an error.

optimize(x0)

Optimize the objective function by running each optimizer in sequence.

Parameters

x0array_like

Initial guess for the independent variables.

Returns

resscipy.optimize.OptimizeResult

The result of the optimization.