h02bbc solves ‘zero-one’, ‘general’, ‘mixed’ or ‘all’ integer linear and quadratic 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.
The function may be called by the names: h02bbc, nag_mip_ilp_dense or nag_ip_bb.
3Description
h02bbc is capable of solving certain types of integer programming (IP) problems using a branch and bound (BB) method, see Taha (1987). In order to describe these types of integer programs and to briefly state the BB method, we define the following problem.
(1)
where is an matrix and may be specified in a variety of ways depending upon the particular problem to be solved. The available forms for are listed in Table 1 below. For the moment, however, we assume that so that (1) is a Linear Programming (LP) problem.
If, in (1), it is required that some (or all) of 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 0-1 values (i.e., and ) then the integer program is of type mixed (or all) zero-one IP problem. h02bbc does not treat the all integer or zero-one cases specially;, therefore, since the mixed integer general IP case is the most general, we shall refer to (1), together with whatever integrality restrictions are applied, as a mixed integer linear programming (MILP) problem, with the assumption that the special cases are included in this.
The BB method applies directly to these integer programs. The general idea of BB is to solve the problem without the integrality restrictions as an LP problem (first or root node). If in the optimal solution an integer variable takes a non-integer value , two LP sub-problems or nodes 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. The algorithm is described in more detail in Section 12.
The same method may also be applied when the objective function takes other forms. An important assumption for the method to be theoretically valid is that each sub-problem is solved to global optimality. This is the case when, for example, is a quadratic function which has a positive (semi-)definite Hessian. For such the sub-problems of the BB search are Quadratic Programming (QP) problems, which can, in principle, be solved to global optimality. With a quadratic objective function, the problem becomes a mixed integer quadratic programming (MIQP) problem.
h02bbc is able to solve problems in which is a linear or quadratic function, defined in a variety of ways as described in Table 1 below. The sub-problems are solved using the algorithm of e04nfc.
Table 1
Problem Type
Matrix
MILP
Not applicable
MIQP1
symmetric
MIQP2
symmetric
MIQP3
upper trapezoidal
MIQP4
upper trapezoidal
3.1Suitability of BB Method for MIQP Problems
The BB method is applicable to an IP problem whenever the global optimum may reliably be found for each sub-problem, and this is theoretically true for an MILP problem. However, this may not be true for an MIQP problem in which the Hessian is not positive (semi-)definite; in such a case the sub-problems may have solutions which are locally but not globally optimal and, in general, it is not possible to ensure that a QP sub-problem solver will always find the global optimum when local optima are present. For problems of type MIQP3 and MIQP4, it is a consequence of the way the Hessian is defined that it must be positive (semi-)definite, but no such guarantee holds for problems of type MIQP1 or MIQP2.
h02bbc does not check if the Hessian is positive (semi-)definite. This provides for the possibility that you have special knowledge about the problem, for example that an indefinite Hessian is positive (semi-)definite on the feasible region defined by the problem constraints (in which case the problem has no local optima). Alternatively, you may wish to use h02bbc as a heuristic, with the understanding that if a solution is obtained, it may not be the true global optimum of the MIQP problem, or that no solution might be found even though one does exist. If you wish to check whether the Hessian of a problem of type MIQP1 or MIQP2 is positive (semi-)definite, and, therefore, whether any solution obtained can be relied upon, one way this may be achieved is to analyse its eigenvalues (for example using f08fac): the Hessian is positive semidefinite if and only if all of its eigenvalues are .
3.2Maximization Problems
h02bbc attempts to solve a minimization problem of the form (1) (together with the integrality requirements). In principle, a maximization problem can be solved by minimizing , i.e., reversing the sign of the objective function. This is always valid in the case of an MILP problem, as long as the resulting problem is not unbounded, and simply involves reversing the signs of the coefficients of (the elements of the input argument array cvec, see Section 4). In the case of an MIQP problem some care must be taken since reversing the sign of a positive (semi-)definite Hessian will make it negative (semi-)definite and vice-versa. Recall that the theoretical validity of the BB method, applied to an MIQP problem, effectively requires that the Hessian be positive (semi-)definite on the feasible region defined by the problem constraints.
Assuming these considerations to be taken into account, a maximization problem of type MIQP1 can be solved by reversing the signs of the elements of ; type MIQP2 problems require the signs of the coefficients of to be reversed also. Problem types MIQP3 and MIQP4 have a positive (semi-)definite Hessian by definition, so it would not normally make sense to solve these as maximization problems. Hence, h02bbc does not allow you to reverse the sign of the quadratic objective term for these problem types.
4References
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. Programming4 155–170
Taha H A (1987) Operations Research: An Introduction Macmillan, New York
Williams H P (1993) Model Building in Mathematical Programming (3rd Edition) Wiley
5Arguments
1: – IntegerInput
On entry: , the number of variables.
Constraint:
.
2: – IntegerInput
On entry: , the number of general linear constraints.
Constraint:
.
3: – const doubleInput
Note: the th element of the matrix is stored in .
On entry: the th row of a must contain the coefficients of the th general linear constraint, for .
If , the array a is not referenced and may be NULL.
4: – IntegerInput
On entry: the stride separating matrix column elements in the array a.
Constraint:
if ,
5: – const doubleInput
6: – const doubleInput
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 , where is one of the optional parameters (default value , see Section 11.2). To specify the th constraint as an equality, set , say, where .
Constraint:
, for .
7: – const Nag_BooleanInput
On entry: indicates which are the integer variables in the problem. For example, if is an integer variable then must be set to , and 0 otherwise. The degenerate case, in which all elements of intvar are zero, is allowed. In this case, h02bbc solves a single LP or QP problem (depending on the problem type as specified by the optional parameter , see Section 11.2).
Constraint:
or , for .
8: – const doubleInput
On entry: the coefficients of the explicit linear term of the objective function when the problem is of type MILP, MIQP2 or MIQP4. The default problem type is MILP; other problem types can be specified using the optional parameter , see Section 11.2.
If the problem is of type MIQP1 or MIQP3, cvec is not referenced and may be NULL.
9: – const doubleInput
On entry: h may be used to store the quadratic term of the MIQP objective function if desired. The elements of h are accessed only by the function qphess; thus, h is not accessed if the problem is of the type MILP (the default) and may be NULL.
The number of rows of h is denoted by and its default value is equal to . (The optional parameter may be used to specify a value of ; see Section 11.2).
If the problem is of type MIQP1 or MIQP2, the first rows and columns of h must contain the leading rows and columns of the symmetric Hessian matrix. Only the diagonal and upper triangular elements of the leading rows and columns of h are referenced. The remaining elements need not be assigned.
For problems of type MIQP3 and MIQP4, the first rows of h must contain an upper trapezoidal factor of the Hessian matrix. The factor need not be of full rank, i.e., some of the diagonals may be zero. However, as a general rule, the larger the dimension of the leading nonsingular sub-matrix of , the fewer iterations will be required. Elements outside the upper trapezoidal part of the first rows of are assumed to be zero and need not be assigned.
In some cases, you need not use h to store explicitly (see the specification of function qphess).
10: – IntegerInput
On entry: the stride separating matrix column elements in the array h.
Constraint:
or at least the value of the optional parameter if it is set. This constraint is enforced only for problems of type MIQP in which the qphess argument is null.
11: – function, supplied by the userExternal Function
In general, you need not provide a version of qphess, because a ‘default’ function is included in the NAG Library. If the default function is required then the NAG defined null function pointer, NULLFN, should be supplied in the call to h02bbc. The algorithm of h02bbc requires only the product of and a vector ; and in some cases you may obtain increased efficiency by providing a version of qphess that avoids the need to define the elements of the matrix explicitly.
qphess is not referenced for problems of type MILP (the default), in which case qphess should be replaced by NULLFN.
On entry: jthcol specifies whether or not the vector is a column of the identity matrix.
The vector is the th column of the identity matrix, and hence is the th column of , which can sometimes be computed very efficiently and qphess may be coded to take advantage of this. However special code is not necessary because is always stored explicitly in the array x.
has no special form.
3: – const doubleInput
On entry: the matrix of the QP objective function. The matrix element is contained in for and . In some situations, it may be desirable to compute without accessing h – for example, if is sparse or has special structure. (This is illustrated in the function qphess in Section 10.) The arguments h and tdh may then refer to any convenient array.
4: – IntegerInput
On entry: the stride separating matrix column elements in the array h.
5: – const doubleInput
On entry: the vector .
6: – doubleOutput
On exit: the product .
7: – Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to qphess.
flag – IntegerInput/Output
On entry: qphess is called with set to a non-negative number.
On exit: if qphess resets to some negative number then h02bbc will terminate immediately with the error indicator NE_USER_STOP. If fail is supplied to h02bbc, will be set to your setting of .
first – Nag_BooleanInput
On entry: will be set to Nag_TRUE on the first call to qphess and Nag_FALSE for all subsequent calls.
nf – IntegerInput
On entry: the number of calls made to qphess including the current one.
user – double *
iuser – Integer *
p – Pointer
The type Pointer will be void * with a C compiler that defines void * and char * otherwise.
Before calling h02bbc these pointers may be allocated memory and initialized with various quantities for use by qphess when called from h02bbc.
Note:qphess should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by h02bbc. If your code inadvertently does return any NaNs or infinities, h02bbc is likely to produce unexpected results.
Note: qphess should be tested separately before being used in conjunction with h02bbc. The input arrays h and x must not be changed by qphess.
12: – doubleInput/Output
On entry: an initial estimate of the solution of the first sub-problem (the problem as described in Section 3).
If optional parameter (which is not the default value), then the initial values in x of the integer variables influence the branching procedure in the BB algorithm. Typically, an estimate of the values of the integer variables in the IP solution would be provided in this case. See Section 11.2 for details.
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 optional parameter . If
,NW_MIP_MAX_DEPTH_INT_SOL,
NW_MIP_MAX_ITER_INT_SOL,
or
NE_MIP_HESS_TOO_BIG_INT_SOL
then x contains a solution which may not be the optimal IP solution because h02bbc was unable to investigate all of the nodes. See Section 6 for more details.
On entry/exit: a pointer to a structure of type Nag_H02_Opt whose members are optional parameters for h02bbc. These structure members offer the means of adjusting some of the argument values of the algorithm and on output will supply further details of the results. A description of the members of options is given below in Section 11.
The options structure also allows names to be assigned to the variables and constraints of the problem, which are then used in solution output. In particular, if the problem is defined by an MPSX file, the function h02buc may be used to read the file, and to store the variable and constraint names in options for use by h02bbc.
If any of these optional parameters are required then the structure options should be declared and initialized by a call to h02xxc and supplied as an argument to h02bbc. However, if the optional parameters are not required the NAG defined null pointer, H02_DEFAULT, can be used in the function call.
15: – Nag_Comm *Input/Output
Note:comm is a NAG defined type (see Section 3.1.1 in the Introduction to the NAG Library CL Interface).
On entry/exit: structure containing pointers for communication to the user-supplied function, qphess, and the optional user-defined printing function. See the description of qphess and Section 11.3.1 for details. If you do not need to make use of this communication feature the null pointer NAGCOMM_NULL may be used in the call to h02bbc; comm will then be declared internally for use in calls to user-supplied functions.
16: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
NE_2_INT_ARG_LT
On entry, while . These arguments must satisfy .
On entry, while . These arguments must satisfy .
On entry, while . These arguments must satisfy .
NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument had an illegal value.
On entry, argument had an illegal value.
On entry, argument had an illegal value.
On entry, argument had an illegal value.
On entry, argument had an illegal value.
NE_BOUND
The lower bound for variable (array element ) is greater than the upper bound.
NE_BOUND_LCON
The lower bound for linear constraint (array element ) is greater than the upper bound.
NE_CVEC_NULL
but argument NULL.
NE_H_NULL
, qphess is NULL but argument h is also NULL. If the default function for qphess is to be used for this problem then an array must be supplied in argument h.
NE_INT_ARG_LT
On entry, .
Constraint: .
On entry, .
Constraint: .
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call
and any array sizes. If the call is correct then please contact NAG for
assistance.
NE_INVALID_INT_RANGE_1
Value given to is not valid. Correct range is .
Value given to is not valid. Correct range is .
Value given to is not valid. Correct range is .
Value given to is not valid. Correct range is .
Value given to is not valid. Correct range is or .
NE_INVALID_REAL_RANGE_F
Value given to is not valid. Correct range is .
Value given to is not valid. Correct range is .
Value given to is not valid. Correct range is .
NE_INVALID_REAL_RANGE_FF
Value given to is not valid. Correct range is .
Value given to is not valid. Correct range is .
NE_MIP_HESS_TOO_BIG_INT_SOL
Reduced Hessian exceeds assigned dimension during BB tree search. . An IP solution was found.
This error can only occur with MIQP problems. Whilst attempting to solve a node during the BB tree search, the QP algorithm needed to expand the reduced Hessian when it was already at its maximum dimension, as specified by the optional parameter . No further nodes were examined. An IP solution was found but it may not be optimal.
The value of the argument is too small. Rerun h02bbc with a larger value. The IP objective obtained should be assigned to to aid the BB tree search in the repeated run.
NE_MIP_HESS_TOO_BIG_NO_INT_SOL
Reduced Hessian exceeds assigned dimension during BB tree search. . No IP solution was found.
This error can only occur with MIQP problems. Whilst attempting to solve a node during the BB tree search, the QP algorithm needed to expand the reduced Hessian when it was already at its maximum dimension, as specified by the optional parameter . No further nodes were examined. No IP solution was found amongst the nodes examined.
The value of the argument is too small. Rerun h02bbc with a larger value.
NE_MIP_ROOT_HESS_TOO_BIG
Reduced Hessian exceeds assigned dimension at root node. .
This error can only occur with MIQP problems. Whilst attempting to solve the root node, the QP algorithm needed to expand the reduced Hessian when it was already at its maximum dimension, as specified by the optional parameter .
The value of the argument is too small. Rerun h02bbc with a larger value.
NE_MIP_ROOT_INFEAS
The root node of the BB tree is infeasible.
A feasible point could not be found for the original LP or QP problem, i.e., it was not possible to satisfy all the constraints to within the feasibility tolerance (determined by optional parameter ). 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 9).
NE_MIP_ROOT_MAX_ITER
The maximum number of iterations (determined by optional parameter ) was reached before normal termination occurred for the original LP or QP problem (see Section 9).
The maximum number of iterations, , was performed before normal termination occurred for the root node of the BB tree.
NE_MIP_ROOT_UNBOUNDED
The root node of the BB tree appears to be unbounded.
See Section 12 for advice.
NE_NAME_TOO_LONG
The character string pointed to by is too long. It should be no longer than 8 characters.
NE_NOT_APPEND_FILE
Cannot open file for appending.
NE_NOT_CLOSE_FILE
Cannot close file .
NE_OPT_NOT_INIT
Options structure not initialized.
NE_PRIORITY_NULL
but is NULL.
NE_USER_STOP
User requested termination, user flag value .
This exit occurs if you set to a negative value in qphess. If fail is supplied the value of will be the same as your setting of .
NE_WRITE_ERROR
Error occurred when writing to file .
NW_MIP_MAX_DEPTH_INT_SOL
An IP solution was found but the search has been terminated because the maximum allowed tree depth (as determined by optional parameter ) has been reached.
Increase and rerun h02bbc. The IP objective obtained should be assigned to to aid the BB tree search in the repeated run.
NW_MIP_MAX_DEPTH_NO_INT_SOL
The maximum allowed tree depth (as determined by optional parameter ) has been reached before any integer solution has been found.
Increase and rerun h02bbc.
NW_MIP_MAX_ITER_INT_SOL
The IP solution found may not be the optimum. The search had to be terminated in at least one branch of the BB tree because the iteration limit was reached.
It was not possible to solve at least one node of the BB tree, which means that the tree search could not be completed. An IP solution was found but a better one may be present in the unsearched portion of the tree. See Section 9 for more information.
NW_MIP_MAX_ITER_NO_INT_SOL
No IP solution was found but the search had to be terminated in at least one branch of the BB tree because the iteration limit was reached.
It was not possible to solve at least one node of the BB tree, which means that the tree search could not be completed. No IP solution was found but one may be present in the unsearched portion of the tree. See Section 9 for more information.
NW_MIP_MAX_NODES_INT_SOL
The IP solution found is the best for the number of nodes (as determined by optional parameter ) investigated in the BB tree.
Increase and rerun h02bbc. The IP objective obtained should be assigned to to aid the BB tree search in the repeated run.
NW_MIP_MAX_NODES_NO_INT_SOL
No integer solution was found for the number of nodes (as determined by ) investigated in the BB tree.
Increase and rerun h02bbc.
NW_MIP_NO_INT_SOL
No feasible IP solution was found, i.e., it was not possible to satisfy all the integer variables to within optional parameter .
It may be appropriate to increase and rerun h02bbc.
NW_OVERFLOW_WARN
Serious ill-conditioning in the working set after adding constraint . Overflow may occur in subsequent iterations.
If overflow occurs preceded by this warning then serious ill-conditioning has probably occurred in the working set when adding a constraint during the solution of a node in the BB tree. It may be possible to avoid the difficulty by increasing the magnitude of the optional parameter and rerunning the program. If the problem recurs even after this change, see Section 9.
7Accuracy
h02bbc implements a numerically stable active set strategy and returns solutions that are as accurate as the condition of the problem warrants on the machine.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
h02bbc is not threaded in any implementation.
9Further Comments
The root node may not have an optimum solution, i.e., h02bbc terminates with , NE_MIP_ROOT_INFEAS, NE_MIP_ROOT_MAX_ITER, NE_MIP_ROOT_HESS_TOO_BIG 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 or QP solution by using e04mfc (for LP) or e04nfc (for QP) instead.
In the BB method, it is possible for a node to terminate without finding a solution. For example, this may occur due to the number of iterations exceeding the maximum allowed. Therefore, the BB tree search for that particular branch cannot be continued and if an IP solution is found, the final solution reported is not necessarily the optimum IP solution (). Similarly, if no IP solution is found, it is not necessarily the case that no IP solution exists ().
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 energy requirements, the problem is to find the cheapest combination. This gives rise to the following problem:
minimize
where
The rows of correspond to energy, protein and calcium and the columns of 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 decreasing the energy required to 1970 units. The example involves a number of calls to h02bbc illustrating the use of some of the optional parameters.
The data is read and the options structure initialized. All options are left at their default values except: the member is assigned to the local char * array, crnames, the elements of which point to strings containing the variable and constraint names; and .
h02bbc is called to obtain the optimal IP solution of the problem, and then the lower bound on the minimum energy constraint (i.e., the first general constraint) is reduced. Since the problem is now less constrained than the original IP problem, the objective function value returned in objf from the original problem provides an upper bound for the objective of the optimal IP solution of the modified problem. Optional parameter is initialized to this value with a small number added to ensure that it is a strict upper bound on the optimal objective of the modified problem. Also, the optional parameter to modify the way h02bbc selects nodes during the tree search. The results from this show that the value assigned to allow a number of nodes to be cut off (indicated by CO in the printout) before the first IP solution is found.
Next, the effect of supplying branching directions is illustrated. The optional parameter to instruct h02bbc to branch according to the values of the integer variables provided in the initial x argument. In this case x contains the optimal IP solution from the last call of h02bbc. The results show that these values allow h02bbc to find and confirm the optimal IP solution quickly.
The final two calls to h02bbc show its use in solving an MIQP problem. First, h02bbc is called with the intvar argument set to an array intvar2 which specifies all variables to be non-integer. This solves the root LP problem of the adjusted diet problem (as solved in the previous three calls to h02bbc). Let be the solution to this LP problem. Then, retaining the same constraints, the linear objective is replaced by the quadratic objective
which measures, to within a constant, the sum of squares deviation of from . That is, the problem is to find the IP solution which most closely approximates (in the least squares sense) the LP solution. Before solving this problem, the memory assigned to the pointers in the options structure is freed by h02xzc and the structure is reinitialized by h02xzc. Then optional parameter and is assigned as before; otherwise, default options are used. The quadratic term of the objective is supplied via the function qphess which does not require explicit storage for the matrix . h02bbc is called to solve the MIQP problem, and finally h02xzc is called to free the memory in options.
A number of optional input and output arguments to h02bbc are available through the structure argument options, type Nag_H02_Opt. An argument may be selected by assigning an appropriate value to the relevant structure member; those arguments not selected will be assigned default values. If no use is to be made of any of the optional parameters you should use the NAG defined null pointer, H02_DEFAULT, in place of options when calling h02bbc the default settings will then be used for all arguments.
Before assigning values to options directly the structure must be initialized by a call to the function h02xxc. Values may then be assigned to the structure members in the normal C manner.
Option settings may also be read from a text file using the function h02xyc in which case initialization of the options structure will be performed automatically if not already done. Any subsequent direct assignment to the options structure must not be preceded by initialization.
If assignment of functions and memory to pointers in the options structure is required, then this must be done directly in the calling program; they cannot be assigned using h02xyc.
11.1Optional Parameter Checklist and Default Values
For easy reference, the following list shows the members of options which are valid for h02bbc together with their default values where relevant. The number is a generic notation for machine precision (see X02AJC).
On entry: specifies the type of objective function to be minimized during the optimality phase. The following are the five possible values of and the size of the arrays h and cvec that are required to define the objective function:
On entry: the limit on the number of iterations for each node.
Constraint:
.
max_nodes – Integer
Default
On entry: the maximum number of nodes that are to be searched in order to find a solution (optimum integer solution). If is not set, or is set equal to the symbol ALL_NODES, and the optional parameter (the default), then the BB tree search is continued until all the nodes have been investigated.
Constraints:
or;
.
first_soln – Nag_Boolean
Default
On entry: specifies whether to terminate the BB tree search after the first integer solution (if any) is obtained. If then the BB tree search is terminated at node say, which contains the first integer solution. For optional parameter ALL_NODES this applies only if .
max_depth – Integer
Default
On entry: the maximum depth of the BB tree used for branch and bound.
Constraint:
.
int_tol – double
Default
On entry: the integer feasibility tolerance; i.e., an integer variable is considered to take an integer value if its violation does not exceed . For example, if the integer variable is of order unity then is considered to be integer if .
Constraint:
.
int_obj_bound – double
Default
On entry: specifies an initial bound on the optimum integer solution. You should supply a value for this argument only if a valid strict upper bound for the IP problem is available. Supplying too small a value will result in h02bbc not finding an IP solution. If a valid value is provided then this may help to reduce the number of nodes searched in the BB tree (see Section 12.3).
The default value, , is equivalent to no such bound being available.
soln_tol – double
Default
On entry: specifies a tolerance on the optimal IP solution, i.e., an IP solution returned by h02bbc as optimal may have an objective function value which is as much as greater than that associated with the true optimal IP solution. By setting to a nonzero value, the size of the BB search tree may be reduced at the expense of obtaining a (possibly) inferior solution (see Section 12.3).
This argument only takes effect after the first IP solution has been found. It, therefore, has no effect if optional parameter and need not be taken into account when setting optional parameter .
Constraint:
.
nodsel – Nag_Node_Selection
Default
On entry: specifies how nodes are selected during the BB tree search (see Section 12.2). The selection is made from those nodes which are still ‘active’, i.e., those which either have not yet been solved, or which have been solved but not yet branched from. If the node selected has not been solved then it will be solved next; otherwise, it is branched from and one of the resulting child nodes will be solved next. In the latter case, the choice of which child node is solved first is determined by the value of optional parameter (see below). The possible values of and their meanings are described below.
selects the node with smallest objective function value. A node which has not yet been solved is assigned its parent's objective function value as the basis for its selection.
selects the deepest node in the BB tree. When selecting a node for branching and there is more than one candidate at the deepest level, preference is given to the node which was solved earliest. This type of node selection is affected by the value of (see below).
selects the shallowest node in the tree. This has the effect of searching across the tree (rather than down as for ).
as until the first integer solution is found and as thereafter.
as until the first integer solution is found and as thereafter.
Constraint:
, , , or .
varsel – Nag_Var_Selection
Default
On entry: specifies how h02bbc selects the variable to branch on, when an unbranched node has been chosen according to optional parameter . Let denote the solution associated with the selected node. Integer variables are scanned in order of their index in , and any which are integral to within the optional tolerance argument are ignored. The following values of are available.
select the first integer variable such that is non-integer.
select the integer variable such that is nearest to , where denotes the integer part of . That is, is the integer variable such that is farthest from having an integer value.
branch on the integer variable selected according to the set of priorities provided in optional parameter (see below).
Constraint:
, or .
branch_dir – Nag_Branch_Direction
Default
On entry: specifies which node to solve first when two nodes are created by a branching operation. This option is unlikely to have much effect when optional parameter or , since the overall order in which parts of the tree are examined will remain the same. However, when , will influence the path taken by h02bbc as the tree is descended. Similarly, this argument will affect the initial deep search when or . The following values of are available.
solve the ‘left’ node first, i.e., that which was formed by reducing the upper bound on the branching variable.
solve the ‘right’ node first, i.e., that which was formed by increasing the lower bound on the branching variable.
branch according to the initial values of the integer variables, as supplied in the argument x to h02bbc. Let be the initial solution as supplied by you, and let be the index of the integer variable currently being branched on. Then if is the nearest integer to which satisfies the initial bounds on , h02bbc will first branch towards and solve this sub-problem. This value of would be appropriate, in conjunction with a deep search (as defined by ), if you can provide in x a good estimate of an integer solution to the IP problem.
Constraint:
, or .
priority – double
Default NULL
On entry: if then for each integer variable , must contain the priority the variable should be given when h02bbc selects a variable to branch on ( is an integer variable if , for ). For example, if and are integer variables and , then variable will be selected in preference to . Variables with equal priorities are selected according to their indices (i.e., is selected if and ).
With some problems of type MILP, setting to cvec might be effective, since the objective coefficient of a variable could be regarded as a measure of the importance of the variable in the problem.
If is not an integer variable (i.e., ), is not referenced. If optional parameter then is not referenced.
feas_tol – double
Default
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 .
Constraint:
.
inf_bound – double
Default
On entry: defines the ‘infinite’ bound in the definition of the problem constraints. Any upper bound greater than or equal to will be regarded as (and similarly any lower bound less than or equal to will be regarded as ).
Constraint:
.
rank_tol – double
Default
This argument is not used for problems of type MILP.
On entry: enables you to control the condition number of the triangular matrix factor which arises in solving a QP subproblem (see Section 12 in e04nfc for details). If denotes the function , the dimension of is defined to be smallest index such that .
On entry: specifies , the number of rows of the quadratic term of the QP objective function. For the default MILP problem type, is not used and its value is set to zero. For MIQP problem types, the default value of is n, the number of variables. However, a value of less than n is appropriate for problems of type MIQP3 or MIQP4 when is an upper trapezoidal matrix with rows. Similarly, may be used to define the dimension of a leading block of nonzeros in the Hessian matrices for problems of type MIQP1 or MIQP2, in which case the last rows and columns of are assumed to be zero.
Constraint:
.
max_df – Integer
Default
On entry: places a limit on the storage allocated for the triangular factor of the reduced Hessian of QP sub-problems (see Section 12 in e04nfc for details). Ideally, should be set slightly larger than the value of (the number of rows and columns of ) expected at the solution. It need not be larger than , where is the number of variables that appear nonlinearly in the quadratic objective function. For many problems it can be much smaller than .
For quadratic problems, a minimizer may lie on any number of constraints, so that may vary between and . The default value is, therefore, normally n but if the optional parameter is specified then the default value of is set to the value in .
Constraint:
.
crnames – char **
Default NULL
On entry: if is not NULL then it must point to an array of character strings, with maximum string length , containing the names of the variables and constraints of the problem. Thus, contains the name of the th variable, , and contains the names of the th constraint, . If supplied, the names are used in the solution output (see Section 11.3 and Section 11.3).
If a problem is defined by an MPSX file, it may be read by calling h02buc prior to calling h02bbc. In this case, h02buc may optionally be used to allocate memory to and to read the variable and constraint names defined in the MPSX file into . In this case, the memory freeing function h02xzc should be used to free the memory pointed to by on return from h02bbc. You should not use the standard C function free() for this purpose.
lower – double
Default
On entry: values of memory will be automatically allocated by h02bbc and this is the recommended method of use of . However you may supply memory from the calling program.
On exit: the lower bounds imposed at the point returned in x. If no IP solution was found contains the same bounds as supplied in bl. 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).
upper – double
Default
On entry: values of memory will be automatically allocated by h02bbc and this is the recommended method of use of . However you may supply memory from the calling program.
On exit: the upper bounds imposed at the point returned in x. If no IP solution was found contains the same bounds as supplied in bu. 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).
state – Integer
Default
On entry: values of memory will be automatically allocated by h02bbc and this is the recommended method of use of . However you may supply memory from the calling program.
On exit: the status of the constraints in the working set at the point returned in x. The significance of each possible value of is as follows:
Meaning
The constraint violates its lower bound by more than the feasibility tolerance.
The constraint violates its upper bound by more than the feasibility tolerance.
The constraint is satisfied to within the feasibility tolerance, but is not in the working set.
This inequality constraint is included in the working set at its lower bound.
This inequality constraint is included in the working set at its upper bound.
This constraint is included in the working set as an equality. This value of can occur only when .
This corresponds to optimality being declared with being temporarily fixed at its current value. This value of can only occur if the optimal solution is not unique.
lambda – double
Default
On entry: values of memory will be automatically allocated by h02bbc and this is the recommended method of use of . However you may supply memory from the calling program.
On exit: the values of the Lagrange multipliers for each constraint with respect to the current working set at the point returned in x. 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). If , is zero. If is optimal, should be non-negative if , non-positive if and zero if .
11.3Description of Printed Output
The level of printed output can be controlled with the structure members and (see Section 11.2).
If then the argument values to h02bbc are listed, whereas the printout of results is governed by the value of . The default of provides intermediate and final results.
If , or , the following line of summary output is produced at the end of every node. It gives the outcome of forcing an integer variable with a non-integer value to take a value within its specified lower and upper bounds.
Node No
is the current node number of the BB 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 Infeasible 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 non-integer 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 BB tree at the current node.
If or , the root node solution is output before the BB search is commenced. If , , or the final IP solution or, if none was found, the root node solution is output.
The following describes the printout for each variable and constraint for both root node and final IP solution printout.
Varbl
gives the name of variable , for . If an options structure is supplied to h02bbc, and the member is assigned to an array of variable and constraint names (see Section 11.2 for details), the name supplied in is assigned to the th variable. Otherwise, a default name is assigned to 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 iteration.
Lower Bound
is the lower bound specified for the variable. (None indicates that , where is the optional parameter.) For root node printout, ; for IP solution printout, is the lower bound imposed at the node which provided the IP solution.
Upper Bound
is the upper bound specified for the variable. (None indicates that .) For root node printout, ; for IP solution printout, is the upper bound imposed at the node which provided the IP solution.
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’, replaced by , replaced by , and replaced by and respectively, and with the following change in the heading:
Constr
gives the name of constraint , . If an options structure is supplied to h02bbc, and the member is assigned to an array of variable and constraint names (see Section 11.2 for details), the name supplied in is assigned to the constraint. Otherwise, a default name is assigned to the constraint.
Numerical values are output with a fixed number of digits; they are not guaranteed to be accurate to this precision.
If then printout will be suppressed; you can print the final solution when h02bbc returns to the calling program.
11.3.1Output of results via a user-defined printing function
You may also specify your own print function for output of iteration results and the final solution by use of the function pointer, which has prototype
This section may be skipped if you wish to use the default printing facilities.
When a user-defined function is assigned to this will be called in preference to the internal print function of h02bbc. Calls to the user-defined function are again controlled by means of the member. Information is provided through st and comm, the two structure arguments to .
If then the results from the most recently solved node are provided through st. Note that will be called with only if , or . The following members of st are set:
node_num – Integer
The current node number of the BB tree being investigated.
parent_node – Integer
The parent node number of the current node.
node_status – Nag_NodeStatus
The status of the current node. The possible values of and their meanings are as follows:
the node has been solved but the branch cannot yet be eliminated from the search.
an integer solution was found at this node. There is no need to search this branch further.
the objective value exceeds the upper bound on the optimal IP solution. There is no need to search this branch further.
the problem was infeasible at this node. There is no need to search this branch further.
the iteration limit was exceeded at this node. The search has to be terminated prematurely for this branch.
The index in of the variable chosen for branching.
x_lo – double
The lower bound on the branching variable.
x_up – double
The upper bound on the branching variable.
x_before – double
The non-integer value of the branching variable before the node was solved.
x_after – double
The value of the branching variable after the node was solved.
depth – Integer
The depth of the BB tree at the current node.
If then the solution of the root node is provided through st. Note that will be called with only if or . The following members of st are set:
endstate – Nag_EndState
The state of termination of the sub-problem solver at the root node. Some of these states result in immediate termination of the algorithm. If this is the case, then no valid solution is available. The other states allow the algorithm to proceed with the BB tree search. Possible values of and their correspondence, if any, to the exit value of fail from h02bbc are:
If , contains the components of the linear constraint vector, for .
state – Integer
Contains the status of the variables and general linear constraints. See Section 11.2 for a description of the possible status values.
lambda – double
Contains the values of the Lagrange multipliers.
bl – double
Contains the lower bounds on the variables.
bu – double
Contains the upper bounds on the variables.
If then the final IP solution is provided through st. Note that will be called with only if , , or . If no IP solution was found then the root node solution is available. The member of st should be examined to determine the status of the solution. The following members of st are set:
endstate – Nag_EndState
The state of termination of h02bbc. Possible values of and their correspondence to the exit value of fail are shown below.
Will be Nag_TRUE when the print function is called with the solution of the root node.
node_prt – Nag_Boolean
Will be Nag_TRUE when the print function is called with the result of the most recently solved node.
sol_prt – Nag_Boolean
Will be Nag_TRUE when the print function is called with the final solution.
user – double
iuser – Integer
p – Pointer
Pointers for communication of user information. If used they must be allocated memory either before entry to h02bbc or during a call to qphess or . The type Pointer will be void * with a C compiler that defines void * and char * otherwise.
12Further Description
This section provides further information about the BB algorithm used by h02bbc.
As outlined in Section 3, the essence of the BB algorithm is to form a ‘tree’ of sub-problems which are relatively easy to solve. The initial sub-problem, the root node of the tree, is a relaxation of the IP problem, in that it is the IP problem with the integer restrictions removed. When that has been solved, two child sub-problems or nodes are formed by selecting an integer variable which in the solution to the relaxed problem takes a non-integer value , and branching on that variable, i.e., imposing for one node and for the other, where denotes the integer part of . One of these nodes is then solved. At this point, either a further branching operation is carried out from the node just solved, creating two new unsolved nodes (one of which is solved next), or the remaining unsolved child node is solved. Continuing in this way, the tree is developed – at each stage selecting an unsolved node to solve, or a solved node to branch from. The selection of the node and, in the case of a branching operation, the selection of the variable to branch on, is considered further in Section 12.2.
The mechanism for forming the nodes on branching simply involves adjusting the lower or upper bound on the branching variable. Note that as the tree is descended, each child node inherits any bound adjustments made to its parent node, and so a child node is always more constrained than its parent.
If the procedure described above is continued, eventually a child must be created for which all of its integer variables are fixed at integer values, or which is infeasible. If the latter is true then the search down that branch of the tree may be terminated since any children of that node must also be infeasible (the child is always more constrained than the parent). If the former is true then we have an integer feasible solution for the IP problem, which may or may not be the optimum integer solution. For some applications of IP, it is sufficient to obtain any integer feasible solution and the search may terminate here, but usually the search must be continued, either to find a better integer solution, or to confirm that the optimal integer solution has been found. In h02bbc the optional parameter may be set to Nag_TRUE to request termination at the first integer solution (the default value is Nag_FALSE; see Section 11.2).
Assuming that the optimal integer solution is required, the rest of the tree must be searched. The efficiency of the method relies on not having to examine every node of the tree which could, potentially, be formed by applying the procedure as described above. The method incorporates features which have the effect of eliminating certain portions of the tree from the search. As already explained, the search is terminated along a particular branch on encountering an infeasible node. Similarly, once an integer solution has been found, this can be used to eliminate parts of the search tree as follows. Suppose an integer feasible solution has been found, with an associated objective function value . Now suppose during the search of the remainder of the tree, a node is encountered, whose objective function value exceeds . In this case there is no need to examine any further down that branch of the tree since any children of that node will also have objective function values which exceed . The quantity , therefore, acts as a bound on the optimal integer solution. This bound may be refined as better integer solutions are found. Finally, if an integer solution is found before all integer variables have been fixed by the branching process, simply because the unfixed integer variables happen to have integer values at the solution of a particular node, there is again no need to search further along that branch of the tree. Termination of the search at a node, whether through finding an integer solution there, detecting infeasibility, or bounding it based on a known integer solution, is known as fathoming the node.
12.2Selection of Node and Branching Variable
Since each branching operation generates two unsolved nodes (sub-problems), at a typical stage of the algorithm there will be a number of nodes which are either unsolved or which have been solved but have not yet been branched from. Therefore, when a node has been solved there is a choice to be made as to which node should be solved next, and this will either be an existing, unsolved node, or one which will be created by a branching operation.
If a node is selected to be branched from, there is a further choice to be made and that is the integer variable to be branched on.
Within h02bbc these choices are controlled by the optional parameters , which controls node selection, and , which controls branching variable selection. The default node selection behaviour is to choose the node with lowest objective value, if it has been solved, or lowest parent objective value if it is unsolved. By default the branching variable chosen is that with the smallest index in , selected from those integer variables taking non-integer values at the solution of the sub-problem being branched from. Details of the available options are given in Section 11.2.
These choices can help to improve the efficiency of the BB algorithm since they particularly influence how quickly the first integer feasible solution is obtained and its quality. A good integer solution obtained early in the search can eliminate a large portion of the remaining tree, by means of the bounding operation described in Section 12.1). Unfortunately, there is no single strategy for making such choices which can be applied successfully to all IP problems – the best strategy is highly problem dependent and is usually obtained by experimentation.
12.3Further Reducing the Size of the BB Search Tree
In addition to considering variations in the node and variable selection strategies, you may also consider setting some other arguments to help to reduce the number of nodes searched. Recall from Section 12.1) that once the algorithm has found an IP solution, the objective function value associated with this is used as a bound to eliminate parts of the tree. Similarly, if you know from the outset a strict upper bound on the optimal solution, perhaps as a result of solving a related, more constrained problem, or obtained through analytical means, this may be supplied to h02bbc as the optional parameter . This will be used by h02bbc in the same way as a bound obtained by finding an IP solution except that it can be used to eliminate parts of the tree even before an integer solution is found.
Another argument which you might consider setting to reduce the size of the tree is . Again this is related to the bounding process, and applies when an integer solution has been found. When searching the remainder of the tree, instead of setting the bound to , the objective function value associated with the integer solution most recently found, h02bbc sets the bound to . This means that integer solutions with objective values within of any integer solution already found, cannot themselves be found. The idea here is to allow you to avoid further search for solutions which are not substantially better (as measured by ) than the best solution found so far. Of course, a sensible choice for the value of relies on your knowledge of the problem and requirements on the solution.
Further details of the optional parameters and are given in Section 11.2.
Finally, a very important factor which can have a large impact on the size of the search tree is the way the problem is modelled. Often, there is more than one way to formulate a problem as an IP model. A general aim is that the feasible region of the relaxed IP problem should be as close as possible to that of the IP problem itself. This has the effect of generating tight bounds in the BB procedure. Note that in order to achieve this aim, it may be necessary to introduce further constraints, which do not alter the IP solution but which help to reduce the feasible region of the sub-problems. This is in contrast to standard LP, for example, in which fewer constraints are generally considered to be associated with an easier problem. There is of course a balance to be struck since adding constraints to an IP problem will make the sub-problems harder to solve, despite, it is hoped, reducing the size of the tree. See Williams (1993) for more information on formulating IP models.