PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_mip_ilp_dense (h02bb)
Purpose
nag_mip_ilp_dense (h02bb) solves ‘zero-one’, ‘general’, ‘mixed’ or ‘all’ integer programming problems using a branch and bound method. The function may also be used to find either the first integer solution or the optimum integer solution. It is not intended for large sparse problems.
Syntax
[
itmax,
toliv,
tolfes,
bigbnd,
x,
objmip,
iwork,
rwork,
ifail] = h02bb(
itmax,
msglvl,
a,
bl,
bu,
intvar,
cvec,
maxnod,
intfst,
toliv,
tolfes,
bigbnd,
x, 'n',
n, 'm',
m, 'maxdpt',
maxdpt)
[
itmax,
toliv,
tolfes,
bigbnd,
x,
objmip,
iwork,
rwork,
ifail] = nag_mip_ilp_dense(
itmax,
msglvl,
a,
bl,
bu,
intvar,
cvec,
maxnod,
intfst,
toliv,
tolfes,
bigbnd,
x, 'n',
n, 'm',
m, 'maxdpt',
maxdpt)
Description
nag_mip_ilp_dense (h02bb) 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
nag_opt_lp_solve (e04mf).
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
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
An upper bound on the number of iterations for each LP problem.
- 2:
– int64int32nag_int scalar
-
The amount of printout produced by
nag_mip_ilp_dense (h02bb).
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:
– double array
-
The first dimension of the array
a must be at least
.
The second dimension of the array
a must be at least
if
and at least
if
.
The
th row of
a must contain the coefficients of the
th general constraint, for
.
If
then the array
a is not referenced.
- 4:
– double array
- 5:
– double array
-
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 , .
- 6:
– int64int32nag_int array
-
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 .
- 7:
– double array
-
The coefficients of the objective function . The function attempts to find a minimum of . If a maximum of is desired,
should be set to , for , so that the function will find a minimum of .
- 8:
– int64int32nag_int scalar
-
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.
- 9:
– int64int32nag_int scalar
-
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 .
- 10:
– double scalar
-
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
.
- 11:
– double scalar
-
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.
- 12:
– double scalar
-
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
.
- 13:
– double array
-
An initial estimate of the original LP solution.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
cvec,
x,
intvar. (An error is raised if these dimensions are not equal.)
, the number of variables.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
a.
, the number of general linear constraints.
Constraint:
.
- 3:
– int64int32nag_int scalar
Default:
The maximum depth of the B&B tree used for branch and bound.
Constraint:
.
Output Parameters
- 1:
– int64int32nag_int scalar
-
Unchanged if on entry , else .
- 2:
– double scalar
-
Unchanged if on entry , else .
- 3:
– double scalar
-
Unchanged if on entry
, else
(where
is the
machine precision).
- 4:
– double scalar
-
Unchanged if on entry , else .
- 5:
– double array
-
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.
- 6:
– double scalar
-
With
or
,
objmip contains the value of the objective function for the IP solution.
- 7:
– int64int32nag_int array
-
- 8:
– double array
-
- 9:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Note: nag_mip_ilp_dense (h02bb) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
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
nag_mip_ilp_dense (h02bb).
-
-
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
Further Comments).
-
-
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
Further Comments).
-
-
The maximum number of iterations (determined by
itmax) was reached before normal termination occurred for the original LP problem (see
Further Comments).
-
-
Not used by this function.
-
-
An input argument is invalid.
- W
-
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
Further Comments).
-
-
The maximum depth of the B&B tree used for branch and bound (determined by
maxdpt) is too small. Increase
maxdpt and rerun
nag_mip_ilp_dense (h02bb).
- W
-
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.
-
-
The maximum depth of the B&B tree used for branch and bound (determined by
maxdpt) is too small. Increase
maxdpt and rerun
nag_mip_ilp_dense (h02bb).
-
-
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
Further Comments.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
nag_mip_ilp_dense (h02bb) implements a numerically stable active set strategy and returns solutions that are as accurate as the condition of the problem warrants on the machine.
Further Comments
The original LP problem may not have an optimum solution, i.e.,
nag_mip_ilp_dense (h02bb) 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
nag_opt_lp_solve (e04mf) 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.
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 .
Open in the MATLAB editor:
h02bb_example
function h02bb_example
fprintf('h02bb example results\n\n');
cvec = [-3; -4];
a = [ 2, 5;
2, -2;
3, 2];
big = 1e+20;
bl = [ 0; 0; -big; -big; 5];
bu = [big; big; 15; 5; big];
intvar = int64([1;1]);
itmax = int64(0);
msglvl = int64(1);
maxnod = int64(0);
intfst = int64(0);
toliv = 0;
tolfes = 0;
bigbnd = big;
x = [1; 1];
[itmax, toliv, tolfes, bigbnd, x, objmip, iwork, rwork, ifail] = ...
h02bb(...
itmax, msglvl, a, bl, bu, intvar, cvec, maxnod, intfst, toliv, ...
tolfes, bigbnd, x, 'maxdpt', int64(4));
h02bb example results
*** IP solver
Parameters
----------
Linear constraints...... 3 First integer solution.. OFF
Variables............... 2 Max depth of the tree... 4
Feasibility tolerance... 1.05E-08 Print level............. 1
Infinite bound size..... 1.00E+20 EPS (machine precision). 1.11E-16
Integer feasibility tol. 1.00E-05 Iteration limit......... 50
Max number of nodes..... NONE
** Workspace provided with MAXDPT = 4: LRWORK = 84 LIWORK = 137
** Workspace required with MAXDPT = 4: LRWORK = 84 LIWORK = 137
Total of 9 nodes investigated.
Exit IP solver - Optimum IP solution found.
Final IP objective value = -14.00000
Varbl State Value Lower Bound Upper Bound Lagr Mult Residual
V 1 UL 2.00000 0.00000 2.00000 -3.000 0.000
V 2 EQ 2.00000 2.00000 2.00000 -4.000 0.000
L Con State Value Lower Bound Upper Bound Lagr Mult Residual
L 1 FR 14.0000 None 15.0000 0.000 1.000
L 2 FR 0.00000 None 5.00000 0.000 5.000
L 3 FR 10.0000 5.00000 None 0.000 5.000
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015