NAG CPP Interface
nagcpp::opt::handle_set_nlnobj (e04rg)

Settings help

CPP Name Style:



1 Purpose

handle_set_nlnobj is a part of the NAG optimization modelling suite and declares the objective function of the problem as a nonlinear function with a particular gradient sparsity structure.

2 Specification

#include "e04/nagcpp_e04rg.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
template <typename COMM, typename IDXFD>

void function handle_set_nlnobj(COMM &comm, const IDXFD &idxfd, OptionalE04RG opt)
template <typename COMM, typename IDXFD>

void function handle_set_nlnobj(COMM &comm, const IDXFD &idxfd)

3 Description

After the handle has been initialized (e.g., handle_​init has been called), handle_set_nlnobj may be used to declare the objective function of the problem as a nonlinear function and define the sparsity pattern (list of nonzero elements) of its gradient. If the objective function has already been defined, it will be overwritten and its Hessian (or the Hessian of the Lagrangian) will be removed. If handle_set_nlnobj is called with no nonzeroes in the sparsity pattern, any existing objective function is removed, no new one is added and the problem will be solved as a feasible point problem.
This objective function will typically be used for nonlinear programming problems (NLP) of the kind:
minimize xn f(x)   (a) subject to lgg(x)ug,   (b) lBBxuB.   (c) lxxux   (d) (1)
The values of the nonlinear objective function f(x) and the nonzero values of its gradient f xi (matching the sparsity pattern) evaluated at particular points in the decision variable space will be communicated to the NLP solver by user-supplied functions (e.g., objfun and objgrd for handle_​solve_​ipopt). See Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

4 References

None.

5 Arguments

1: comm CommE04RA Input/Output
Communication structure. An object of either the derived class CommE04RA or its base class NoneCopyableComm can be supplied. It is recommended that the derived class is used. If the base class is supplied it must first be initialized via a call to opt::handle_init (e04ra).
2: idxfd(nnzfd) types::f77_integer array Input
On entry: the one-based indices of the nonzero elements of the sparse gradient vector. The indices must be stored in ascending order. Note that n is the current number of decision variables in the model.
If nnzfd=0, the objective is assumed to be zero and the array idxfd will not be referenced.
Constraints:
  • 1idxfd(i-1)n, for i=1,2,,nnzfd;
  • idxfd(i-1)<idxfd(i), for i=1,2,,nnzfd-1.
3: opt OptionalE04RG Input/Output
Optional parameter container, derived from Optional.

5.1Additional Quantities

1: nnzfd
The number of nonzero elements in the sparse gradient vector of the objective function.

6 Exceptions and Warnings

Errors or warnings detected by the function:
All errors and warnings have an associated numeric error code field, errorid, stored either as a member of the thrown exception object (see errorid), or as a member of opt.ifail, depending on how errors and warnings are being handled (see Error Handling for more details).
Raises: ErrorException
errorid=1
comm::handle has not been initialized.
errorid=1
comm::handle does not belong to the NAG optimization modelling suite,
has not been initialized properly or is corrupted.
errorid=1
comm::handle has not been initialized properly or is corrupted.
errorid=2
The problem cannot be modified right now, the solver is running.
errorid=6
On entry, nnzfd = value.
Constraint: nnzfd0.
errorid=7
On entry, i=value, idxfd[i-1]=value and
idxfd[i+0]=value.
Constraint: idxfd[i-1]<idxfd[i+0] (ascending order).
errorid=7
On entry, i=value, idxfd[i-1]=value and
n=value.
Constraint: 1idxfd[i-1]n.
errorid=10601
On entry, argument value must be a vector of size value array.
Supplied argument has value dimensions.
errorid=10601
On entry, argument value must be a vector of size value array.
Supplied argument was a vector of size value.
errorid=10601
On entry, argument value must be a vector of size value array.
The size for the supplied array could not be ascertained.
errorid=10602
On entry, the raw data component of value is null.
errorid=10603
On entry, unable to ascertain a value for value.
errorid=10605
On entry, the communication class value has not been initialized correctly.
errorid=−99
An unexpected error has been triggered by this routine.
errorid=−399
Your licence key may have expired or may not have been installed correctly.
errorid=−999
Dynamic memory allocation failed.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Please see the description for the underlying computational routine in this section of the FL Interface documentation.

9 Further Comments

10 Example

Examples of the use of this method may be found in the examples for: handle_​solve_​bounds_​foas.