NAG Library Routine Document
H02BBF
1 Purpose
H02BBF solves ‘zero-one’, ‘general’, ‘mixed’ or ‘all’ integer programming problems using a branch and bound method. The routine may also be used to find either the first integer solution or the optimum integer solution. It is not intended for large sparse problems.
2 Specification
SUBROUTINE H02BBF ( |
ITMAX, MSGLVL, N, M, A, LDA, BL, BU, INTVAR, CVEC, MAXNOD, INTFST, MAXDPT, TOLIV, TOLFES, BIGBND, X, OBJMIP, IWORK, LIWORK, RWORK, LRWORK, IFAIL) |
INTEGER |
ITMAX, MSGLVL, N, M, LDA, INTVAR(N), MAXNOD, INTFST, MAXDPT, IWORK(LIWORK), LIWORK, LRWORK, IFAIL |
REAL (KIND=nag_wp) |
A(LDA,*), BL(N+M), BU(N+M), CVEC(N), TOLIV, TOLFES, BIGBND, X(N), OBJMIP, RWORK(LRWORK) |
|
3 Description
H02BBF is capable of solving certain types of integer programming (IP) problems using a branch and bound (B&B) method, see
Taha (1987). In order to describe these types of integer programs and to briefly state the B&B method, we define the following linear programming (LP) problem:
If, in
(1), it is required that (some or) all the variables take integer values, then the integer program is of type (
mixed or)
all general IP problem. If additionally, the integer variables are restricted to take only
–
values (i.e.,
and
) then the integer program is of type (mixed or all)
zero-one IP problem.
The B&B method applies directly to these integer programs. The general idea of B&B (for a full description see
Dakin (1965) or
Mitra (1973)) is to solve the problem without the integral restrictions as an LP problem (first
node). If in the optimal solution an integer variable
takes a noninteger value
, two LP sub-problems are created by
branching, imposing
and
respectively, where
denotes the integer part of
. This method of branching continues until the first integer solution (
bound) is obtained. The hanging nodes are then solved and investigated in order to prove the optimality of the solution. At each node, an LP problem is solved using
E04MFF/E04MFA.
4 References
Dakin R J (1965) A tree search algorithm for mixed integer programming problems Comput. J. 8 250–255
Mitra G (1973) Investigation of some branch and bound strategies for the solution of mixed integer linear programs Math. Programming 4 155–170
Taha H A (1987) Operations Research: An Introduction Macmillan, New York
5 Parameters
- 1: ITMAX – INTEGERInput/Output
On entry: an upper bound on the number of iterations for each LP problem.
On exit: unchanged if on entry , else .
- 2: MSGLVL – INTEGERInput
On entry: the amount of printout produced by H02BBF, as indicated below (see
Section 5.1 for a description of the printed output). All output is written to the current advisory message unit (as defined by
X04ABF).
Value |
Definition |
0 |
No output. |
1 |
The final IP solution only. |
5 |
One line of output for each node investigated and the final IP solution. |
10 |
The original LP solution (first node), one line of output for each node investigated and the final IP solution. |
- 3: N – INTEGERInput
On entry: , the number of variables.
Constraint:
.
- 4: M – INTEGERInput
On entry: , the number of general linear constraints.
Constraint:
.
- 5: A(LDA,) – REAL (KIND=nag_wp) arrayInput
-
Note: the second dimension of the array
A
must be at least
if
and at least
if
.
On entry: the
th row of
A must contain the coefficients of the
th general constraint, for
.
If
then the array
A is not referenced.
- 6: LDA – INTEGERInput
On entry: the first dimension of the array
A as declared in the (sub)program from which H02BBF is called.
Constraint:
.
- 7: BL() – REAL (KIND=nag_wp) arrayInput
- 8: BU() – REAL (KIND=nag_wp) arrayInput
On entry:
BL must contain the lower bounds and
BU the upper bounds, for all the constraints in the following order. The first
elements of each array must contain the bounds on the variables, and the next
elements the bounds for the general linear constraints (if any). To specify a nonexistent lower bound (i.e.,
), set
and to specify a nonexistent upper bound (i.e.,
), set
. To specify the
th constraint as an equality, set
, say, where
.
Constraints:
- , for ;
- if , .
- 9: INTVAR(N) – INTEGER arrayInput
On entry: indicates which are the integer variables in the problem. For example, if is an integer variable then must be set to , and otherwise.
Constraints:
- or , for ;
- for at least one value of .
- 10: CVEC(N) – REAL (KIND=nag_wp) arrayInput
On entry: the coefficients of the objective function . The routine attempts to find a minimum of . If a maximum of is desired,
should be set to , for , so that the routine will find a minimum of .
- 11: MAXNOD – INTEGERInput
On entry: the maximum number of nodes that are to be searched in order to find a solution (optimum integer solution). If and , then the B&B tree search is continued until all the nodes have been investigated.
- 12: INTFST – INTEGERInput
On entry: specifies whether to terminate the B&B tree search after the first integer solution (if any) is obtained. If then the B&B tree search is terminated at node say, which contains the first integer solution. For this applies only if .
- 13: MAXDPT – INTEGERInput
On entry: the maximum depth of the B&B tree used for branch and bound.
Suggested value:
.
Constraint:
.
- 14: TOLIV – REAL (KIND=nag_wp)Input/Output
On entry: the integer feasibility tolerance; i.e., an integer variable is considered to take an integer value if its violation does not exceed
TOLIV. For example, if the integer variable
is near unity then
is considered to be integer only if
.
On exit: unchanged if on entry , else .
- 15: TOLFES – REAL (KIND=nag_wp)Input/Output
On entry: the maximum acceptable absolute violation in each constraint at a ‘feasible’ point (feasibility tolerance); i.e., a constraint is considered satisfied if its violation does not exceed
TOLFES.
On exit: unchanged if on entry , else (where is the machine precision).
- 16: BIGBND – REAL (KIND=nag_wp)Input/Output
On entry: the ‘infinite’ bound size in the definition of the problem constraints. More precisely, any upper bound greater than or equal to
BIGBND will be regarded as
and any lower bound less than or equal to
will be regarded as
.
On exit: unchanged if on entry , else .
- 17: X(N) – REAL (KIND=nag_wp) arrayInput/Output
On entry: an initial estimate of the original LP solution.
On exit: with
,
X contains a solution which will be an estimate of either the optimum integer solution or the first integer solution, depending on the value of
INTFST. If
, then
X contains a solution which will be an estimate of the best integer solution that was obtained by searching
MAXNOD nodes.
- 18: OBJMIP – REAL (KIND=nag_wp)Output
On exit: with
or
,
OBJMIP contains the value of the objective function for the IP solution.
- 19: IWORK(LIWORK) – INTEGER arrayCommunication Array
- 20: LIWORK – INTEGERInput
On entry: the dimension of the array
IWORK as declared in the (sub)program from which H02BBF is called.
Constraint:
.
- 21: RWORK(LRWORK) – REAL (KIND=nag_wp) arrayCommunication Array
- 22: LRWORK – INTEGERInput
On entry: the dimension of the array
RWORK as declared in the (sub)program from which H02BBF is called.
Constraint:
.
If
, the amounts of workspace provided and required (with
) are printed. As an alternative to computing
MAXDPT,
LIWORK and
LRWORK from the formulas given above, you may prefer to obtain appropriate values from the output of a preliminary run with the values of
MAXDPT,
LIWORK and
LRWORK set to
. If however only
LIWORK and
LRWORK are set to
, then the appropriate values of these parameters for the given value of
MAXDPT will be computed and printed unless
. In both cases H02BBF will then terminate with
.
- 23: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. 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
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if
on exit, 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).
5.1 Description of Printed Output
The level of printed output from H02BBF is controlled by you (see the description of
MSGLVL in
Section 5).
When , the summary printout at the end of execution of H02BBF includes a listing of the status of every variable and constraint. Note that default names are assigned to all variables and constraints. The following describes the printout for each variable.
Varbl |
gives the name (V) and index , for , of the variable.
|
State |
gives the state of the variable (FR if neither bound is in the working set, EQ if a fixed variable, LL if on its lower bound, UL if on its upper bound, TF if temporarily fixed at its current value). If Value lies outside the upper or lower bounds by more than the Feasibility Tolerance, State will be ++ or -- respectively. |
Value |
is the value of the variable at the final iterate. |
Lower Bound |
is the lower bound specified for the variable. (None indicates that .) Note that if , then the printed value of Lower Bound for the th variable may not be the same as that originally supplied in .
|
Upper Bound |
is the upper bound specified for the variable. (None indicates that .) Note that if , then the printed value of Upper Bound for the th variable may not be the same as that originally supplied in .
|
Lagr Mult |
is the value of the Lagrange-multiplier for the associated bound constraint. This will be zero if State is FR or TF. If is optimal, the multiplier should be non-negative if State is LL, and non-positive if State is UL. |
Residual |
is the difference between the variable Value and the nearer of its bounds and .
|
The meaning of the printout for general constraints is the same as that given above for variables, with ‘variable’ replaced by ‘constraint’, and are replaced by and respectively, and with the following change in the heading.
L Con |
gives the name (L) and index , for , of the constraint.
|
When , the summary printout at the end of every node during the execution of H02BBF is a listing of the outcome of forcing an integer variable with a noninteger value to take a value within its specified lower and upper bounds.
Node No |
is the current node number of the B&B tree being investigated. |
Parent Node |
is the parent node number of the current node. |
Obj Value |
is the final objective function value. If a node does not have a feasible solution then No Feas Soln is printed instead of the objective function value. If a node whose optimum solution exceeds the best integer solution so far is encountered (i.e., it does not pay to explore the sub-problem any further), then its objective function value is printed together with a CO (Cut Off). |
Varbl Chosen |
is the index of the integer variable chosen for branching. |
Value Before |
is the noninteger value of the integer variable chosen. |
Lower Bound |
is the lower bound value that the integer variable is allowed to take. |
Upper Bound |
is the upper bound value that the integer variable is allowed to take. |
Value After |
is the value of the integer variable after the current optimization. |
Depth |
is the depth of the B&B tree at the current node. |
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Note: H02BBF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
No feasible integer point was found, i.e., it was not possible to satisfy all the integer variables to within the integer feasibility tolerance (determined by
TOLIV). Increase
TOLIV and rerun H02BBF.
The original LP solution appears to be unbounded. This value of
IFAIL implies that a step as large as
BIGBND would have to be taken in order to continue the algorithm (see
Section 8).
No feasible point was found for the original LP problem, i.e., it was not possible to satisfy all the constraints to within the feasibility tolerance (determined by
TOLFES). If the data for the constraints are accurate only to the absolute precision
, you should ensure that the value of the feasibility tolerance is greater than
. For example, if all elements of
are of order unity and are accurate only to three decimal places, the feasibility tolerance should be at least
(see
Section 8).
The maximum number of iterations (determined by
ITMAX) was reached before normal termination occurred for the original LP problem (see
Section 8).
Not used by this routine.
-
An input parameter is invalid.
The IP solution reported is not the optimum IP solution. In other words, the B&B tree search for at least one of the branches had to be terminated since an LP sub-problem in the branch did not have a solution (see
Section 8).
The maximum depth of the B&B tree used for branch and bound (determined by
MAXDPT) is too small. Increase
MAXDPT (along with
LIWORK and/or
LRWORK if appropriate) and rerun H02BBF.
The IP solution reported is the best IP solution for the number of nodes (determined by
MAXNOD) investigated in the B&B tree.
No feasible integer point was found for the number of nodes (determined by
MAXNOD) investigated in the B&B tree.
-
Although the workspace sizes are sufficient to meet the documented restriction, they are not sufficiently large to accommodate an internal partition of the workspace that meets the requirements of the problem. Increase the workspace sizes.
It may be possible to avoid the difficulty by increasing the magnitude of the feasibility tolerance (
TOLFES) and rerunning the program. If the message recurs even after this change, see
Section 8.
7 Accuracy
H02BBF implements a numerically stable active set strategy and returns solutions that are as accurate as the condition of the problem warrants on the machine.
The original LP problem may not have an optimum solution, i.e., H02BBF terminates with
,
or
or overflow may occur. In this case, you are recommended to relax the integer restrictions of the problem and try to find the optimum LP solution by using
E04MFF/E04MFA instead.
In the B&B method, it is possible for an LP sub-problem to terminate without finding a solution. This may occur due to the number of iterations exceeding the maximum allowed. Therefore the B&B tree search for that particular branch cannot be continued. Thus the returned solution may not be optimal. (). For the second and unlikely case, a solution could not be found despite a second attempt at an LP solution.
9 Example
This example solves the integer programming problem:
maximize
subject to the bounds
and to the general constraints
where
and
are integer variables.
The initial point, which is feasible, is
and
.
The optimal solution is
and
.
Note that maximizing is equivalent to minimizing .
9.1 Program Text
Program Text (h02bbfe.f90)
9.2 Program Data
Program Data (h02bbfe.d)
9.3 Program Results
Program Results (h02bbfe.r)