e04vj {NAGFWrappers}R Documentation

e04vj: Determine the pattern of nonzeros in the Jacobian matrix for e04vh

Description

e04vj may be used before e04vh to determine the sparsity pattern for the Jacobian.

Usage

e04vj(nf, usrfun, lena, leng, x, xlow, xupp,
      n = nrow(x))

Arguments

nf

integer

nf

, the number of problem functions in F(x), including the objective function (if any) and the linear and nonlinear constraints. Simple upper and lower bounds on x can be defined using the arguments xlow and xupp and should not be included in F.

usrfun

function

usrfun must define the problem functions F(x). This function is passed to e04vj as the external argument usrfun.

(STATUS,F,G) = usrfun(status,n,x,needf,nf,f,needg,leng,g)

lena

integer

Lena should be an overestimate of the number of elements in the linear part of the Jacobian.

leng

integer

Leng should be an overestimate of the number of elements in the nonlinear part of the Jacobian.

x

double array

An initial estimate of the variables x. The contents of x will be used by e04vj in the call of usrfun, and so each element of x should be within the bounds given by xlow xupp.

xlow

double array

xupp

double array

Contain the lower and upper bounds l_x and u_x on the variables x.

n

integer: default = nrow(x)

n

, the number of variables.

Details

R interface to the NAG Fortran routine E04VJF.

Value

IAFUN

integer array

JAVAR

integer array

NEA

integer

Is the number of nonzero entries in A such that F(x) = f(x) + Ax.

A

double array

Define the coordinates (ij) and values A_ij of the nonzero elements of the linear part A of the function F(x) = f(x) + Ax.

IGFUN

integer array

JGVAR

integer array

Define the coordinates (ij) of the nonzero elements of G, the nonlinear part of the derivatives J(x) = G(x) + A of the function F(x) = f(x) + Ax.

NEG

integer

The number of nonzero entries in G.

IFAIL

integer

ifail =0

unless the function detects an error or a warning has been flagged (see the Errors section in Fortran library documentation).

Author(s)

NAG

References

http://www.nag.co.uk/numeric/FL/nagdoc_fl23/pdf/E04/e04vjf.pdf

Examples


optlist <- list()

ifail <- 0
usrfun = function(status, n, x, needf, nf, f, needg, 
    leng, g) {
    
    f[1] <- 1000 %*% sin(-x[1] - 0.25) + 1000 %*% sin(-x[2] - 
        0.25) - x[3]
    f[2] <- 1000 %*% sin(x[1] - 0.25) + 1000 %*% sin(x[1] - x[2] - 
        0.25) - x[4]
    f[3] <- 1000 %*% sin(x[2] - x[1] - 0.25) + 1000 %*% sin(x[2] - 
        0.25)
    f[4] <- -x[1] + x[2]
    f[5] <- x[1] - x[2]
    f[6] <- 1e-06 %*% x[3]^3 + 2e-06 %*% x[4]^3/3 + 3 %*% x[3] + 
        2 %*% x[4]
    list(STATUS = as.integer(status), F = as.matrix(f), G = as.matrix(g))
}

nf <- 6

lena <- 300

leng <- 300

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



xlow <- matrix(c(-0.55, -0.55, 0, 0), nrow = 4, ncol = 1, 
    byrow = TRUE)



xupp <- matrix(c(0.55, 0.55, 1200, 1200), nrow = 4, 
    ncol = 1, byrow = TRUE)



e04vj(nf, usrfun, lena, leng, x, xlow, xupp) 


[Package NAGFWrappers version 24.0 Index]