Consider the following nonlinear optimization problem with four variables x = (u, v, z, w):

This problem has several characteristics that can be exploited by SNOPT:
The objective function is nonlinear, and it is the sum of a nonlinear function of the three variables x' = (u, v, z) and a linear function of (potentially) all variables x.
The first two constraints are nonlinear, and the third constraint is linear.
Each nonlinear constraint involves the sum of a nonlinear function of the two variable x'' = (u, v) and a linear function of the remaining variables y'' = (z, w).
The nonlinear terms are defined by user-written subroutines funobj and funcon, which involve only x' and x'' , the appropriate subsets of variables.
For the objective, we define the function f(u, v, z) = (u + v + z)2 to include only the nonlinear terms. The variables x' = (u, v, z) are known as nonlinear objective variables, and their dimension is specified by the snopt input parameter nnObj (= 3 here). The linear part 3z + 5w of the objective is treated as an additional linear constraint whose row index is specified by the input parameter iObj (= 3 or 4 here). Thus, the full objective has the form

where x' is the first nnObj variables, f(x') is defined by subroutine funobj, and c is a constant vector that forms row iObj of the full Jacobian matrix A.
Similarly for the constraints, we define a vector function f(u, v) to include just the nonlinear terms. In this example, F1(u, v) = u2 + v2 and F2(u, v) = u4 + v4. The number of nonlinear constraints (the dimension of F) is specified by the input parameter nnCon (= 2 here). The variables x'' = (u, v) are known as nonlinear Jacobian variables, with dimension specified by nnJac ( = 2 here). Thus, the constraint functions and the linear part of the objective have the form

where x'' is the first nnJac variables, F(x'') is defined by subroutine funcon, and y'' contains the remaining variables. The full Jacobian is of the form
with the Jacobian of F always appearing in the top left corner of A. The constant matrices A2, A3, A4 and the sparsity pattern of J(x'') are input column-wise via the array parameters a, ha, ka. (Elements that are identically zero need not be included.)
The inequalities l1
F(x'') + A2 y''
u1
and
l2
A3 x + A4 y''
u2 implied
by the constraint functions (3.1) are known as the nonlinear and
linear constraints respectively. Together, these two
sets of inequalities constitute the general constraints.
In general, the vectors x' and x'' have different dimensions, but they always overlap, in the sense that the shorter vector is always the beginning of the other. In the example, the nonlinear Jacobian variables (u, v) are an ordered subset of the nonlinear objective variables (u, v, w). In other cases it could be the other way round—whichever is the most convenient—but the first way keeps J(x'') smaller.
Together the nonlinear objective and nonlinear Jacobian variables comprise the nonlinear variables. The number of nonlinear variables is therefore the larger of the dimensions of x' and x''.