NAG CPP Interface
nagcpp::opt::handle_set_linobj (e04re)

1 Purpose

handle_set_linobj is a part of the NAG optimization modelling suite and defines the linear objective function of the problem.

2 Specification

#include "e04/nagcpp_e04re.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
template <typename COMM, typename CVEC>

void function handle_set_linobj(COMM &comm, const CVEC &cvec, OptionalE04RE opt)
template <typename COMM, typename CVEC>

void function handle_set_linobj(COMM &comm, const CVEC &cvec)

3 Description

After the initialization function handle_​init has been called, handle_set_linobj may be used to define the objective function of the problem as a linear function cTx using a dense vector c unless the objective function has already been defined by another function in the suite. This will typically be used for linear programming (LP)
minimize xn cTx   (a) subject to   lBBxuB,   (b) lxxux ,   (c) (1)
second-order cone programming (SOCP)
minimize xn cTx   (a) subject to lBBxuB,   (b) lxxux ,   (c) xGiKmi,i=1,,r,   (d) (2)
linear semidefinite programming problems (SDP)
minimize xn cTx   (a) subject to   i=1 n xi Aik - A0k 0 ,  k=1,,mA ,   (b) lBBxuB ,   (c) lxxux ,   (d) (3)
or SDP with bilinear matrix inequalities (BMI-SDP) where the objective function has only linear terms. It is recommended to use handle_​set_​quadobj if the vector c is sparse. 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: cvec(nvar) double array Input
On entry: the dense vector c of the objective function.
3: opt OptionalE04RE Input/Output
Optional parameter container, derived from Optional.

5.1Additional Quantities

1: nvar
n, the number of decision variables x in the problem.

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 in this phase any more, the solver
has already been called.
errorid=3
The objective function has already been defined.
errorid=4
On entry, nvar = value,
expected value=value.
Constraint: nvar must match the value given during initialization of comm::handle.
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

None.

10 Example

Examples of the use of this method may be found in the examples for: handle_​set_​group and handle_​solve_​ipopt.