User's Guide
|
prntout: Arguments
prntoutc: Prototype
CURVI is a program that solves nonlinear optimization problems of the following form:
Minimize or maximize f (X),
subject to xlbj £ xj £ xubj for j=1,...,n.
X is a vector of n variables, x1 ,...,xn, and the function f depends on X.
CURVI uses first and second partial derivatives of the objective function f with respect to each variable xj. These derivatives are computed automatically by finite difference approximations (either forward or central differences) unless the user supplies a function that evaluates them using formulas or other methods.
CURVI can be used by Fortran programs, by C programs, and by any PC Windows application capable of referencing a DLL. This User’s Guide documents the Fortran version of CURVI and C interface that is available in the PC Windows DLL.
There are a few essential steps that must be taken in order to present an optimization problem to CURVI. The first decision is to determine which of the optimization routines (curvif, curvig, curvih) is best for the particular problem. curvif uses only function values to perform the optimization; curvig uses function values and gradient values; curvih uses function values, gradient values, and Hessian values. It is easiest to begin using curvif, since it does not require the user to supply any derivatives. If you are working in C then you will choose one of the following: curvifc, curvigc, or curvihc.
A subroutine must be written to compute values of the objective function for given values of the variables. Second, the upper and lower bounds on the variables must be specified. In addition, the user can supply the gradient (for use with curvig) and even the Hessian (for use with curvih) if these functions are easy to compute or if CPU time is of the essence. The extra work by the user to prepare subroutines that evaluate gradients and Hessians can pay off by reducing the time needed for the optimization or can make it possible to solve very difficult problems.
The following table summarizes the user callable functions in the CURVI package and gives the section where they are documented. Select the optimization routine that you wish to use and proceed to the section that describes how to call that routine. It may also be helpful to view the example programs.
|
Routine |
Description |
|
Fortran: curvifC: curvifc |
Provide only the function to be minimized. |
|
Fortran: curvigC: curvigc |
Provide function to be minimized and gradient. |
|
Fortran: curvihC: curvihc |
Provide function to be minimized, gradient, and Hessian. |
|
Fortran: prntoutC: prntoutc |
Prints initial and final parameter values to a file |
This section documents the Fortran interface for curvif, curvig, curvih, and prntout. An example problem and Fortran programs are used to illustrate the essential steps necessary to use these routines.
The example problem has 3 variables {X1, X2, X3}, with no bounds, and a polynomial objective function.
Minimize: f (X) = X1**4 + (X2 - 1.0)**2 + (X3 + 1.0)**2 + X1*X2*X3
This problem uses X = {1, 1, 1} as the starting point to begin the optimization process. The global minimum occurs at X = {1, 2, -2}.
The Fortran main program that calls curvif appears below. The subroutine fcn evaluates the objective function for the example problem. Subroutine prntout is called to write output to the text file "doc_ex1.txt".
Program Doc_ex1
implicit none
double precision x0(25), bl(25), bu(25), wa(2575)
integer ibound, jbound(25)
double precision fopt, eps
integer n, nfu, nit, idiff, kmax, ier, ngr, nhes
external fcn
! set initial guess
x0(1)= 1.
x0(2)= 1.
x0(3)= 1.
! number of variables is 3 (n = 3)
! stopping criterion is 1.0d-4 (eps = 1.0d-4)
! maximum number of function evaluations is 15000 (nfu = 0)
n = 3
eps = 1.0d-4
nfu = 0
! use forward differences (idiff = 1)
idiff = 1
! recomputed Hessian every 3 iterations (kmax = 3)
kmax = 3
! no bounds on variables
ibound = 0
! Print initial values.
call prntout (fcn, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nhes, nit, ier, 0, 'doc_ex1.txt')
! Call curvif
call curvif(fcn, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, nit, idiff, kmax, ier)
! Print final results
call prntout (fcn, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nhes, nit, ier, 1, 'doc_ex1.txt')
end
subroutine fcn(n, x, f)
implicit none
integer n
double precision x(n), f
f = x(1)**4 + (x(2)-1.0)**2 + (x(3)+1.0)**2 + x(1)*x(2)*x(3)
return
end
subroutine curvif (fu, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, nit, idiff, kmax, ier)
external fu
integer n, nfu, nit, idiff, kmax, ier
integer ibound, jbound(*)
double precision x0(n), fopt, eps, bl(*), bu(*), wa(*)
Input Arguments:
fu: user supplied subroutine which computes the function
to be minimized.
Usage: call fu(n,x,f)
n: number of variables, length of x.
x: vector of length n.
f: value of the function at the point x.
n: number of variables.
x0: initial guess point, vector of length n.
eps: tolerance for the stopping criterion.
ibound: parameter such that if equal to
0 is an unconstrained problem
1 is a constrained problem.
jbound: working vector of dimension n defining the sort of
constraint for each variable (only used when ibound .ne. 0).
jbound(i) = 0 if the ith variable has no constraints.
1 if the ith variable has only upper bounds.
2 if the ith variable has only lower bounds.
3 if the ith variable has both upper and
lower bounds.
bl: vector of lower bounds (not used if ibound=0).
bu: vector of upper bounds (not used if ibound=0).
wa: working vector of dimension (see output)
9*n+n*(n+1)/2+n*n+max(7*n-n*(n+1)/2,0)
nfu: maximum number of function evaluations. If equal to
zero, the default value of 5000*n is used.
idiff: Choose forward or central differences. Forward
differences require fewer function evaluations and
should be favored unless the problem is exceedingly
difficult.
idiff = 1 forward differences
idiff = 2 central differences
kmax: The parameter kmax is such that the Hessian is
recomputed every kmax iterations.
We recommend kmax = 3 unless the problem is
very difficult. In this case choose kmax = 1 or 2.
Output Arguments:
x0: best obtained point.
fopt: value of the function at the point x0.
nfu: number of function evaluations.
nit: number of iterations.
wa: this vector contains gradient(x0) in the unconstrained
case, and the projected gradient(x0) for constrained
problems.
ier: 0 convergence has been achieved.
1 maximum number of function evaluations exceeded.
2 failure to converge.
3 wrong input in a constrained problem. In such a case
the components of vectors bl and bu set to 1.d30
were ill defined on input.
The Fortran main program that calls curvif appears below. The subroutine fcn evaluates the objective function and grad evaluates the gradient for the example problem. Subroutine prntout is called to write output to the text file "doc_ex2.txt".
Program Doc_ex2
implicit none
double precision x0(25), bl(25), bu(25), wa(2575)
integer ibound, jbound(25)
double precision fopt, eps
integer n, nfu, nit, ier, ngr, nhes
external fcn, grad
! set initial guess
x0(1)= 1.
x0(2)= 1.
x0(3)= 1.
! number of variables is 3 (n = 3)
! stopping criterion is 1.0d-4 (eps = 1.0d-4)
! maximum number of function evaluations is 15000 (nfu = 0)
n = 3
eps = 1.d-4
nfu = 0
! no bounds on variables
ibound = 0
! Print initial values.
call prntout (fcn, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nhes, nit, ier, 0, 'doc_ex2.txt')
! Call curvig
call curvig (fcn, grad, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nit, ier)
! Print final results
call prntout (fcn, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nhes, nit, ier, 1, 'doc_ex2.txt')
end
subroutine fcn(n, x, f)
implicit none
integer n
double precision x(n), f
f = x(1)**4 + (x(2)-1.0)**2 + (x(3)+1.0)**2 + x(1)*x(2)*x(3)
return
end
subroutine grad(n, x, g)
implicit none
integer n
double precision x(*), g(*)
g(1) = 4.*x(1)**3 + x(2)*x(3)
g(2) = 2*(x(2) -1.) + x(1)*x(3)
g(3) = 2*(x(3) +1.) + x(1)*x(2)
return
end
subroutine curvig (fu, gradie, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nit, ier)
external fu, gradie
integer n, nfu, ngr, nit, ier
integer ibound, jbound(*)
double precision x0(n), fopt, eps, bl(*), bu(*), wa(*)
Input Arguments:
fu: user supplied subroutine which computes the function
to be minimized.
Usage: call fu(n,x,f)
n: dimension of x.
x: n-dimensional vector.
f: value of the function at the point x.
gradie: user supplied subroutine which computes the gradient of
the function to be minimized.
Usage: call gradie(n,x,g)
g: the gradient at the point x.
n: dimension of the problem.
x0: initial guess point.
eps: tolerance for the stopping criterion.
ibound: parameter such that if equal to
0 is an unconstrained problem
1 is a constrained problem.
jbound: working vector of dimension n defining the sort of
constraint for each variable (only used when ibound.ne.0).
jbound(i) = 0 if the ith variable has no constraints.
1 if the ith variable has only upper bounds.
2 if the ith variable has only lower bounds.
3 if the ith variable has both upper and
lower bounds.
bl: vector of lower bounds (not used if ibound=0).
bu: vector of upper bounds (not used if ibound=0).
For keeping constant the ith variable set:
jbound(i) = 3
bl(i) = bu(i) = constant
wa: working vector of dimension (see output)
9*n+n*(n+1)/2+n*n+max(9*n-n*(n+1)/2,0)
nfu: maximum number of function evaluations. If equal to
zero, the default value of 1000*n is used.
Output Arguments:
x0: best obtained point.
fopt: value of the function at the point x0.
nfu: number of function evaluations.
ngr: number of gradient evaluations.
nit: number of iterations.
wa: this vector contains gradient(x0) in the unconstrained
case, and the projected gradient(x0) for constrained
problems.
ier: 0 convergence has been achieved.
1 maximum number of function evaluations exceeded.
2 failure to converge.
3 wrong input in a constrained problem.
This section describes a typical application of curvih. The only real difference between this example and the Curvig Example is that the Hessian is explicitly computed by subroutine hess. It is important to note that the Hessian is to be supplied in packed symmetric form as the columns of the upper triangle of the mathematical Hessian.
Program Doc_ex3
implicit none
double precision x0(25), bl(25), bu(25), wa(2575)
integer ibound, jbound(25)
double precision fopt, eps
integer n, nfu, nit, ier, ngr, nhes, itrid
external fcn, grad, hess
! set initial guess
x0(1)= 1.
x0(2)= 1.
x0(3)= 1.
! number of variables is 3 (n = 3)
! stopping criterion is 1.0d-4 (eps = 1.0d-4)
! maximum number of function evaluations is 15000 (nfu = 0)
n = 3
eps = 1.d-4
nfu = 0
! Hessian is not tridiagonal
itrid = 0
! no bounds on variables
ibound = 0
! Print initial values.
call prntout (fcn, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nhes, nit, ier, 0, 'doc_ex3.txt')
! Call curvih
call curvih (fcn, grad, hess, itrid, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nhes, nit, ier)
! Print final results
call prntout (fcn, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nhes, nit, ier, 1, 'doc_ex3.txt')
end
subroutine fcn(n, x, f)
implicit none
integer n
double precision x(n), f
f = x(1)**4 + (x(2)-1.0)**2 + (x(3)+1.0)**2 + x(1)*x(2)*x(3)
return
end
subroutine grad(n, x, g)
implicit none
integer n
double precision x(*), g(*)
g(1) = 4.*x(1)**3 + x(2)*x(3)
g(2) = 2*(x(2) -1.) + x(1)*x(3)
g(3) = 2*(x(3) +1.) + x(1)*x(2)
return
end
subroutine hess(n, x, h)
implicit none
integer n
double precision x(*), h(*)
h(1) = 12.*x(1)**2
h(2) = x(3)
h(3) = 2.
h(4) = x(2)
h(5) = x(1)
h(6) = 2.
return
end
subroutine curvih (fu,gradie, hessia, itrid, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nhes, nit, ier)
external fu, gradie, hessia
integer itrid, n, nfu, ngr, nhes, nit, ier
integer ibound, jbound(*)
double precision x0(n), fopt, eps, bl(*), bu(*), wa(*)
Input Arguments:
fu: user supplied subroutine which computes the function
to be minimized.
Usage: call fu(n,x,f)
n: dimension of x.
x: n-dimensional vector.
f: value of the function at the point x.
gradie: user supplied subroutine which computes the gradient of
the function to be minimized.
Usage: call gradie(n,x,g)
g: the gradient at the point x.
hessia: user supplied subroutine which computes the Hessian of
the function to be minimized.
Usage: call hessia(n,x,h)
h: vector of dimension n*(n+1)/2 containing the upper
half of the Hessian stored columnwise.
itrid: set this parameter to 1 if the Hessian is tridiagonal.
n: dimension of the problem.
x0: initial guess point.
eps: tolerance for the stopping criterion.
ibound: parameter such that if equal to
0 is an unconstrained problem
1 is a constrained problem.
jbound: working vector of dimension n defining the sort of
constraint for each variable (only used when ibound.ne.0).
jbound(i) = 0 if the ith variable has no constraints.
1 if the ith variable has only upper bounds.
2 if the ith variable has only lower bounds.
3 if the ith variable has both upper and
lower bounds.
bl: vector of lower bounds (not used if ibound=0).
bu: vector of upper bounds (not used if ibound=0).
For keeping constant the ith variable set:
jbound(i) = 3
bl(i) = bu(i) = constant
wa: working vector of dimension (see output)
9*n+n*(n+1)/2+n*n+max(9*n-n*(n+1)/2,0)
nfu: maximum number of function evaluations. If equal to
zero, the default value of 1000*n is used.
Output Arguments:
x0: best obtained point.
fopt: value of the function at the point x0.
nfu: number of function evaluations.
ngr: number of gradient evaluations.
nhes: number of Hessian evaluations.
wa: this vector contains gradient(x0) in the unconstrained
case, and the projected gradient(x0) for constrained
problems.
nit: number of iterations.
ier: 0 convergence has been achieved.
1 maximum number of function evaluations exceeded.
2 failure to converge.
3 wrong input in a constrained problem. In such a case
the components of vectors bl and bu set to 1.d30
were ill defined on input.
subroutine prntout (fu, n, x0, fopt, eps,
& ibound, jbound, bl, bu, wa,
& nfu, ngr, nhess, nit, ier, ichoice, flname)
external fu
integer n, nfu, ngr, nhess, nit, ier, ichoice
integer ibound, jbound(*)
double precision x0(n), fopt, eps, bl(*), bu(*), wa(*)
character flname*(*)
Input Arguments:
All input arguments are described in curvif in more detail, except for
ichoice and flname.
fu : external function just as specified in curvif
n : dimension of the problem
x0 : initial value into curvif if ichoice = 0
or best obtained point if ichoice = 1
fopt : best value found by curvif
eps : requested tolerance
ibound : 0/1 variable determining if bounds are active
jbound : specific information on individual bounds
bl : Lower bounds
bu : Upper bounds
wa : Work vector returned from and passed into curvif
nfu : Number of function values
ngr : Number of gradient values (set to 0 if ichoice = 0)
nh : Number of Hessian values (set to 0 if ichoice = 0)
nit : Number of iterations (set to 0 if ichoice = 0)
ier : error criteria
0 convergence has been achieved.
1 maximum number of function evaluations exceeded.
2 failure to converge.
3 wrong input in a constrained problem.
ichoice : ichoice is 0 or 1. Choose 0 if it is to be invoked before
a call to the routine and 1 if after a call.
flname : The output file name
This section documents the C interface for curvifc, curvigc, curvihc, and prntoutc. An example problem and C programs are used to illustrate the essential steps necessary to use these procedures.
Two header files are provided as part of the C interface. These are files curvi.h and whichwin.h. The header file curvi.h should be included in any C source code file that references CURVI. The header file whichwin.h provides portability across Win32, Win16, and Unix systems. Macros such as TYPE_export used in CURVI are defined in this header file.
The example problem has 3 variables {X1, X2, X3}, with no bounds, and a polynomial objective function.
Minimize: f (X) = pow(x[0],4) + pow((x[1]-1e0),2)
+ pow((x[2]+1e0),2) + x[0]*x[1]*x[2];
This problem uses X = {1, 1, 1} as the starting point to begin the optimization process. The global minimum occurs at X = {1, 2, -2}.
The C main program that calls curvifc appears below. The procedure fcn evaluates the objective function for the example problem. Procedure prntoutc is called to write output to the text file "curv_ex1.txt".
/* Curvifc document example 1 */
#include <math.h>
#include "curvi.h"
#define NMAX 25 /* max number of variables */
#define NWORK 2575 /* size of work array, wa */
TYPE_stdcall(void) fcn (
long int *nvars,
double x[],
double *f);
double x0[NMAX], bl[NMAX], bu[NMAX], wa[NWORK];
long int ibound, jbound[NMAX];
double fopt, eps;
long int n, nfu, nit, idiff, ier, kmax, ngr, nhes, ichoice;
void main () {
/* set initial guess */
x0[0] = 1e0;
x0[1] = 1e0;
x0[2] = 1e0;
/*
number of variables is 3 (n = 3)
stopping criterion is 1.0d-4 (eps = 1.0d-4)
maximum number of function evaluations is 15000 (nfu = 0)
*/
n = 3;
eps = 1e-4;
nfu = 0;
/* recomputed Hessian every 3 iterations (kmax = 3) */
kmax = 3;
/* use forward differences (idiff = 1) */
idiff = 1;
/* This next statement means that the problem
has no bounds */
ibound = 0;
/* use fcn to compute function values */
curviFCN(fcn);
/* print initial values */
ichoice = 0;
prntoutc (n, x0, &fopt, eps, ibound, jbound, bl, bu, wa,
&nfu, &ngr, &nhes, &nit, &ier, ichoice, "curv_ex1.txt");
/* call curvifc */
curvifc (n, x0, &fopt, eps, ibound, jbound, bl, bu, wa,
&nfu, &nit, idiff, &ier, kmax);
/* Print final results */
ichoice = 1;
prntoutc (n, x0, &fopt, eps, ibound, jbound, bl, bu, wa,
&nfu, &ngr, &nhes, &nit, &ier, ichoice, "curv_ex1.txt");
} /* end curv_ex1 */
TYPE_stdcall(void) fcn (long int *n, double x[], double *f) {
*f = pow(x[0],4) + pow((x[1]-1e0),2) + pow((x[2]+1e0),2) + x[0]*x[1]*x[2];
} /* end fcn */
TYPE_import(void) curvifc (
long int nvars,
double x0[],
double *fopt,
double eps,
long int ibound,
long int jbound[],
double bl[],
double bu[],
double wa[],
long int *nfu,
long int *nit,
long int idiff,
long int *ier,
long int kmax);
TYPE_import(void) curviFCN (
void (STDCALL *FCN) (
long int *nvars,
double x[],
double *f));
Arguments are described in the Curvif Arguments section. curviFCN is called before calling curvifc to pass the objective function to CURVI.
The C main program that calls curvigc=CURVIG appears below. The procedure fcn evaluates the objective function and grad evaluates the gradient for the example problem. Procedure prntoutc is called to write output to the text file "curv_ex2.txt".
/* Curvi document example 2 */
#include <math.h>
#include "curvi.h"
#define NMAX 25 /* max number of variables */
#define NWORK 2575 /* size of work array, wa */
TYPE_stdcall(void) fcn (
long int *nvars,
double x[],
double *f );
TYPE_stdcall(void) grad (
long int *n,
double x[],
double g[] );
double x0[NMAX], bl[NMAX], bu[NMAX], wa[NWORK];
long int ibound, jbound[NMAX];
double fopt, eps;
long int n, nfu, nit, idiff, ier, kmax, ngr, nhes;
void main () {
/* Curvif document example problem */
/* set initial guess */
x0[0] = 1e0;
x0[1] = 1e0;
x0[2] = 1e0;
/*
the next few statements set the problem size
to be 3 variables (n = 3)
with the stopping criterion at 1.d-4
(eps = 1.d-4)
the number of function evaluations must not
exceed 15000 (default nfu = 0)
the Hessian will be updated every third
iteration (kmax = 3)
the algorithm will use forward differences
(idiff = 1)
*/
n = 3;
eps = 1.e-4;
nfu = 0;
kmax = 3;
idiff = 1;
/* This next statement means that the problem
has no bounds */
ibound = 0;
/* use fcn to compute function values */
curviFCN(fcn);
/* Call prntout with ichoice = 0 to print out
initial values going into curvif. */
prntoutc (n, x0, &fopt, eps, ibound, jbound, bl, bu, wa,
&nfu, &ngr, &nhes, &nit, &ier, 0, "curv_ex2.txt");
/* Call curvig */
CURVIG (fcn, grad, &n, x0, &fopt, &eps, &ibound, jbound, bl, bu, wa,
&nfu, &ngr, &nit, &ier);
/* Print final results using ichoice = 1. */
prntoutc (n, x0, &fopt, eps, ibound, jbound, bl, bu, wa,
&nfu, &ngr, &nhes, &nit, &ier, 1, "curv_ex2.txt");
} /* end curv_ex2 */
TYPE_stdcall(void) fcn ( long int *n, double x[], double *f ) {
*f = pow(x[0],4) + pow((x[1]-1.),2) + pow((x[2]+1.),2) + x[0]*x[1]*x[2];
} /* end fcn */
TYPE_stdcall(void) grad ( long int *n, double x[], double g[] ) {
g[0] = 4e0*pow(x[0], 3) + x[1]*x[2];
g[1] = 2e0*(x[1] - 1e0) + x[0]*x[2];
g[2] = 2e0*(x[2] + 1e0) + x[0]*x[1];
} /* end grad */
There is no specific C interface for curvigc. Instead, a C program can call curvig directly as shown in the Curvigc Example.
This section describes a typical application of curvihc=CURVIH. The only real difference between this example and the Curvigc Example is that the Hessian is explicitly computed by procedure hess. It is important to note that the Hessian is to be supplied in packed symmetric form as the columns of the upper triangle of the mathematical Hessian.
/* Curvi document example 3 */
#include <math.h>
#include "curvi.h"
#define NMAX 25 /* max number of variables */
#define NWORK 2575 /* size of work array, wa */
TYPE_stdcall(void) fcn (
long int *n,
double x[],
double *f);
TYPE_stdcall(void) grad (
long int *n,
double x[],
double g[]);
TYPE_stdcall(void) hess (
long int *n,
double x[],
double h[]);
double x0[NMAX], bl[NMAX], bu[NMAX], wa[NWORK];
long int ibound, jbound[NMAX];
double fopt, eps;
long int n, nfu, nit, idiff, ier, kmax, ngr, nhes, itrid;
void main () {
/* Curvif document example problem */
/* set initial guess */
x0[0] = 1e0;
x0[1] = 1e0;
x0[2] = 1e0;
/*
the next few statements set the problem size
to be 3 variables (n = 3)
with the stopping criterion at 1.d-4
(eps = 1.d-4)
the number of function evaluations must not
exceed 15000 (default nfu = 0)
the Hessian will be updated every third
iteration (kmax = 3)
the algorithm will use forward differences
(idiff = 1)
*/
n = 3;
eps = 1.e-4;
nfu = 0;
kmax = 3;
idiff = 1;
itrid = 0;
/* This next statement means that the problem
has no bounds */
ibound = 0;
/* use fcn to compute function values */
curviFCN(fcn);
/* Call prntout with ichoice = 0 to print out
initial values going into curvif. */
prntoutc (n, x0, &fopt, eps, ibound, jbound, bl, bu, wa,
&nfu, &ngr, &nhes, &nit, &ier, 0, "curv_ex3.txt");
/* Call curvih */
CURVIH (fcn, grad, hess, &itrid, &n, x0, &fopt, &eps,
&ibound, jbound, bl, bu, wa,
&nfu, &ngr, &nhes, &nit, &ier);
/* Print final results using ichoice = 1. */
prntoutc (n, x0, &fopt, eps, ibound, jbound, bl, bu, wa,
&nfu, &ngr, &nhes, &nit, &ier, 1, "curv_ex3.txt");
} /* end curv_ex3 */
TYPE_stdcall(void) fcn (long int *n, double x[], double *f) {
*f = pow(x[0],4) + pow((x[1]-1.),2) + pow((x[2]+1.),2) + x[0]*x[1]*x[2];
} /* end fcn */
TYPE_stdcall(void) grad (long int *n, double x[], double g[]) {
g[0] = 4e0*pow(x[0], 3) + x[1]*x[2];
g[1] = 2e0*(x[1] - 1e0) + x[0]*x[2];
g[2] = 2e0*(x[2] + 1e0) + x[0]*x[1];
} /* end grad */
TYPE_stdcall(void) hess (long int *n, double x[], double h[]) {
h[0] = 12e0*x[0]*x[0];
h[1] = x[2];
h[2] = 2e0;
h[3] = x[1];
h[4] = x[0];
h[5] = 2e0;
} /* end hess */
There is no specific C interface for curvihc. Instead, a C program can call curvih directly as shown in the Curvihc Example.
TYPE_import(void) prntoutc (
long int nvars,
double x0[],
double *fopt,
double eps,
long int ibound,
long int jbound[],
double bl[],
double bu[],
double wa[],
long int *nfu,
long int *ngr,
long int *nhes,
long int *nit,
long int *ier,
long int ichoice,
char *report);
Arguments are described in the Prntout Arguments section. curviFCN is called before calling prntoutc to pass the objective function to CURVI.
1. Dennis, J. E., N. Echebest, M. T. Guardarucci, J. M. Martinez, H. D. Scolnik, and C. Vacchino, A curvilinear search using tridiagonal secant updates for unconstrained optimization, SIAM J. on Optimization, Vol. 1, Number 3, August 1991, page 351.
2. Luenbuerger, David G., Linear and Nonlinear Programming, Second Edition, Addison-Wesley, Reading Massachusetts, 1984.
Windward Technologies, Inc.
12039 Mulholland
Meadows Place, TX 77477
Phone: 281-564-6523
Fax: 281-754-4022
E-mail: wti@aol.com
Web site: http://web.wt.net/~wti
Bytech Argentina
La Pampa 2779 - Piso 3
(1428) Buenos Aires
Argentina
Phone: (541) 774-6148
Fax: (541) 781-7513
E-mail: hugo@nobi.uba.ar
Windward Technologies, Inc. and Bytech Argentina make no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Neither Windward Technologies nor Bytech shall be liable for errors contained herein or for incidental, consequential, or other indirect damages in connection with the furnishing, performance, or use of this material.
Copyright ã 1995-1998 by Windward Technologies, Inc. and Bytech Argentina
All rights reserved. No part of this document may be photocopied or reproduced without the prior written consent of Windward Technologies, Inc.
Microsoft and MS are trademarks of Microsoft Corporation
Revised: June 23, 1998
Use, duplication, or disclosure by the US Government is subject to restrictions as set forth in FAR 52.227-19, subparagraph (c)(i)(ii) of DOD FAR SUPP 252.227-7013, or equivalent government clause for other agencies.
Restricted Rights Notice: The version of the WTI product described in this document is sold under a per user license agreement. Its use, duplication, and disclosure are subject to the restrictions in the license agreement.