NAG Library Function Document

nag_opt_handle_set_simplebounds (e04rhc)


    1  Purpose
    7  Accuracy


nag_opt_handle_set_simplebounds (e04rhc) is a part of the NAG optimization modelling suite and defines bounds on the variables of the problem.


#include <nag.h>
#include <nage04.h>
void  nag_opt_handle_set_simplebounds (void *handle, Integer nvar, const double bl[], const double bu[], NagError *fail)


After the initialization function nag_opt_handle_init (e04rac) has been called, nag_opt_handle_set_simplebounds (e04rhc) may be used to define the variable bounds lxxux of the problem unless the bounds have already been defined. This will typically be used for problems, such as linear programming (LP)
minimize xn cTx   (a) subject to   lBBxuB   (b) lxxux ,   (c) (1)
quadratic programming (QP)
minimize xn 12 xTHx + cTx   (a) subject to lBBxuB   (b) lxxux   (c) (2)
nonlinear programming (NLP)
minimize xn fx   (a) subject to lggxug   (b) lBBxuB   (c) lxxux   (d) (3)
or linear semidefinite programming (SDP)
minimize xn cTx   (a) subject to   i=1 n xi Aik - A0k 0 ,  k=1,,mA   (b) lBBxuB   (c) lxxux   (d) (4)
where lx and ux are n-dimensional vectors. Note that upper and lower bounds are specified for all the variables. This form allows full generality in specifying various types of constraint. In particular, the jth variable may be fixed by setting lj=uj. If certain bounds are not present, the associated elements of lx or ux may be set to special values that are treated as - or +. See the description of the optional parameter Infinite Bound Size which is common among all solvers in the suite. Its value is denoted as bigbnd further in this text. Note that the bounds are interpreted based on its value at the time of calling this function and any later alterations to Infinite Bound Size will not affect these constraints.
See nag_opt_handle_init (e04rac) for more details.


Candes E and Recht B (2009) Exact matrix completion via convex optimization Foundations of Computation Mathematics (Volume 9) 717–772


1:     handle void *Input
On entry: the handle to the problem. It needs to be initialized by nag_opt_handle_init (e04rac) and must not be changed.
2:     nvar IntegerInput
On entry: n, the number of decision variables x in the problem. It must be unchanged from the value set during the initialization of the handle by nag_opt_handle_init (e04rac).
3:     bl[nvar] const doubleInput
4:     bu[nvar] const doubleInput
On entry: lx, bl and ux, bu define lower and upper bounds on the variables, respectively. To fix the jth variable, set bl[j-1]=bu[j-1]=β, where β<bigbnd. To specify a nonexistent lower bound (i.e., lj=-), set bl[j-1]-bigbnd; to specify a nonexistent upper bound (i.e., uj=), set bu[j-1]bigbnd. Note that models with fixed variables are not allowed with solver nag_opt_handle_solve_pennon (e04svc) in this release, however, the limitation will be removed in a future release.
  • bl[j-1]bu[j-1], for j=1,2,,nvar;
  • bl[j-1]<bigbnd, for j=1,2,,nvar;
  • bu[j-1]>-bigbnd, for j=1,2,,nvar.
5:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

Error Indicators and Warnings

Dynamic memory allocation failed.
See Section in How to Use the NAG Library and its Documentation for further information.
Variable bounds have already been defined.
On entry, argument value had an illegal value.
On entry, j=value, bl[j-1]=value, bigbnd=value.
Constraint: bl[j-1]<bigbnd.
On entry, j=value, bl[j-1]=value and bu[j-1]=value.
Constraint: bl[j-1]bu[j-1].
On entry, j=value, bu[j-1]=value, bigbnd=value.
Constraint: bu[j-1]>-bigbnd.
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 nag_opt_handle_init (e04rac) or it has been corrupted.
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 2.7.6 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
The problem cannot be modified in this phase any more, the solver has already been called.
On entry, nvar=value, expected value=value.
Constraint: nvar must match the value given during initialization of handle.


Not applicable.

Parallelism and Performance

nag_opt_handle_set_simplebounds (e04rhc) is not threaded in any implementation.

Further Comments

Internal Changes

Internal changes have been made to this function as follows:
For details of all known issues which have been reported for the NAG Library please refer to the Known Issues list.


There is a vast number of problems which can be reformulated as SDP. This example follows Candes and Recht (2009) to show how a rank minimization problem can be approximated by SDP. In addition, it demonstrates how to work with the monitor mode of nag_opt_handle_solve_pennon (e04svc).
The problem can be stated as follows: Let's have m respondents answering k questions where they express their preferences as a number between 0 and 1 or the question can be left unanswered. The task is to fill in the missing entries, i.e., to guess the unexpressed preferences. This problem falls into the category of matrix completion. The idea is to choose the missing entries to minimize the rank of the matrix as it is commonly believed that only a few factors contribute to an individual's tastes or preferences.
Rank minimization is in general NP-hard but it can be approximated by a heuristic, minimizing the nuclear norm of the matrix. The nuclear norm of a matrix is the sum of its singular values. A rank deficient matrix must have (several) zero singular values. Given the fact that the singular values are always non-negative, a minimization of the nuclear norm has the same effect as 1 norm in compress sensing, i.e., it encourages many singular values to be zero and thus it can be considered as a heuristic for the original rank minimization problem.
Let Y^ denote the partially filled in m×k matrix with the valid responses on i,jΩ positions. We are looking for Y of the same size so that the valid responses are unchanged and the nuclear norm (denoted here as ·*) is minimal.
minimizeY Y* subject to   Yij = Y^ij  for all  i,jΩ.  
This is equivalent to
minimize W1, W2, Y trace W1+ trace W2 subject to   Yij = Y^ij  for all  i,jΩ W1 Y YT W2 0  
which is the linear semidefinite problem solved in this example, see Candes and Recht (2009) and the references therein for details.
This example has m=15 respondents and k=6 answers. The obtained answers are
Y^ = * * * * * 0.4 0.6 0.4 0.8 * * * * * 0.8 * 0.2 * 0.8 0.2 * * * * * 0.4 * 0.0 * 0.2 0.4 * * 0.2 * 0.2 * 0.8 0.2 0.6 * * * * 0.2 * * * * 0.4 * 0.6 0.0 * * * 0.4 * * * * * 0.2 0.2 0.4 0.4 * * * * 1.0 0.8 1.0 * 0.2 * * 0.6 * * * * * 0.2 0.6 * 0.2 0.4 * *  
where * denotes missing entries (-1.0 is used instead in the data file). The obtained matrix has rank 4 and it is shown below printed to 1-digit accuracy:
Y = 0.5 0.3 0.2 0.2 0.4 0.4 0.6 0.4 0.8 0.2 0.3 0.4 0.4 0.3 0.8 0.0 0.2 0.2 0.8 0.2 0.3 0.4 0.3 0.4 0.0 0.4 0.2 0.0 0.2 0.2 0.4 0.1 0.2 0.2 0.1 0.2 0.6 0.8 0.2 0.6 0.2 0.4 0.1 0.1 0.2 0.0 0.0 0.1 0.6 0.4 0.1 0.6 0.0 0.3 0.2 0.1 0.4 0.0 0.1 0.1 0.5 0.3 0.2 0.2 0.4 0.4 0.7 0.4 0.3 0.0 1.0 0.8 1.0 0.3 0.2 0.5 0.5 0.6 0.2 0.1 0.1 0.1 0.2 0.2 0.6 0.3 0.2 0.4 0.2 0.3 .  
The example also turns on monitor mode of nag_opt_handle_solve_pennon (e04svc), there is a time limit introduced for the solver which is being checked at the end of every outer iteration. If the time limit is reached, the function is stopped by setting inform=0 within the monitor step.
See also Section 10 in nag_opt_handle_init (e04rac) for links to further examples in the suite.

Program Text

Program Text (e04rhce.c)

Program Data

Program Data (e04rhce.d)

Program Results

Program Results (e04rhce.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017