| (6.34) |

subject to

The ﬁrst diﬀerence to note is that the optimization variable from the standard OPF formulation has been augmented with additional variables to form a new optimization variable , and likewise with the lower and upper bounds.

| (6.39) |

Second, there is an additional user-deﬁned cost term in the objective function. This cost consists of three pieces that will be described in more detail below.

| (6.40) |

Third, the nonlinear constraints and are augmented with user deﬁned additions and to give and .

Up through version 6.0 of ^{35} linear
constraints,^{36}
and costs of the pre-speciﬁed form deﬁned by
.^{37}
This preserved the ability to use solvers that employ pre-compiled MEX ﬁles to compute
all of the costs and constraints. This is referred to as

For the AC OPF, subsequent versions also include the general nonlinear
constraints and , and the quadratic and general nonlinear costs and
. The new quadratic cost terms can be handled by all of ^{38}

Section 7 describes the mechanisms available to the user for taking advantage of the extensible formulation described here.

The creation of additional user-deﬁned variables can be done explicitly or implicitly based on the diﬀerence between the number of columns in and the dimension of the standard OPF optimization variable . The optional vectors and are available to impose lower and upper bounds on , respectively.

Linear Constraints – The user-deﬁned linear constraints (6.38) are general linear restrictions involving all of the optimization variables and are speciﬁed via matrix and lower and upper bound vectors and . These parameters can be used to create equality constraints () or inequality constraints that are bounded below (), bounded above () or bounded on both sides.Nonlinear Constraints – The user-deﬁned general nonlinear constraints take the form where and are sets of indices for user-deﬁned equality and inequality constraint sets, respectively.Each of these constraint sets is deﬁned by two M-ﬁle functions, similar to those required by MIPS, one that computes the constraint values and their gradients (Jacobian), and the other that computes Hessian values.

The user-deﬁned cost function consists of three terms for three diﬀerent types of costs: quadratic, general nonlinear, and legacy. Each term is a simple summation over all of the cost sets of that type.

Quadratic Costs for a cost set are speciﬁed by parameters , and that deﬁne a quadratic function of the optimization variable .(6.47) General Nonlinear Costs for a cost set consist of a cost function provided in the form of a function handle to an M-ﬁle function that evaluates the cost and its gradients and Hessian for a given value of .Legacy Costs are speciﬁed in terms of parameters , , , , , and . For simplicity of presentation, we will drop the subscript for the rest of this discussion. All of the parameters are vectors except the symmetric matrix and the matrix . The legacy user cost function takes the form(6.48) where is deﬁned in several steps as follows. First, a new vector is created by applying a linear transformation and shift to the full set of optimization variables

(6.49) then a scaled function with a “dead zone” is applied to each element of to produce the corresponding element of .

(6.50) Here speciﬁes the size of the “dead zone”, is a simple scale factor and is a pre-deﬁned scalar function selected by the value of . Currently,

Matpower implements only linear and quadratic options:(6.51) as illustrated in Figure 6-1 and Figure 6-2, respectively.

This form for provides the ﬂexibility to handle a wide range of costs, from simple linear functions of the optimization variables to scaled quadratic penalties on quantities, such as voltages, lying outside a desired range, to functions of linear combinations of variables, inspired by the requirements of price coordination terms found in the decomposition of large loosely coupled problems encountered in our own research.

Some limitations are imposed on the parameters in the case of the DC OPF since

Matpower uses a generic quadratic programming (QP) solver for the optimization. In particular, and for all , so the “dead zone” is not considered and only the linear option is available for . As a result, for the DC case (6.50) simpliﬁes to .