desc.objectives.ObjectiveFunction
- class desc.objectives.ObjectiveFunction(objectives, use_jit=True, deriv_mode='batched', verbose=1)Source
Objective function comprised of one or more Objectives.
- Parameters:
objectives (tuple of Objective) – List of objectives to be minimized.
use_jit (bool, optional) – Whether to just-in-time compile the objectives and derivatives.
deriv_mode ({"batched", "blocked"}) – method for computing derivatives. “batched” is generally faster, “blocked” may use less memory. Note that the “blocked” Hessian will only be block diagonal.
verbose (int, optional) – Level of output.
Methods
build([eq, use_jit, verbose])Build the objective.
compile([mode, verbose])Call the necessary functions to ensure the function is compiled.
compute_scalar(x[, constants])Compute the sum of squares error.
compute_scaled(x[, constants])Compute the objective function and apply weighting and normalization.
compute_scaled_error(x[, constants])Compute and apply the target/bounds, weighting, and normalization.
compute_unscaled(x[, constants])Compute the raw value of the objective function.
copy([deepcopy])Return a (deep)copy of this object.
eq(other)Compare equivalence between DESC objects.
grad(x[, constants])Compute gradient vector of scalar form of the objective wrt x.
hess(x[, constants])Compute Hessian matrix of scalar form of the objective wrt x.
jac_scaled(x[, constants])Compute Jacobian matrix of vector form of the objective wrt x.
jac_unscaled(x[, constants])Compute Jacobian matrix of vector form of the objective wrt x, unweighted.
jit()Apply JIT to compute methods, or re-apply after updating self.
jvp_scaled(v, x)Compute Jacobian-vector product of the objective function.
jvp_unscaled(v, x)Compute Jacobian-vector product of the objective function.
load(load_from[, file_format])Initialize from file.
print_value(x[, constants])Print the value(s) of the objective.
save(file_name[, file_format, file_mode])Save the object.
set_args(*args)Set which arguments the objective should expect.
unpack_state(x)Unpack the state vector into its components.
vjp_scaled(v, x)Compute vector-Jacobian product of the objective function.
vjp_unscaled(v, x)Compute vector-Jacobian product of the objective function.
x(eq)Return the full state vector from the Equilibrium eq.
Attributes
Names (str) of arguments to the compute functions.
lower and upper bounds for residual vector.
Whether the objectives have been built or not.
Whether the functions have been compiled or not.
constant parameters for each sub-objective.
Number of objective equations.
Dimensional of the state vector.
Dimensions of the argument given by the dict keys.
List of objectives.
Whether default "compute" method is a scalar or vector.
target vector.
Whether to just-in-time compile the objective and derivatives.
weight vector.
Indices of the components of the state vector.