5.10. UDFBase

class UDFBase

The base class for user to define function.

Methods

arguments()

Method to get function argument list. Each argument should be a Var or a non-const expression.

eval()

Method to evaluate this function.

argmin()

Method to minimize function value.

arguments()

Method to get function argument list. Each argument should be a Var or a non-const expression.

return:

Type: list

A list of Var or Expr objects that this UDF operates on.

eval(tensorlist: list)

Method to evaluate this function.

For indicator functions, return 0.0 if feasible and float(“inf”) otherwise.

param tensorlist:

Type: list

List of numpy.ndarray . Each one is a value for corresponding variable associated.

return:

Type: float

The function value. For indicator functions, return 0.0 if feasible and float(“inf”) otherwise.

argmin(lamb: float, tensorlist: list)

Method to minimize function value.

The implementation must solve: argmin_x f(x) + (lamb/2)||x - v||^2, where v is the current iterate passed via tensorlist.

For indicator functions, the argmin reduces to projection onto the feasible set.

param lamb:

Type: float

The penalty weight (rho) provided by the ADMM iteration. The argmin method must solve: argmin_x f(x) + (lamb/2)||x - v||^2.

param tensorlist:

Type: list

List of numpy.ndarray , the current iterate values for each associated variable.

return:

Type: list

The variable value list that minimizes the proximal subproblem, or None to stop the optimization.