# NAG Library Routine Document

## 1Purpose

h02bzf extracts more information associated with the solution of an integer programming problem computed by h02bbf.

## 2Specification

Fortran Interface
 Subroutine h02bzf ( n, m, bl, bu,
 Integer, Intent (In) :: n, m, iwork(liwork), liwork, lrwork Integer, Intent (Inout) :: ifail Integer, Intent (Out) :: istate(n+m) Real (Kind=nag_wp), Intent (In) :: rwork(lrwork) Real (Kind=nag_wp), Intent (Out) :: bl(n+m), bu(n+m), clamda(n+m)
#include <nagmk26.h>
 void h02bzf_ (const Integer *n, const Integer *m, double bl[], double bu[], double clamda[], Integer istate[], const Integer iwork[], const Integer *liwork, const double rwork[], const Integer *lrwork, Integer *ifail)

## 3Description

h02bzf extracts the following information associated with the solution of an integer programming problem computed by h02bbf. The upper and lower bounds used for the solution, the Lagrange-multipliers (costs), and the status of the variables at the solution.
In the branch and bound method employed by h02bbf, the arrays bl and bu are used to impose restrictions on the values of the integer variables in each sub-problem. That is, if the variable ${x}_{j}$ is restricted to take value ${v}_{j}$ in a particular sub-problem, then ${\mathbf{bl}}\left(j\right)={\mathbf{bu}}\left(j\right)={v}_{j}$ is set in the sub-problem. Thus, on exit from this routine, some of the elements of bl and bu which correspond to integer variables may contain these imposed values, rather than those originally supplied to h02bbf.
None.

## 5Arguments

1:     $\mathbf{n}$ – IntegerInput
On entry: this must be the same argument n as supplied to h02bbf.
Constraint: ${\mathbf{n}}>0$.
2:     $\mathbf{m}$ – IntegerInput
On entry: this must be the same argument m as supplied to h02bbf.
Constraint: ${\mathbf{m}}\ge 0$.
3:     $\mathbf{bl}\left({\mathbf{n}}+{\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: if h02bbf exits with ${\mathbf{ifail}}={\mathbf{0}}$, ${\mathbf{7}}$ or ${\mathbf{9}}$, the values in the array bl contain the lower bounds imposed on the integer solution for all the constraints. The first n elements contain the lower bounds on the variables, and the next m elements contain the lower bounds for the general linear constraints (if any).
4:     $\mathbf{bu}\left({\mathbf{n}}+{\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: if h02bbf exits with ${\mathbf{ifail}}={\mathbf{0}}$, ${\mathbf{7}}$ or ${\mathbf{9}}$, the values in the array bu contain the upper bounds imposed on the integer solution for all the constraints. The first n elements contain the upper bounds on the variables, and the next m elements contain the upper bounds for the general linear constraints (if any).
5:     $\mathbf{clamda}\left({\mathbf{n}}+{\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: if h02bbf exits with ${\mathbf{ifail}}={\mathbf{0}}$, ${\mathbf{7}}$ or ${\mathbf{9}}$, the values in the array clamda contain the values of the Lagrange-multipliers for each constraint with respect to the current working set. The first n elements contain the multipliers (reduced costs) for the bound constraints on the variables, and the next m elements contain the multipliers (shadow costs) for the general linear constraints (if any).
6:     $\mathbf{istate}\left({\mathbf{n}}+{\mathbf{m}}\right)$ – Integer arrayOutput
On exit: if h02bbf exits with ${\mathbf{ifail}}={\mathbf{0}}$, ${\mathbf{7}}$ or ${\mathbf{9}}$, the values in the array istate indicate the status of the constraints in the working set at an integer solution. Otherwise, istate indicates the composition of the working set at the final iterate. The significance of each possible value of ${\mathbf{istate}}\left(j\right)$ is as follows.
 ${\mathbf{istate}}\left(j\right)$ Meaning $-2$ The constraint violates its lower bound by more than tolfes (the feasibility tolerance, see h02bbf). $-1$ The constraint violates its upper bound by more than tolfes. $\phantom{-}0$ The constraint is satisfied to within tolfes, but is not in the working set. $\phantom{-}1$ This inequality constraint is included in the working set at its lower bound. $\phantom{-}2$ This inequality constraint is included in the working set at its upper bound. $\phantom{-}3$ This constraint is included in the working set as an equality. This value of istate can occur only when ${\mathbf{bl}}\left(j\right)={\mathbf{bu}}\left(j\right)$. $\phantom{-}4$ This corresponds to an integer solution being declared with ${x}_{j}$ being temporarily fixed at its current value. This value of istate can occur only when ${\mathbf{ifail}}={\mathbf{0}}$, ${\mathbf{7}}$ or ${\mathbf{9}}$ on exit from h02bbf.
7:     $\mathbf{iwork}\left({\mathbf{liwork}}\right)$ – Integer arrayCommunication Array
On entry: this must be the same argument iwork as supplied to h02bbf. It is used to pass information from h02bbf to h02bzf and therefore the contents of this array must not be changed before calling h02bzf.
8:     $\mathbf{liwork}$ – IntegerInput
On entry: the dimension of the array iwork as declared in the (sub)program from which h02bzf is called.
9:     $\mathbf{rwork}\left({\mathbf{lrwork}}\right)$ – Real (Kind=nag_wp) arrayCommunication Array
On entry: this must be the same argument rwork as supplied to h02bbf. It is used to pass information from h02bbf to h02bzf and therefore the contents of this array must not be changed before calling h02bzf.
10:   $\mathbf{lrwork}$ – IntegerInput
On entry: the dimension of the array rwork as declared in the (sub)program from which h02bzf is called.
11:   $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, . If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation 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 $1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is $0$. When the value  is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{n}}\le 0$, or ${\mathbf{m}}<0$.
${\mathbf{ifail}}=-99$
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

Not applicable.

## 8Parallelism and Performance

h02bzf is not threaded in any implementation.

None.

## 10Example

One of the applications of integer programming is to the so-called diet problem. Given the nutritional content of a selection of foods, the cost of each food, the amount available of each food and the consumer's minimum daily nutritional requirements, the problem is to find the cheapest combination. This gives rise to the following problem:
minimize
 $cTx$
subject to
 $Ax≥b, 0≤x≤u,$
where
 $c= 3 24 13 9 20 19 T,x=x1,x2,x3,x4,x5,x6T$
is integer,
 $A= 110 205 160 160 420 260 4 32 13 8 4 14 2 12 54 285 22 80 , b= 2000 55 800$
and
 $u= 4 3 2 8 2 2 T$
The rows of $A$ correspond to energy, protein and calcium and the columns of $A$ correspond to oatmeal, chicken, eggs, milk, pie and bacon respectively.
The following program solves the above problem to obtain the optimal integer solution and then examines the effect of increasing the energy required to $2200$ units.

### 10.1Program Text

Program Text (h02bzfe.f90)

### 10.2Program Data

Program Data (h02bzfe.d)

### 10.3Program Results

Program Results (h02bzfe.r)