Optimizer

class pyoptsparse.pyOpt_optimizer.Optimizer(*args, **kwargs)[source]

This is the base optimizer class that all optimizers inherit from. We define common methods here to avoid code duplication.

Parameters:
namestr

Optimizer name

categorystr

Typically local or global

defaultOptionsdictionary

A dictionary containing the default options

informsdict

Dictionary of the inform codes

getInform(infocode=None)[source]

Get optimizer result inform code at exit

Parameters:
infocodeint

Integer information code

getOption(name)[source]

Return the optimizer option value for name

Parameters:
namestr

name of option for which to retrieve value

Returns:
valuevaries

value of option for ‘name’

setOption(name, value=None)[source]

Generic routine for all option setting. The routine does error checking on the type of the value.

Parameters:
namestr

Name of the option to set

valuevaries

Variable value to set.

pyoptsparse.pyOpt_optimizer.OPT(optName, *args, **kwargs)[source]

This is a simple utility function that enables creating an optimizer based on the ‘optName’ string. This can be useful for doing optimization studies with respect to optimizer since you don’t need massive if-statements.

Parameters:
optNamestr or enum

Either a string identifying the optimizer to create, e.g. “SNOPT”, or an enum accessed via pyoptsparse.Optimizers, e.g. Optimizers.SNOPT.

*args, **kwargsvaries

Passed to optimizer creation.

Returns:
optpyOpt_optimizer inherited optimizer

The desired optimizer