H Chapter Contents
H Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentH02BZF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

H02BZF extracts more information associated with the solution of an integer programming problem computed by H02BBF.

## 2  Specification

 SUBROUTINE H02BZF ( N, M, BL, BU, CLAMDA, ISTATE, IWORK, LIWORK, RWORK, LRWORK, IFAIL)
 INTEGER N, M, ISTATE(N+M), IWORK(LIWORK), LIWORK, LRWORK, IFAIL REAL (KIND=nag_wp) BL(N+M), BU(N+M), CLAMDA(N+M), RWORK(LRWORK)

## 3  Description

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.

## 5  Parameters

1:     N – INTEGERInput
On entry: this must be the same parameter N as supplied to H02BBF.
Constraint: ${\mathbf{N}}>0$.
2:     M – INTEGERInput
On entry: this must be the same parameter M as supplied to H02BBF.
Constraint: ${\mathbf{M}}\ge 0$.
3:     BL(${\mathbf{N}}+{\mathbf{M}}$) – 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:     BU(${\mathbf{N}}+{\mathbf{M}}$) – 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:     CLAMDA(${\mathbf{N}}+{\mathbf{M}}$) – 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:     ISTATE(${\mathbf{N}}+{\mathbf{M}}$) – 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:     IWORK(LIWORK) – INTEGER arrayCommunication Array
On entry: this must be the same parameter 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:     LIWORK – INTEGERInput
On entry: the dimension of the array IWORK as declared in the (sub)program from which H02BZF is called.
9:     RWORK(LRWORK) – REAL (KIND=nag_wp) arrayCommunication Array
On entry: this must be the same parameter 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:   LRWORK – INTEGERInput
On entry: the dimension of the array RWORK as declared in the (sub)program from which H02BZF is called.
11:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ 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).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{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$.

Not applicable.

None.

## 9  Example

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.

### 9.1  Program Text

Program Text (h02bzfe.f90)

### 9.2  Program Data

Program Data (h02bzfe.d)

### 9.3  Program Results

Program Results (h02bzfe.r)