# NAG CPP Interfacenagcpp::opt::handle_set_simplebounds (e04rh)

Settings help

CPP Name Style:

## 1Purpose

handle_set_simplebounds is a part of the NAG optimization modelling suite and sets bounds on the variables of the problem.

## 2Specification

```#include "e04/nagcpp_e04rh.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
```
```template <typename COMM, typename BL, typename BU>

void function handle_set_simplebounds(COMM &comm, const BL &bl, const BU &bu, OptionalE04RH opt)```
```template <typename COMM, typename BL, typename BU>

void function handle_set_simplebounds(COMM &comm, const BL &bl, const BU &bu)```

## 3Description

After the handle has been initialized (e.g., handle_​init has been called), handle_set_simplebounds may be used to define the variable bounds ${l}_{x}\le x\le {u}_{x}$ of the problem. If the bounds have already been defined, they will be overwritten. Individual bounds may also be set by e04tdf (no CPP interface).
This will typically be used for problems, such as:
Linear Programming (LP)
 $minimize x∈ℝn cTx (a) subject to lB≤Bx≤uB, (b) lx≤x≤ux , (c)$ (1)
 $minimize x∈ℝn 12 xTHx + cTx (a) subject to lB≤Bx≤uB, (b) lx≤x≤ux, (c)$ (2)
Nonlinear Programming (NLP)
 $minimize x∈ℝn f(x) (a) subject to lg≤g(x)≤ug, (b) lB≤Bx≤uB, (c) lx≤x≤ux, (d)$ (3)
or linear Semidefinite Programming (SDP)
 $minimize x∈ℝn cTx (a) subject to ∑ i=1 n xi Aik - A0k ⪰ 0 , k=1,…,mA , (b) lB≤Bx≤uB, (c) lx≤x≤ux, (d)$ (4)
where ${l}_{x}$ and ${u}_{x}$ 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 $j$th variable may be fixed by setting ${l}_{j}={u}_{j}$. If certain bounds are not present, the associated elements of ${l}_{x}$ or ${u}_{x}$ may be set to special values that are treated as $-\infty$ or $+\infty$. See the description of the optional parameter Infinite Bound Size which is common among all solvers in the suite. Its value is denoted as $\mathit{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 Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.
Candes E and Recht B (2009) Exact matrix completion via convex optimization Foundations of Computation Mathematics (Volume 9) 717–772

## 5Arguments

1: $\mathbf{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: $\mathbf{bl}\left({\mathbf{nvar}}\right)$double array Input
On entry: ${l}_{x}$, bl and ${u}_{x}$, bu define lower and upper bounds on the variables, respectively. To fix the $j$th variable, set ${\mathbf{bl}}\left(j-1\right)={\mathbf{bu}}\left(j-1\right)=\beta$, where $|\beta |<\mathit{bigbnd}$. To specify a nonexistent lower bound (i.e., ${l}_{j}=-\infty$), set ${\mathbf{bl}}\left(j-1\right)\le -\mathit{bigbnd}$; to specify a nonexistent upper bound (i.e., ${u}_{j}=\infty$), set ${\mathbf{bu}}\left(j-1\right)\ge \mathit{bigbnd}$.
Constraints:
• ${\mathbf{bl}}\left(\mathit{j}-1\right)\le {\mathbf{bu}}\left(\mathit{j}-1\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{nvar}}$;
• ${\mathbf{bl}}\left(\mathit{j}-1\right)<\mathit{bigbnd}$, for $\mathit{j}=1,2,\dots ,{\mathbf{nvar}}$;
• ${\mathbf{bu}}\left(\mathit{j}-1\right)>-\mathit{bigbnd}$, for $\mathit{j}=1,2,\dots ,{\mathbf{nvar}}$.
3: $\mathbf{bu}\left({\mathbf{nvar}}\right)$double array Input
On entry: ${l}_{x}$, bl and ${u}_{x}$, bu define lower and upper bounds on the variables, respectively. To fix the $j$th variable, set ${\mathbf{bl}}\left(j-1\right)={\mathbf{bu}}\left(j-1\right)=\beta$, where $|\beta |<\mathit{bigbnd}$. To specify a nonexistent lower bound (i.e., ${l}_{j}=-\infty$), set ${\mathbf{bl}}\left(j-1\right)\le -\mathit{bigbnd}$; to specify a nonexistent upper bound (i.e., ${u}_{j}=\infty$), set ${\mathbf{bu}}\left(j-1\right)\ge \mathit{bigbnd}$.
Constraints:
• ${\mathbf{bl}}\left(\mathit{j}-1\right)\le {\mathbf{bu}}\left(\mathit{j}-1\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{nvar}}$;
• ${\mathbf{bl}}\left(\mathit{j}-1\right)<\mathit{bigbnd}$, for $\mathit{j}=1,2,\dots ,{\mathbf{nvar}}$;
• ${\mathbf{bu}}\left(\mathit{j}-1\right)>-\mathit{bigbnd}$, for $\mathit{j}=1,2,\dots ,{\mathbf{nvar}}$.
4: $\mathbf{opt}$OptionalE04RH Input/Output
Optional parameter container, derived from Optional.

1: $\mathbf{nvar}$
$n$, the current number of decision variables $x$ in the model.

## 6Exceptions 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
$\mathbf{errorid}=1$
comm::handle has not been initialized.
$\mathbf{errorid}=1$
comm::handle does not belong to the NAG optimization modelling suite,
has not been initialized properly or is corrupted.
$\mathbf{errorid}=1$
comm::handle has not been initialized properly or is corrupted.
$\mathbf{errorid}=2$
The problem cannot be modified right now, the solver is running.
$\mathbf{errorid}=4$
On entry, ${\mathbf{nvar}}=⟨\mathit{value}⟩$,
expected $\mathrm{value}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{nvar}}$ must match the current number of variables
of the model in the comm::handle.
$\mathbf{errorid}=10$
On entry, $j=⟨\mathit{value}⟩$, ${\mathbf{bl}}\left[j-1\right]=⟨\mathit{value}⟩$ and
${\mathbf{bu}}\left[j-1\right]=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{bl}}\left[j-1\right]\le {\mathbf{bu}}\left[j-1\right]$.
$\mathbf{errorid}=10$
On entry, $j=⟨\mathit{value}⟩$, ${\mathbf{bl}}\left[j-1\right]=⟨\mathit{value}⟩$,
$\mathit{bigbnd}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{bl}}\left[j-1\right]<\mathit{bigbnd}$.
$\mathbf{errorid}=10$
On entry, $j=⟨\mathit{value}⟩$, ${\mathbf{bu}}\left[j-1\right]=⟨\mathit{value}⟩$,
$\mathit{bigbnd}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{bu}}\left[j-1\right]>-\mathit{bigbnd}$.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a vector of size $⟨\mathit{\text{value}}⟩$ array.
Supplied argument has $⟨\mathit{\text{value}}⟩$ dimensions.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a vector of size $⟨\mathit{\text{value}}⟩$ array.
Supplied argument was a vector of size $⟨\mathit{\text{value}}⟩$.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a vector of size $⟨\mathit{\text{value}}⟩$ array.
The size for the supplied array could not be ascertained.
$\mathbf{errorid}=10602$
On entry, the raw data component of $⟨\mathit{\text{value}}⟩$ is null.
$\mathbf{errorid}=10603$
On entry, unable to ascertain a value for $⟨\mathit{\text{value}}⟩$.
$\mathbf{errorid}=10605$
On entry, the communication class $⟨\mathit{\text{value}}⟩$ has not been initialized correctly.
$\mathbf{errorid}=-99$
An unexpected error has been triggered by this routine.
$\mathbf{errorid}=-399$
Your licence key may have expired or may not have been installed correctly.
$\mathbf{errorid}=-999$
Dynamic memory allocation failed.

Not applicable.

## 8Parallelism and Performance

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