Gradient

class pyoptsparse.pyOpt_gradient.Gradient(optProb, sensType, sensStep=None, sensMode='', comm=None)[source]

Gradient class for automatically computing gradients with finite difference or complex step.

Parameters:
optProbOptimization instance

This is the complete description of the optimization problem.

sensTypestr
  • fd for forward difference

  • cd for central difference

  • fdr for forward difference with relative step size

  • cdr for central difference with relative step size

  • cs for complex step

sensStepfloat | complex, optional

Step size to use for differencing. By default 1e-6 for fd/fdr, 1e-4 for cd/cdr, 1e-40j for cs. Must be a purely imaginary value for cs.

sensModestr

Flag to compute gradients in parallel.