e04nc {NAGFWrappers} R Documentation

## e04nc: Convex QP problem or linearly-constrained linear least squares problem (dense)

### Description

e04nc solves linearly constrained linear least squares problems and convex quadratic programming problems. It is not intended for large sparse problems.

### Usage

```e04nc(c, bl, bu, cvec, istate, kx, x, a, b, optlist,
m = nrow(a),
n = nrow(kx),
nclin = nrow(c))
```

### Arguments

`c`

double array

The ith row of c must contain the coefficients of the ith general constraint for i=1 . . . nclin.

`bl`

double array

`bu`

double array

Bl must contain the lower bounds and bu the upper bounds, for all the constraints, in the following order. The first n elements of each array must contain the bounds on the variables, and the next n_L elements must contain the bounds for the general linear constraints (if any). To specify a nonexistent lower bound (i.e., l_j = - infinity), set bl[j] <= - bigbnd, and to specify a nonexistent upper bound (i.e., u_j = + infinity), set bu[j] >= bigbnd; the default value of bigbnd is 10^20, but this may be changed by the optional argument infiniteboundsize. To specify the jth constraint as an equality, set bu[j] = bl[j] = β, say, where abs(β) < bigbnd.

`cvec`

double array

The coefficients of the explicit linear term of the objective function.

`istate`

integer array

Need not be set if the (default) optional argument coldstart is used.

`kx`

integer array

Need not be initialized for problems of type FP, LP, QP1, QP2, LS1 (the default) or LS2.

`x`

double array

An initial estimate of the solution.

`a`

double array

The array a must contain the matrix A as specified in table1 (see the Description in Fortran library documentation).

`b`

double array

The m elements of the vector of observations.

`optlist`

options list

Optional parameters may be listed, as shown in the following table:

 Name Type Default `Cold Start` Default `Warm Start` `Crash Tolerance` double Default = 0.01 `Defaults` `Feasibility Phase Iteration Limit` integer Default = max(50, 5(n + n_L)) `Optimality Phase Iteration Limit` integer Default = max(50, 5(n + n_L)) `Feasibility Tolerance` double Default = sqrt(ε) `Hessian` no Default = NO `Infinite Bound Size` double Default = 10^20 `Infinite Step Size` double Default = max(bigbnd, 10^20) `Iteration Limit` integer Default = max(50, 5(n + n_L)) `Iters` `Itns` `List` Default for e04nc = list `Nolist` Default for e04nc = nolist `Monitoring File` integer Default = - 1 `Print Level` integer = 0 `Problem Type` string Default = LS1 `Rank Tolerance` double Default = 100ε or 10sqrt(ε) (see below)
`m`

integer: default = nrow(a)

m

, the number of rows in the matrix A. If the problem is specified as type FP or LP, m is not referenced and is assumed to be zero.

`n`

integer: default = nrow(kx)

n

, the number of variables.

`nclin`

integer: default = nrow(c)

n_L

, the number of general linear constraints.

### Details

R interface to the NAG Fortran routine E04NCF.

### Value

 `ISTATE` integer array The status of the constraints in the working set at the point returned in x. The significance of each possible value of istate[j] is as follows: `KX` integer array Defines the order of the columns of a with respect to the ordering of x, as described above. `X` double array The point at which e04nc terminated. If ifail =0, ifail =1, ifail =4, x contains an estimate of the solution. `A` double array If hessian=NO and the problem is of type LS or QP, a contains the upper triangular Cholesky factor R of eqn8 (see the Fortran library documentation), with columns ordered as indicated by kx. If hessian=YES and the problem is of type LS or QP, a contains the upper triangular Cholesky factor R of the Hessian matrix H, with columns ordered as indicated by kx. In either case R may be used to obtain the variance-covariance matrix or to recover the upper triangular factor of the original least squares matrix. `B` double array The transformed residual vector of equation eqn10 (see the Fortran library documentation). `ITER` integer The total number of iterations performed. `OBJ` double The value of the objective function at x if x is feasible, or the sum of infeasibiliites at x otherwise. If the problem is of type FP and x is feasible, obj is set to zero. `CLAMDA` double array The values of the Lagrange multipliers for each constraint with respect to the current working set. The first n elements contain the multipliers for the bound constraints on the variables, and the next n_L elements contain the multipliers for the general linear constraints (if any). If istate[j] = 0 (i.e., constraint j is not in the working set), clamda[j] is zero. If x is optimal, clamda[j] should be non-negative if istate[j] = 1, non-positive if istate[j] = 2 and zero if istate[j] = 4. `IFAIL` integer ifail =0 unless the function detects an error or a warning has been flagged (see the Errors section in Fortran library documentation).

NAG

### Examples

```
optlist<-list()

ifail<-0

c<-matrix(c(1,1,1,1,1,1,1,1,4,1,2,3,4,-2,1,1,1,1,1,-1,1,-1,1,1,1,1,1),nrow=3,ncol=9,byrow=TRUE)

bl<-matrix(c(0,0,-9.999999999999999e+24,0,0,0,0,0,0,2,-9.999999999999999e+24,1),nrow=12,ncol=1,byrow=TRUE)

bu<-matrix(c(2,2,2,2,2,2,2,2,2,9.999999999999999e+24,2,4),nrow=12,ncol=1,byrow=TRUE)

cvec<-matrix(c(0),nrow=1,ncol=1,byrow=TRUE)

istate<-as.matrix(mat.or.vec(12,1))

kx<-as.matrix(mat.or.vec(9,1))

x<-matrix(c(1,0.5,0.3333,0.25,0.2,0.1667,0.1428,0.125,0.1111),nrow=9,ncol=1,byrow=TRUE)

a<-matrix(c(1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,0,0,1,1,3,1,1,1,-1,-1,-3,1,1,1,4,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,2,1,1,0,0,0,-1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,2,2,3,1,0,1,1,1,1,0,2,2),nrow=10,ncol=9,byrow=TRUE)

b<-matrix(c(1,1,1,1,1,1,1,1,1,1),nrow=10,ncol=1,byrow=TRUE)

e04nc(c,bl,bu,cvec,istate,kx,x,a,b,optlist)

```

[Package NAGFWrappers version 24.0 Index]