NAG CL Interface
e04kfc (handle_solve_bounds_foas)
Note: this function uses optional parameters to define choices in the problem specification and in the details of the algorithm. If you wish to use default
settings for all of the optional parameters, you need only read Sections 1 to 10 of this document. If, however, you wish to reset some or all of the settings please refer to Section 11 for a detailed description of the algorithm and to Section 12 for a detailed description of the specification of the optional parameters.
1
Purpose
e04kfc is a solver from the NAG optimization modelling suite for bound-constrained large-scale nonlinear programming (NLP) problems. It is a first-order active-set method (FOAS) that has low memory requirements and thus is suitable for very large-scale problems.
2
Specification
The function may be called by the names: e04kfc or nag_opt_handle_solve_bounds_foas.
3
Description
e04kfc solves large-scale bound-constrained nonlinear optimization problems of the form
where
is the number of decision variables,
,
, and
are
-dimensional vectors, and the nonlinear objective function
is assumed to be sufficiently smooth.
The solver is a first-order method (i.e., uses only first derivatives) that has very low memory requirements and therefore is suitable for very large bound-constrained problems. It is based on an active-set method coupled to a nonmonotone projected gradient algorithm (NPG), nonlinear conjugate gradient method (CG) and its limited-memory variant (LCG). The active-set method is based on alternating between both solvers, the NPG step handles the box constraints and identifies a suitable search space while the CG step explores it for a solution.
For a detailed description of the algorithm see
Section 11. Under standard assumptions on the problem (smoothness of the first derivative of the objective) the algorithm converges to a local solution or to a critical point.
e04kfc serves as a solver for problems stored as a handle. The handle points to an internal data structure which defines the problem and serves as a means of communication for functions in the NAG optimization modelling suite. First, the problem handle is initialized by calling
e04rac. Then some of the functions
e04rec,
e04rfc,
e04rgc or
e04rhc may be called to formulate the objective and to define (simple) box constraints for the problem. Once the problem is fully described, the handle may be passed to the solver
e04kfc. When the handle is no longer needed,
e04rzc should be called to destroy it and deallocate the memory held within. See
Section 4.1 in the
E04 Chapter Introduction for more details about the NAG optimization modelling suite.
The algorithm behaviour can be modified by various optional parameters (see
Section 12) which can be set by
e04zmc and
e04zpc anytime between the initialization of the handle by
e04rac and a call to the solver. Once the solver has finished, options may be modified for the next solve. The solver may be called repeatedly with various starting points and/or optional parameters. Option getter
e04znc can be called to retrieve the current value of any option.
The optional parameter may be used to switch the problem to maximization, while can be used to complete missing elements from the gradient. Optional parameter may help verify the correctness of the gradient vector before starting to solve a problem.
Several options may have significant impact on the performance of the solver. Even if the defaults were chosen to suit the majority of problems, it is recommended that you experiment in order to find the most suitable set of options for a particular problem, see
Sections 11 and
12 for further details.
4
References
Dai Y-H and Kou C-X (2013) A Nonlinear Conjugate Gradient Algorithm with an Optimal Property and an Improved Wolfe Line Search SIAM J. Optim. 23(1) 296–320
Gill P E and Leonard M W (2003) Limited-Memory Reduced-Hessian Methods for Large-Scale Unconstrained Optimization SIAM J. Optim. 14(2) 380–401
Hager W W and Zhang H (2005) A New Conjugate Gradient Method with Guaranteed Descent and an Efficient Line Search SIAM J. Optim. 16(1) 170–192
Hager W W and Zhang H (2006a) Algorithm 851: CG DESCENT, a Conjugate Gradient Method with Guaranteed Descent ACM Trans. Math. Software 32(1) 113–137
Hager W W and Zhang H (2006b) A New Active Set Algorithm for Box Constrained Optimization SIAM J. Optim. 17(2) 525–557
Hager W W and Zhang H (2013) The Limited Memory Conjugate Gradient Method SIAM J. Optim. 23(4) 2150–2168
Nocedal J and Wright S J (2006) Numerical Optimization (2nd Edition) Springer Series in Operations Research, Springer, New York
5
Arguments
-
1:
– void *
Input
-
On entry: the handle to the problem. It needs to be initialized by
e04rac and the problem formulated by some of the functions
e04rec,
e04rfc,
e04rgc and
e04rhc. It
must not be changed between calls to the NAG optimization modelling suite.
-
2:
– function, supplied by the user
External Function
-
objfun must calculate the value of the nonlinear objective function
at a specified point
. If there is no nonlinear objective (e.g.,
e04rec or
e04rfc was called to define a linear or quadratic objective function),
objfun will never be called by
e04kfc and may be
NULLFN.
The specification of
objfun is:
void |
objfun (Integer nvar,
const double x[],
double *fx,
Integer *inform,
Nag_Comm *comm)
|
|
-
1:
– Integer
Input
-
On entry: , the number of variables in the problem.
-
2:
– const double
Input
-
On entry: the vector of variable values at which the objective function is to be evaluated.
-
3:
– double *
Output
-
On exit: the value of the objective function at .
-
4:
– Integer *
Input/Output
-
On entry: a non-negative value.
In some cases, it is known beforehand that the evaluations of the objective function and its gradient are required at the same point , in such cases, . This may help to optimize your code in order to avoid recalculations of common quantities when evaluating both the objective function and gradient; the objective function is always evaluated before the objective gradient. This notification parameter may be safely ignored if such optimization is not required.
On exit: may be used to indicate that the function cannot be evaluated at the requested point
by setting
. Returning NaN or
in
fx has the same effect. The algorithm will try to recover if the objective cannot be evaluated; if recovery is not possible it will stop with
NE_USER_NAN.
-
5:
– Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to
objfun.
- user – double *
- iuser – Integer *
- p – Pointer
The type Pointer will be
void *. Before calling
e04kfc you may allocate memory and initialize these pointers with various quantities for use by
objfun when called from
e04kfc (see
Section 3.1.1 in the Introduction to the NAG Library CL Interface).
-
3:
– function, supplied by the user
External Function
-
objgrd must calculate the values of the nonlinear objective function gradient
at a specified point
. Every call to
objgrd is preceded by a call to
objfun at the same point, if this is known in advance, both functions will be notified via
. If there is no nonlinear objective (e.g.,
e04rec or
e04rfc was called to define a linear or quadratic objective function),
objgrd will never be called by
e04kfc
and may be
NULLFN.
If the optional parameter
, then after returning from
objgrd the gradient vector is checked for missing entries which you have not supplied. Missing entries are estimated using the finite difference method, see optional parameter
description for more details.
The specification of
objgrd is:
-
1:
– Integer
Input
-
On entry: , the number of variables in the problem.
-
2:
– const double
Input
-
On entry: the vector of variable values at which the objective function gradient is to be evaluated.
-
3:
– Integer
Input
-
On entry: the number of nonzero elements in the sparse gradient vector of the objective function, as was set in a previous call to
e04rgc.
-
4:
– double
Input/Output
-
On entry: the elements should only be assigned and not referenced.
On exit: the values of the nonzero elements in the sparse gradient vector of the objective function, in the order specified by
idxfd in a previous call to
e04rgc.
will store the gradient element
.
-
5:
– Integer *
Input/Output
-
On entry: a non-negative value.
If
, then the previous call to
objfun was also made at the same point
with
. This may help to optimize your code in order to avoid recalculations of common quantities when evaluating both the objective function and gradient. This notification parameter may be safely ignored if such optimization is not required.
On exit: may be used to inform that the gradient cannot be evaluated at the requested point
by setting
. Returning NaN or
in any element of
fdx has the same effect. The algorithm will try to recover if the gradient cannot be evaluated; if recovery is not possible it will stop with
NE_USER_NAN.
-
6:
– Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to
objgrd.
- user – double *
- iuser – Integer *
- p – Pointer
The type Pointer will be
void *. Before calling
e04kfc you may allocate memory and initialize these pointers with various quantities for use by
objgrd when called from
e04kfc (see
Section 3.1.1 in the Introduction to the NAG Library CL Interface).
-
4:
– function, supplied by the user
External Function
-
monit is provided to enable you to monitor the progress of the optimization and optionally to terminate the solver early if necessary. It is invoked at the end of every
th iteration where
is given by the
(the default is
,
monit is not called).
monit
may be specified as
NULLFN.
The specification of
monit is:
-
1:
– Integer
Input
-
On entry: , the number of variables in the problem.
-
2:
– const double
Input
-
On entry: the vector of decision variables at the current iteration.
-
3:
– Integer *
Input/Output
-
On entry: a non-negative value.
On exit: may be used to request the solver to stop immediately. Specifically, if
the solver will terminate immediately with
NE_USER_STOP otherwise, the solver will proceed normally.
-
4:
– const double
Input
-
On entry: error measures and various indicators at the end of the current iteration as described in
rinfo.
-
5:
– const double
Input
-
On entry: solver statistics at the end of the current iteration as described in
stats.
-
6:
– Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to
monit.
- user – double *
- iuser – Integer *
- p – Pointer
The type Pointer will be
void *. Before calling
e04kfc you may allocate memory and initialize these pointers with various quantities for use by
monit when called from
e04kfc (see
Section 3.1.1 in the Introduction to the NAG Library CL Interface).
-
5:
– Integer
Input
-
On entry: , the number of variables in the problem.
-
6:
– double
Input/Output
-
On entry: , the initial estimates of the variables .
On exit: the final values of the variables .
-
7:
– double
Output
-
On exit: error measures and various indicators at the end of the final iteration as given in the table below:
|
Objective function value . |
|
Norm of inactive gradient, the objective gradient over the current search space. If the problem is unconstrained, then elements – coincide. See Section 11.4 for details. |
|
Norm of projected direction, used in (3), see Section 11.2. |
|
Norm of objective gradient. |
|
Last step size () used in (2) and (5), see Section 11.2 and Section 11.3. |
|
Progress score, a positive value that measures the progress of the solver. A low score close to zero indicates poor progress, see (8) in Section 11.4. |
– |
Reserved for future use. |
-
8:
– double
Output
-
On exit: solver statistics at the end of the final iteration as given in the table below:
|
Number of function evaluations performed by NPG, see Section 11.2. |
|
Number of gradient evaluations performed by NPG. |
|
Number of function evaluations performed by CG, see Section 11.3. |
|
Number of gradient evaluations performed by CG. |
|
Number of function evaluations performed by LCG. |
|
Number of gradient evaluations performed by LCG. |
|
Number of function evaluations used by the finite difference method to estimate missing components of the gradient. |
|
Number of iterations. |
|
Total time spent in the solver (including user-supplied function calls). |
|
Total time spent in user-supplied objective function. |
|
Total time spent in user-supplied objective gradient. |
– |
Reserved for future use. |
-
9:
– Nag_Comm *
-
The NAG communication argument (see
Section 3.1.1 in the Introduction to the NAG Library CL Interface).
-
10:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
e04kfc returns with
NE_NOERROR
if the iterates have converged to a point
that satisfies the convergence criteria described in
Section 11.4.
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_DERIV_ERRORS
-
User-provided gradient is likely to be incorrect.
This error indicates that the user-supplied gradient vector
fdx has entries that do not match with a finite-differences approximation of it.
- NE_FAILED_START
-
The current starting point is unusable.
Either
inform was set to a negative value within the user-supplied functions
objfun,
objgrd, or an Infinity or NaN was detected in values returned from them.
- NE_HANDLE
-
The supplied
handle does not define a valid handle to the data structure for the NAG optimization modelling suite. It has not been initialized by
e04rac or it has been corrupted.
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
- NE_MAYBE_UNBOUNDED
-
The problem seems to be unbounded and the algorithm was stopped.
This indicates that the solver found a direction where the objective function decreases arbitrarily. In the case of maximizing, the direction found increases arbitrarily the objective value. Cases where this happens are when a linear objective is provided with no constraints, or when the constraints defined do not bound the search direction.
- NE_NO_IMPROVEMENT
-
The solver was terminated because no further progress could be achieved.
This can indicate that the solver is calculating very small step sizes and is making very little progress. It could also indicate that the problem has been solved to the best numerical accuracy possible given the current scaling.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library CL Interface for further information.
- NE_NULL_ARGUMENT
-
The problem requires the
objfun values.
Please provide a proper
objfun function.
The problem requires the
objgrd derivatives.
Please provide a proper
objgrd function.
- NE_PHASE
-
The problem is already being solved.
- NE_REF_MATCH
-
The information supplied does not match the value previously stored.
On entry,
must match the value given during initialization of the
handle, i.e.,
.
- NE_SETUP_ERROR
-
This solver does not support the model defined in the handle.
- NE_TIME_LIMIT
-
The solver terminated after the maximum time allowed was exhausted.
Maximum number of seconds exceeded. Use optional parameter to change the limit.
- NE_TOO_MANY_ITER
-
Maximum number of iterations reached.
- NE_USER_NAN
-
Invalid number detected in user-supplied function and recovery failed.
Either
inform was set to a negative value within the user-supplied function
objfun, or an Infinity or NaN was detected in values returned from them. Recovery attempts failed.
Invalid number detected in user-supplied gradient and recovery failed.
Either
inform was set to a negative value within the user-supplied function
objgrd, or an Infinity or NaN was detected in values returned from them. Recovery attempts failed.
- NE_USER_STOP
-
User requested termination during a monitoring step.
inform was set to a negative value in
monit.
- NW_NOT_CONVERGED
-
Problem was solved to an acceptable level; full accuracy was not achieved.
This indicates that the algorithm detected a sequence of very small reductions in the objective function value and is unable to reach a point satisfying the requested optimality tolerance. This may happen if the desired tolerances are too small for the current problem, or if the objective function is badly scaled.
7
Accuracy
The accuracy of the solution is determined by optional parameters
and
. If
NE_NOERROR on exit, the returned point satisfies
(6) or
(7) to the defined accuracy.
Please refer to
Section 11.4 and the description of the particular options in
Section 12.
8
Parallelism and Performance
e04kfc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
e04kfc makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
The solver can print information to give an overview of the problem and of the progress of the computation. The output may be sent to two independent streams (files) which are set by optional parameters and . Optional parameters , , and determine the exposed level of detail. This allows, for example, a detailed log file to be generated while the condensed information is displayed on the screen.
By default (
,
), the following sections are printed to the standard output:
- Header
- Optional parameters list (if )
- Problem statistics
- Verification of derivatives (if )
- Iteration log
- Summary
- Solution (if )
Header
The header is a message indicating the start of the solver. It should look like:
-------------------------------------------------------------------------------
E04KF, First-order method for bound-constrained problems
-------------------------------------------------------------------------------
Optional parameters list
The list shows all options of the solver, each displayed on one line. The output contains the option name, its current value and an indicator for how it was set. The options unchanged from the default setting are noted by ‘d’, options you set are noted by ‘U’, and options reset by the solver are noted by ‘S’. Note that the output format is compatible with the file format expected by
e04zpc. The output might look as follows:
Begin of Options
Print File = 6 * d
Print Level = 2 * U
Print Options = Yes * d
Print Solution = All * U
Monitoring File = 9 * U
Monitoring Level = 3 * U
Foas Monitor Frequency = 0 * d
Foas Print Frequency = 5 * U
End of Options
Problem statistics
If
, statistics on the problem is printed, for example:
Problem Statistics
Number of variables 63
Number of free Variables 0
Number of fixed Variables 12
Number of vars with only lower bound 40
Number of vars with only upper bound 0
Number of vars with bounds 11
Objective type Nonlinear
Verification of derivatives
If
, then the user-supplied nonlinear objective gradient is verified. If
, then it will only print entries where the gradient entry substantially differs from a finite-difference approximation, it might look as follows:
Derivative checker
idx test fdx approx rel error
1 Fail -1.71E+02 -1.74E+02 1.56E-02
On the other hand, if
, it will print one line for each gradient entry and the output should be similar to:
Derivative checker
idx test fdx approx rel error
1 Fail 9.84E-01 9.86E-01 2.72E-03
2 Ok 1.30E+00 1.30E+00 4.13E-08
3 Skip missing -- --
4 Skip missing -- --
5 Ok 4.82E-01 4.82E-01 6.23E-08
Iteration log
If , the solver prints the status of every th iteration, specified using the optional parameter , with default value of . It will also print status information regarding the switch between NPG, CG and LCG.
It will also print status information regarding the switch between NPG, CG and LCG.
If
, the output shows the iteration number (
represents the starting point), the current objective value, and optimality measures (norm of inactive gradient and the norm of the projected direction). Note that all these values for the last iteration are also available in
rinfo. The output might look as follows:
-------------------------------------------------------------------------------
iters | objective | optim | dir
-------------------------------------------------------------------------------
20 7.71339E-01 1.22E-01 1.70E+00
25 7.06709E-01 1.75E+00 1.54E+00
30 7.06709E-01 1.75E+00 1.54E+00
35 6.82989E-01 1.35E+00 1.35E+00
30 6.55834E-01 3.26E+00 1.67E+00
If
, the solver also prints for each iteration the progress score, iteration type, size or type of performed step, accumulated number of objective function and gradient calls. The output takes the following form:
-------------------------------------------------------------------------------
iters | objective | optim | dir | progrss | it| step | nf| ng
-------------------------------------------------------------------------------
0 1.10354E+02 0.00E+00 6.81E+01 1.00E+00 Start 1 1
1 3.29016E+01 1.45E+01 1.45E+01 5.36E+00 NPG 1.39E-02 8 2
2 3.29016E+01 1.45E+01 1.45E+01 5.36E+00 Switch CG 8 2
3 1.84090E+01 2.48E+01 2.48E+01 2.85E+00 CG 2.42E-02 11 4
4 1.84090E+01 2.48E+01 2.48E+01 2.85E+00 Restart 11 4
5 9.48087E+00 1.25E+01 1.25E+01 1.45E+00 CG 1.49E-02 13 5
6 4.20527E+00 8.28E+00 8.22E-01 2.51E+00 CG 3.61E-02 15 6
7 7.20453E-01 3.08E+00 1.62E+00 9.70E+00 LCG 7.21E-01 17 7
If
, each iteration produces more information that expands over several lines. This additional information can contain:
- The sizes of gradient in full space and subspace;
- The quadratic model prediction error and counter;
- The amount of search direction restarts;
- The extreme eigenvalues of the basis matrix for the subspace;
- Information and size of the active-set;
- Whether the orthogonal property holds;
- The action to take for the next iteration (switch solver);
- The search space size;
- The amount of memory vectors used.
The output might look as follows:
----- Iteration details (CG) ---------
Size of gradient 2.64E+01
Size of subspace gradient 2.64E+01
Eigenvalues R range 6.80E-01 6.80E-01
Orthogonal property lost
Action Switch to LCG
----------------------------------------
----- LCG solver details -------------
Search space has 2 element(s)
Memory vectors 2 ( 2)
----------------------------------------
Summary
Once the solver finishes, a detailed summary is produced:
-------------------------------------------------------------------------------
Status: converged, an optimal solution was found
-------------------------------------------------------------------------------
Value of the objective 3.55353E-14
Norm of inactive gradient 2.53812E-07
Norm of projected direction 1.68481E-07
Iterations 32
Function evaluations 80
FD func. evaluations 5
Gradient evaluations 48
NPG function calls 0
NPG gradient calls 0
CG function calls 11
CG gradient calls 9
LCG function calls 69
LCG gradient calls 39
-------------------------------------------------------------------------------
It starts with a status line of the overall result, followed by the final objective value as well as the gradient (unconstrained problem) or inactive gradient and projected direction (constrained problem) norms. If or , it will additionally report iteration count, objective function and gradient call information.
Optionally, if
,
the timings for the user-supplied objective are displayed. It might look as follows:
Timing
Total time spent 12.54 sec
Total time in obj function 3.01 sec ( 24.0%)
Total time in obj gradient 5.28 sec ( 42.1%)
Solution
If
,
the values of the solution, their bounds and the (inactive) gradient (see
Section 11.3) are printed. It might look as follows:
Variables:
idx lower bound value upper bound gradient
1 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
2 0.00000E+00 1.00000E-01 1.00000E+00 0.00000E+00
3 0.00000E+00 1.52323E-04 inf 1.97514E-07
4 0.00000E+00 8.49117E-03 inf -1.30979E-07
10
Example
In this example, we minimize in
the Rosenbrock function over simple bounds on the variables. The problem to solve is
The initial guess is , and the expected solution point is with objective value .
10.1
Program Text
10.2
Program Results
11
Algorithmic Details
This section contains the description of the underlying algorithms used in
e04kfc, a first-order active-set (FOAS) method with very low memory requirements suitable for large-scale bound-constrained nonlinear optimization problems. For further details, see
Hager and Zhang (2006b) and references therein.
11.1
Active-Set Method and Algorithm Outline
Active-set is a useful method to tackle problems with bound constraints. It derives its name from the partitioning of the search space: elements of that are fixed at a bound ( or ), are said to be active, while the rest of the elements of are said to be inactive. The goal of this method is to estimate which variables will be active at the solution point while optimizing over the inactive components.
e04kfc consists of a constrained solver, an unconstrained solver and a set of rules to switch between them. The constrained solver (nonmonotone projected gradient, NPG) has two purposes: while solving
(1) it tries to guess which components of
are active at a solution. Once a
reasonable guess is available, control is transferred to an unconstrained solver (conjugate gradient method, CG, and its limited-memory variant, LCG) that operates only over the inactive elements of
but convergence is much faster that NPG.
The following is an outline of the implemented algorithm.
FOAS Algorithm
-
(i)Make initial point feasible.
-
(ii)Loop until stopping criteria are satisfied
-
(a)Constrained problem (NPG): start solving constrained problem (1) and try to identify a suitable inactive search space; if found, then go to (ii)(b).
-
(b)Unconstrained subproblem (CG): solve unconstrained problem (4) over the elements of marked inactive. If elements of become newly active or it is deemed that some active elements should be explored, then go back to (ii)(a).
11.2
Constrained Subproblem (NPG)
By setting
, the constrained problem
(1) can be stated as
and can be solved using NPG which is an iterative method of the form
with step size
and projection direction
.
The projected direction,
, is obtained by a projection of the objective gradient
onto
:
with
the Euclidean projection operator over the box
. Note that if
, then
and the method reduces to nonmonotone steepest descent.
The step size
is chosen to guarantee global convergence, i.e., guarantee sufficient progress at each iteration using the nonmonotone Armijo condition
where
is a reference objective function value for iteration
, possibly
. The step size is estimated using a nonmonotone backtracking technique. As soon as a suitable inactive set is identified (see
Hager and Zhang (2006b)), the control is transferred to CG (LCG) to accelerate the convergence.
11.3
Unconstrained Subproblem (CG)
The exploration of the inactive search space is performed using the CG method which is an iterative method to solve
and each iterate is updated using the expression
where
is a direction of descent that combines the current gradient
and a scaled version of the previous direction,
, with
,
The step size
is chosen to ensure global convergence and is achieved by satisfying the weak Wolfe conditions
with
or the approximate Wolfe conditions (see
Hager and Zhang (2005))
,
with
and
. The line search performed by
e04kfc will always satisfy either/or both stated conditions. The line search builds a series of nested intervals that contains a point satisfying the above sufficient decrease requirements.
It is important to note that when , then the used gradient is actually the inactive gradient,
it is the gradient, , but with zeros in the same positions where the elements of
are marked as active.
The performance of the CG method can degrade when orthogonality is lost between consecutive search directions. Therefore, e04kfc uses a limited number of previous search directions to detect and restore orthogonality. When the current search direction is no longer orthogonal, it is discarded and a quasi-Newton variant known as limited-memory CG (LCG) is used to build a new search direction orthogonal to the explored subspace.
The available memory is used to build an approximation of the Hessian and the new search direction is estimated using
The quasi-Newton Hessian approximation
, is updated at each iteration using the BFGS update formula, see
Nocedal and Wright (2006).
Experiments in literature indicate that an adequate range for the quasi-Newton (amount of vectors used to build ) lies between and . The default value for the maximum amount of vectors used in e04kfc is and can be changed via the .
11.4
Stopping Criteria
A point is considered a solution when there are no feasible descent directions to use. Under this circumstance the function will stop, declaring to have found a solution.
If the problem is unconstrained, the function declares to have found a solution and stops when the first-order optimality condition is met within the defined absolute or relative tolerances (
,
),
where
can designate either the Euclidean or Infinity (default) norms.
On the other hand, if the problem is constrained, the function characterizes to have found a solution when the first-order condition is satisfied for the projected direction,
, to the defined tolerances,
In the unconstrained case we have
and both stopping criteria
(6) and
(7) coincide.
The stopping tolerances can be changed using the optional parameters
and
, while the norm used can be set by using the optional parameter
, see
Section 12 for details. If these parameters are set too small in relation to the complexity and scaling of the problem, the function can terminate with
NE_NO_IMPROVEMENT,
NE_TOO_MANY_ITER or
NW_NOT_CONVERGED.
Progress of the solver towards a solution is monitored using two criteria.
The first one evaluates how
poor
the actual step has been and is estimated via
where
is given by the line search. If the above relation is consistently satisfied, then the solver stops with
NE_NO_IMPROVEMENT.
The tolerance
is set using the optional parameter
. The second criteria monitors the rate of convergence using
As with the first criteria, if the previous relation is deemed permanent, then the solver stops with
NW_NOT_CONVERGED. The tolerance
can be changed using the optional parameter
.
11.5
A Note About Lagrangian Multipliers
It is often useful to have access to the Lagrangian multipliers (dual variables) associated with the constraints if there are any defined. In the case where only simple bounds are present, the multipliers directly relate to the values of the gradient at the solution. The multipliers of the active bounds are the absolute values of the associated elements of the gradient. The multipliers of the inactive bounds are always zero.
The multipliers based on the final gradient value (or its finite-difference approximation) can be retrieved by calling
e04rxc with the command string
. The format is the same as for other functions, see
Section 3.1 in
e04svc. Note that if the problem has not fully converged, the provided approximation might be quite crude.
12
Optional Parameters
Several optional parameters in e04kfc define choices in the problem specification or the algorithm logic. In order to reduce the number of formal arguments of e04kfc these optional parameters have associated default values that are appropriate for most problems. Therefore, you need only specify those optional parameters whose values are to be different from their default values.
The remainder of this section can be skipped if you wish to use the default values for all optional parameters.
The optional parameters can be changed by calling
e04zmc anytime between the initialization of the handle and the call to the solver. Modification of the optional parameters during intermediate monitoring steps is not allowed. Once the solver finishes, the optional parameters can be altered again for the next solve.
The option values may be retrieved by
e04znc.
The following is a list of the optional parameters available. A full description of each optional parameter is provided in
Section 12.1.
12.1
Description of the Optional Parameters
For each option, we give a summary line, a description of the optional parameter and details of constraints.
The summary line contains:
- the keywords;
- a parameter value,
where the letters , and denote options that take character, integer and real values respectively.
- the default value, where the symbol is a generic notation for machine precision (see X02AJC).
All options accept the value to return single options to their default states.
Keywords and character values are case and white space insensitive.
This special keyword may be used to reset all optional parameters to their default values. Any value given with this keyword will be ignored.
FOAS Estimate Derivatives | | Default |
This option indicates whether to check for and estimate missing entries of the user-supplied gradient vector. Since the associated cost of estimating missing elements can be high, this option should only be used if strictly necessary. In general terms, if the gradient is not provided (in its entirety or for arbitrary points) potential degradation in the progress of the solver is to be expected. Depending on the complexity of the objective, the function may not achieve the desired optimality accuracy or even terminate with no possible further progress error
NE_NO_IMPROVEMENT, it is advisable to increase the values of
and
when using this option.
Missing elements from the gradient vector are estimated by finite-differences using the perturbation interval specified by the optional parameter .
If , the entries are not checked and all derivative elements need to be provided.
Constraint: or .
FOAS Finite Diff Interval | | Default
|
Specifies the relative perturbation size used to estimate a derivative using the forward (or backward) finite-difference method. Setting the value too small or too big may lead
e04kfc to terminated with
NE_NO_IMPROVEMENT or
NE_USER_NAN.
Constraint: .
FOAS Iteration Limit | | Default |
This parameter sets the maximum number of iterations to be performed by
e04kfc. Setting the option too low might lead to
NE_TOO_MANY_ITER.
Constraint: .
This parameter specifies the maximum number of memory vectors to use in the LCG solver.
Constraint: .
FOAS Monitor Frequency | | Default |
This parameter specifies the frequency on which to call the monitor function
monit.
If zero, the monitor function will not be called.
Constraint: .
FOAS Print Frequency | | Default |
This parameter specifies the frequency with which to print information regarding each iteration to and/or . By default, it will print information of every iteration.
Constraint: .
FOAS Progress Tolerance | | Default
|
Specifies the tolerance for
(see
(8)) for which the function characterises a poor rate of progress given that it deems to be far from a solution. If this behaviour is persistent, then the function asserts that no substantial further progress can be achieved and the process is terminated with
NE_NO_IMPROVEMENT. Setting a high tolerance can lead to misinterpret reasonable progress for unsatisfactory progress or even issue a premature stop, see
(8) in
Section 11.4.
Constraint: .
FOAS Rel Stop Tolerance | | Default
|
This parameter sets the value of
which specifies the relative tolerance for the convergence measures in the stopping criteria, see
(6) and
(7) in
Section 11.4.
Constraint: .
FOAS Restart Factor | | Default |
This factor specifies the frequency with which the CG/LCG directions are replaced by the steepest descent direction (). Setting the value too small can potentially slow the convergence speed.
Constraint: .
FOAS Slow Tolerance | | Default
|
Specifies the tolerance for
(see
(9)) for which the function characterises a slow rate of convergence. If this behaviour is deemed permanent, then the function asserts that no substantial improvement can be achieved and the process is terminated with
NW_NOT_CONVERGED. Setting a large tolerance can lead to incorrectly identifying a sub-optimal solution, see
(9) in
Section 11.4.
Constraint: .
FOAS Stop Tolerance | | Default |
This parameter sets the value of
which specifies the tolerance for the convergence measures in the stopping criteria, see
(6) and
(7) in
Section 11.4.
Constraint: .
FOAS Tolerance Norm | | Default |
This parameter specifies the norm used to measure some stopping metrics, such as optimality tolerances (see
Section 11.4). It is possible to choose between 2-norm and ∞-norm. Solving problems using ∞-norm generally has lower computational costs than those based on 2-norm.
Constraint: or .
Infinite Bound Size | | Default |
This defines the ‘infinite’ bound in the definition of the problem constraints. Any upper bound greater than or equal to will be regarded as (and similarly any lower bound less than or equal to will be regarded as ). Note that a modification of this optional parameter does not influence constraints which have already been defined; only the constraints formulated after the change will be affected.
Constraint: .
Monitoring File | | Default |
(See
Section 3.1.1 in the Introduction to the NAG Library CL Interface for further information on NAG data types.)
If
, the
Nag_FileID number (as returned from
x04acc)
for the secondary (monitoring) output. If set to
, no secondary output is provided. The following information is output to the unit:
-
–a listing of the optional parameters;
-
–problem statistics, the iteration log and the final status as set by ;
-
–the solution if set by .
Constraint: .
Monitoring Level | | Default |
This parameter sets the amount of information detail that will be printed by the solver to the secondary output. The meaning of the levels is the same as .
Constraint: .
Print File | | Default
|
(See
Section 3.1.1 in the Introduction to the NAG Library CL Interface for further information on NAG data types.)
If
, the
Nag_FileID number (as returned from
x04acc,
stdout as the default)
for the primary output of the solver. If
, the primary output is completely turned off independently of other settings. The following information is output to the unit:
-
–a listing of optional parameters if set by ;
-
–problem statistics, the iteration log and the final status from the solver as set by ;
-
–the solution if set by .
Constraint: .
This parameter defines how detailed information should be printed by the solver to the primary output.
|
Output |
|
No output from the solver |
|
Only the final status and the objective value |
|
Problem statistics, one line per iteration showing the progress of the solution with respect to the convergence measures, final status and statistics |
|
As level but each iteration line is longer and includes step length and progress measure |
|
As level but further details of each iteration are presented |
Constraint: .
Print Options | | Default |
If , a listing of optional parameters will be printed to the primary output.
Constraint: or .
Print Solution | | Default |
If , the final values of the solution vector are printed on the primary and secondary outputs.
Constraint: or .
This parameter allows you to turn on timings of various parts of the algorithm to give a better overview of where most of the time is spent. This might be helpful for a choice of different solving approaches. It is possible to choose between CPU and wall clock time. Choice is equivalent to .
Constraint: , , or .
This parameter specifies the required direction of the optimization. If , the objective function (if set) is ignored and the algorithm stops as soon as a feasible point is found. If no objective function is set, reverts to automatically.
Constraint: , or .
This parameter specifies a limit in seconds that the solver can use to solve one problem. If during the convergence check this limit is exceeded, the solver will terminate with
NE_TIME_LIMIT error message.
Constraint: .
Verify Derivatives | | Default |
This parameter specifies whether the function should perform numerical checks on the consistency of the user-supplied gradient function. If any discrepancies are found,
NE_DERIV_ERRORS is returned.
It is recommended that such checks are enabled when first developing the formulation of the problem, however, the verification process results in a significant increase of the number of the function evaluations and thus it shouldn't be used in production code.
Constraint: or .