pwrs.core.opf_legacy_user_cost_fcn#

pwrs.core.opf_legacy_user_cost_fcn.opf_legacy_user_cost_fcn(x, cp, nargout=1)[source]#

Evaluate legacy user-defined costs and derivatives.

Parameters:
  • x (array_like) – Optimization variable vector.

  • cp (dict) – Legacy user-defined cost parameter dict such as returned by OPFModel.get_cost_params().

  • nargout (int, optional) – Number of outputs to emulate from the MATLAB interface.

Returns:

Returns the scalar cost and, when requested, its gradient and Hessian.

Return type:

float or tuple

pwrs.core.opf_legacy_user_cost_fcn.opf_legacy_user_cost_fcn_full(x, cp)[source]#

Request the full legacy user-cost contract.

This semantic helper keeps internal callers independent of nargout.