scipy_optimizer.py

OpenMDAO Wrapper for the scipy.optimize.minimize family of local optimizers.

class openmdao.drivers.scipy_optimizer.ScipyOptimizer[source]

Bases: openmdao.core.driver.Driver

Driver wrapper for the scipy.optimize.minimize family of local optimizers. Inequality constraints are supported by COBYLA and SLSQP, but equality constraints are only supported by COBYLA. None of the other optimizers support constraints.

confunc(x_new, name, idx)[source]

Function that returns the value of the constraint function requested in args. Note that this function is called for each constraint, so the model is only run when the objective is evaluated.

Args:

x_new : ndarray

Array containing parameter values at new design point.

name : string

Name of the constraint to be evaluated.

idx : float

Contains index into the constraint array.

Returns:

float

Value of the constraint function.

congradfunc(x_new, name, idx)[source]

Function that returns the cached gradient of the constraint function. Note, scipy calls the constraints one at a time, so the gradient is cached when the objective gradient is called.

Args:

x_new : ndarray

Array containing parameter values at new design point.

name : string

Name of the constraint to be evaluated.

idx : float

Contains index into the constraint array.

Returns:

float

Gradient of the constraint function wrt all params.

gradfunc(x_new)[source]

Function that evaluates and returns the objective function. Gradients for the constraints are also calculated and cached here.

Args:

x_new : ndarray

Array containing parameter values at new design point.

Returns:

ndarray

Gradient of objective with respect to parameter array.

objfunc(x_new)[source]

Function that evaluates and returns the objective function. Model is executed here.

Args:

x_new : ndarray

Array containing parameter values at new design point.

Returns:

float

Value of the objective function evaluated at the new design point.

run(problem)[source]

Optimize the problem using your choice of Scipy optimizer.

Args:

problem : Problem

Our parent Problem.