Optimize¶
-
pypesto.optimize.
minimize
(problem, optimizer=None, n_starts=100, startpoint_method=None, result=None, engine=None, options=None) → pypesto.result.Result¶ This is the main function to call to do multistart optimization.
Parameters: - problem (pypesto.Problem) – The problem to be solved.
- optimizer (pypesto.Optimizer) – The optimizer to be used n_starts times.
- n_starts (int) – Number of starts of the optimizer.
- startpoint_method ({callable, False}, optional) – Method for how to choose start points. False means the optimizer does not require start points
- result (pypesto.Result) – A result object to append the optimization results to. For example, one might append more runs to a previous optimization. If None, a new object is created.
- options (pypesto.OptimizeOptions, optional) – Various options applied to the multistart optimization.
-
class
pypesto.optimize.
OptimizeOptions
(startpoint_resample=False, allow_failed_starts=False)¶ Bases:
dict
Options for the multistart optimization.
Parameters: - startpoint_resample (bool, optional) – Flag indicating whether initial points are supposed to be resampled if function evaluation fails at the initial point
- allow_failed_starts (bool, optional) – Flag indicating whether we tolerate that exceptions are thrown during the minimization process.
-
__init__
(startpoint_resample=False, allow_failed_starts=False)¶ Initialize self. See help(type(self)) for accurate signature.
-
static
assert_instance
(maybe_options)¶ Returns a valid options object.
Parameters: maybe_options (OptimizeOptions or dict) –
-
class
pypesto.optimize.
OptimizerResult
(x=None, fval=None, grad=None, hess=None, n_fval=None, n_grad=None, n_hess=None, n_res=None, n_sres=None, x0=None, fval0=None, trace=None, exitflag=None, time=None, message=None)¶ Bases:
dict
The result of an optimizer run. Used as a standardized return value to map from the individual result objects returned by the employed optimizers to the format understood by pypesto.
Can be used like a dict.
-
x
¶ The best found parameters.
Type: ndarray
-
fval
¶ The best found function value, fun(x).
Type: float
-
grad, hess
The gradient and Hessian at x.
Type: ndarray
-
n_fval
¶ Number of function evaluations.
Type: int
-
n_grad
¶ Number of gradient evaluations.
Type: int
-
n_hess
¶ Number of Hessian evaluations.
Type: int
-
exitflag
¶ The exitflag of the optimizer.
Type: int
-
message
¶ Textual comment on the optimization result.
Type: str
Notes
Any field not supported by the optimizer is filled with None. Some fields are filled by pypesto itself.
-
__init__
(x=None, fval=None, grad=None, hess=None, n_fval=None, n_grad=None, n_hess=None, n_res=None, n_sres=None, x0=None, fval0=None, trace=None, exitflag=None, time=None, message=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
pypesto.optimize.
Optimizer
¶ Bases:
abc.ABC
This is the optimizer base class, not functional on its own.
An optimizer takes a problem, and possibly a start point, and then performs an optimization. It returns an OptimizerResult.
-
__init__
()¶ Default constructor.
-
static
get_default_options
()¶ Create default options specific for the optimizer.
-
is_least_squares
()¶
-
minimize
(problem, x0, index)¶ ” Perform optimization.
-
-
class
pypesto.optimize.
ScipyOptimizer
(method='L-BFGS-B', tol=1e-09, options=None)¶ Bases:
pypesto.optimize.optimizer.Optimizer
Use the SciPy optimizers.
-
__init__
(method='L-BFGS-B', tol=1e-09, options=None)¶ Default constructor.
-
static
get_default_options
()¶ Create default options specific for the optimizer.
-
is_least_squares
()¶
-
minimize
(problem, x0, index)¶
-
-
class
pypesto.optimize.
DlibOptimizer
(method, options=None)¶ Bases:
pypesto.optimize.optimizer.Optimizer
Use the Dlib toolbox for optimization.
-
__init__
(method, options=None)¶ Default constructor.
-
static
get_default_options
()¶ Create default options specific for the optimizer.
-
is_least_squares
()¶
-
minimize
(problem, x0, index)¶
-