NAG FL Interface
e04rhf (handle_set_simplebounds)
1
Purpose
e04rhf is a part of the NAG optimization modelling suite and defines bounds on the variables of the problem.
2
Specification
Fortran Interface
Integer, Intent (In) |
:: |
nvar |
Integer, Intent (Inout) |
:: |
ifail |
Real (Kind=nag_wp), Intent (In) |
:: |
bl(nvar), bu(nvar) |
Type (c_ptr), Intent (In) |
:: |
handle |
|
C Header Interface
#include <nag.h>
void |
e04rhf_ (void **handle, const Integer *nvar, const double bl[], const double bu[], Integer *ifail) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
e04rhf_ (void *&handle, const Integer &nvar, const double bl[], const double bu[], Integer &ifail) |
}
|
The routine may be called by the names e04rhf or nagf_opt_handle_set_simplebounds.
3
Description
After the initialization routine
e04raf has been called,
e04rhf may be used to define the variable bounds
of the problem unless the bounds have already been defined. This will typically be used for problems, such as linear programming (LP)
quadratic programming (QP)
nonlinear programming (NLP)
or linear semidefinite programming (SDP)
where
and
are
-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
th variable may be fixed by setting
. If certain bounds are not present, the associated elements of
or
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
further in this text. Note that the bounds are interpreted based on its value at the time of calling this routine and any later alterations to
Infinite Bound Size will not affect these constraints.
See
Section 3.1 in the
E04 Chapter Introduction for more details about the NAG optimization modelling suite.
4
References
Candes E and Recht B (2009) Exact matrix completion via convex optimization Foundations of Computation Mathematics (Volume 9) 717–772
5
Arguments
-
1:
– Type (c_ptr)
Input
-
On entry: the handle to the problem. It needs to be initialized by
e04raf and
must not be changed between calls to the NAG optimization modelling suite.
-
2:
– Integer
Input
-
On entry:
, the number of decision variables
in the problem. It must be unchanged from the value set during the initialization of the handle by
e04raf.
-
3:
– Real (Kind=nag_wp) array
Input
-
4:
– Real (Kind=nag_wp) array
Input
-
On entry:
,
bl and
,
bu define lower and upper bounds on the variables, respectively. To fix the
th variable, set
, where
. To specify a nonexistent lower bound (i.e.,
), set
; to specify a nonexistent upper bound (i.e.,
), set
. Note that models with fixed variables are not allowed with solver
e04svf in this release, however, the limitation will be removed in a future release.
Constraints:
- , for ;
- , for ;
- , for .
-
5:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 4 in the Introduction to the NAG Library FL Interface for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
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
e04raf or it has been corrupted.
-
The problem cannot be modified in this phase any more, the solver has already been called.
-
Variable bounds have already been defined.
-
On entry,
, expected
.
Constraint:
nvar must match the value given during initialization of
handle.
-
On entry, , , .
Constraint: .
On entry, , and .
Constraint: .
On entry, , , .
Constraint: .
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
Not applicable.
8
Parallelism and Performance
e04rhf is not threaded in any implementation.
9.1
Internal Changes
Internal changes have been made to this routine as follows:
- At Mark 26.1: The limitation to specifying model fixed variables ( for some ) where such input returns has been lifted. The only solver which cannot handle fixed variables (e04svf) will report an error on such a model directly.
For details of all known issues which have been reported for the NAG Library please refer to the
Known Issues.
10
Example
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
e04svf.
The problem can be stated as follows: Let's have respondents answering questions where they express their preferences as a number between and 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 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
denote the partially filled in
matrix with the valid responses on
positions. We are looking for
of the same size so that the valid responses are unchanged and the nuclear norm (denoted here as
) is minimal.
This is equivalent to
which is the linear semidefinite problem solved in this example, see
Candes and Recht (2009) and the references therein for details.
This example has
respondents and
answers. The obtained answers are
where
denotes missing entries (
is used instead in the data file). The obtained matrix has rank
and it is shown below printed to
-digit accuracy:
The example also turns on monitor mode of
e04svf, 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 routine is stopped by setting
within the monitor step.
See also
Section 10 in
e04raf for links to further examples in the suite.
10.1
Program Text
10.2
Program Data
10.3
Program Results