pybop.optimisers.nlopt_optimize#
Module Contents#
Classes#
Extends BaseOptimiser to utilize the NLopt library for nonlinear optimization. |
- class pybop.optimisers.nlopt_optimize.NLoptOptimize(n_param, xtol=None, method=None, maxiter=None)[source]#
Bases:
pybop.optimisers.base_optimiser.BaseOptimiserExtends BaseOptimiser to utilize the NLopt library for nonlinear optimization.
This class serves as an interface to the NLopt optimization algorithms. It allows the user to define an optimization problem with bounds, initial guesses, and to select an optimization method provided by NLopt.
- Parameters:
n_param (int) – Number of parameters to optimize.
xtol (float, optional) – The relative tolerance for optimization (stopping criteria). If not provided, a default of 1e-5 is used.
method (nlopt.algorithm, optional) – The NLopt algorithm to use for optimization. If not provided, LN_BOBYQA is used by default.
maxiter (int, optional) – The maximum number of iterations to perform during optimization. If not provided, NLopt’s default is used.
- _runoptimise(cost_function, x0, bounds)[source]#
Runs the optimization process using the NLopt library.
- Parameters:
cost_function (callable) – The objective function to minimize. It should take an array of parameter values and return the scalar cost.
x0 (array_like) – The initial guess for the parameters.
bounds (dict) – A dictionary containing the ‘lower’ and ‘upper’ bounds arrays for the parameters.
- Returns:
A tuple containing the optimized parameter values and the final cost.
- Return type:
tuple