foxes_opt.core.FarmOptProblem.calc_gradients(vars_int, vars_float, func, components, ivars, fvars, vrs, pop=False, verbosity=0)

The actual gradient calculation, not to be called directly (call get_gradients instead).

Can be overloaded in derived classes, the base class only considers analytic derivatives.

Parameters

vars_int: np.array

The integer variable values, shape: (n_vars_int,)

vars_float: np.array

The float variable values, shape: (n_vars_float,)

func: iwopy.core.OptFunctionList, optional

The functions to be differentiated, or None for a list of all objectives and all constraints (in that order)

components: list of int, optional

The function’s component selection, or None for all

ivars: list of int

The indices of the function int variables in the problem

fvars: list of int

The indices of the function float variables in the problem

vrs: list of int

The function float variable indices wrt which the derivatives are to be calculated

pop: bool

Flag for vectorizing calculations via population

verbosity: int

The verbosity level, 0 = silent

Returns

gradients: numpy.ndarray

The gradients of the functions, shape: (n_components, n_vrs)