Note:this routine usesoptional parametersto define choices in the problem specification. If you wish to use default settings for all of the optional parameters, then this routine need not be called. If, however, you wish to reset some or all of the settings please refer to Section 12 for a detailed description of the specification of the optional parameters.
Note: please be advised that this routine is classed as ‘experimental’ and its interface may be developed further in the future. Please see
Section 4 in How to Use the NAG Library
for further information.
h02bkf is a solver from the NAG optimization modelling suite for large-scale Mixed Integer Linear Programming (MILP) problems. It is a branch-and-cut method optimization solver based on the HiGHS software package.
where $\mathcal{P}={\mathbb{Z}}^{{n}_{\mathrm{int}}}\times {\mathbb{R}}^{{n}_{l}}$ is a Cartesian product of ${n}_{\mathrm{int}}$-dimensional integer space and ${n}_{l}$-dimensional real space, and $n={n}_{\mathrm{int}}+{n}_{l}$ is the number of decision variables. Here $c$, $x$, ${l}_{x}$, ${u}_{x}$ are $n$-dimensional vectors, $A$ is an $m\times n$ sparse matrix and ${l}_{A}$, ${u}_{A}$ are $m$-dimensional vectors.
h02bkf solves mixed integer linear programming problems stored as a handle. The handle points to an internal data structure which defines the problem and serves as a means of communication for routines in the NAG optimization modelling suite. First, the problem handle is initialized by calling e04raf. Then some of the routines e04ref,e04rff,e04rhfore04rjf may be called to formulate the objective function, bounds of the variables, and the block of linear constraints, respectively. Marking a set of variables as being integer-valued is achieved by calling e04rcf. Once the problem is fully set, the handle may be passed to the solver. When the handle is not needed anymore, e04rzf should be called to destroy it and deallocate the memory held within. See Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.
The solver method can be modified by various optional parameters (see Section 12) which can be set by e04zmfande04zpf anytime between the initialization of the handle by e04raf and a call to the solver. Once the solver has finished, options may be modified for the next solve. The solver may be called repeatedly with various optional parameters.
The optional parameter Task may be used to switch the problem to maximization or to ignore the objective function and find only a feasible point.
Several options may have significant impact on the performance of the solver. Even if the defaults were chosen to suit the majority of problems, it is recommended to experiment in order to find the most suitable set of options for a particular problem, see Section 12 for further details.
4References
Dakin R J (1965) A tree search algorithm for mixed integer programming problems Comput. J.8 250–255
Huangfu Q, and
Hall J.A. J.
(2018)
Parallelizing the dual revised simplex method
Mathematical Programming Computation10(1)
119–142
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
5Arguments
1: $\mathbf{handle}$ – Type (c_ptr)Input
On entry: the handle to the problem. It needs to be initialized (e.g., by e04raf) and to hold a problem formulation compatible with h02bkf. It must not be changed between calls to the NAG optimization modelling suite.
2: $\mathbf{nvar}$ – IntegerInput
On entry: $n$, the current number of decision variables $x$ in the model.
3: $\mathbf{x}\left({\mathbf{nvar}}\right)$ – Real (Kind=nag_wp) arrayInput/Output
On entry: the input of x is reserved for future releases of the NAG Library and it is ignored at the moment.
On exit: the final values of the variables $x$.
4: $\mathbf{rinfo}\left(100\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: error measures and various indicators of the algorithm as given in the table below:
$1$
Value of the primal objective.
$2$
Value of the dual objective bound.
$3$
The absolute value of the gap between the primal and dual bounds, relative to the primal bound.
$4$
The maximum deviation from an integer value over all the discrete variables. This is an indication of the integrality violation.
$5$
The maximum violation of a bound on a variable.
$6$
The sum of violations of bounds by variables.
$7$–$100$
Reserved for future use.
5: $\mathbf{stats}\left(100\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: solver statistics as given in the table below.
$1$
Total number of nodes generated.
$2$
Total number of simplex iterations performed.
$3$
Total time spent in the solver.
$4$–$100$
Reserved for future use.
6: $\mathbf{monit}$ – Subroutine, supplied by the NAG Library or the user.External Procedure
monit is reserved for future releases of the NAG Library which will allow you to monitor the progress of the optimization. It will never be called in the current implementation and monit may be the dummy subroutine h02bku included in the NAG Library.
On entry: the handle to the problem as provided on entry to h02bkf. It may be used to query the model during the solve, and extract the current approximation of the solution by e04rxf.
2: $\mathbf{rinfo}\left(100\right)$ – Real (Kind=nag_wp) arrayInput
On entry: error measures and various indicators at the end of the current iteration as described in rinfo.
3: $\mathbf{stats}\left(100\right)$ – Real (Kind=nag_wp) arrayInput
On entry: solver statistics at the end of the current iteration as described in stats, however, elements $2$, $3$, $5$, $9$, $10$, $11$ and $15$ refer to the quantities in the last iteration rather than accumulated over all iterations through the whole algorithm run.
5: $\mathbf{ruser}\left(*\right)$ – Real (Kind=nag_wp) arrayUser Workspace
6: $\mathbf{cpuser}$ – Type (c_ptr)User Workspace
monit is called with the arguments iuser, ruser and cpuser as supplied to h02bkf. You should use the arrays iuser and ruser, and the data handle cpuser to supply information to monit.
7: $\mathbf{inform}$ – IntegerInput/Output
On entry: a non-negative value.
On exit: must be set to a value describing the action to be taken by the solver on return from monit. Specifically, if the value is negative the solution of the current problem will terminate immediately; otherwise, computations will continue.
monit must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which h02bkf is called. Arguments denoted as Input must not be changed by this procedure.
8: $\mathbf{ruser}\left(*\right)$ – Real (Kind=nag_wp) arrayUser Workspace
9: $\mathbf{cpuser}$ – Type (c_ptr)User Workspace
iuser, ruser and cpuser are not used by h02bkf, but are passed directly to monit and may be used to pass information to this routine. If you do not need to reference cpuser, it should be initialized to c_null_ptr.
10: $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $\mathrm{-1}$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $\mathrm{-1}$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $\mathrm{-1}$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $\mathrm{-1}$ is recommended since useful values can be provided in some output arguments even when ${\mathbf{ifail}}\ne {\mathbf{0}}$ on exit. When the value $-\mathbf{1}$ 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).
6Error Indicators and Warnings
If on entry ${\mathbf{ifail}}=0$ or $\mathrm{-1}$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
Note: in some cases h02bkf may return useful information.
${\mathbf{ifail}}=1$
The supplied handle does not define a valid handle to the data structure for the NAG optimization modelling suite. It has not been properly initialized or it has been corrupted.
${\mathbf{ifail}}=2$
The problem is already being solved.
This solver does not support the model defined in the handle.
${\mathbf{ifail}}=4$
On entry, ${\mathbf{nvar}}=\u27e8\mathit{\text{value}}\u27e9$, expected $\mathrm{value}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: nvar must match the current number of variables of the model in the handle.
${\mathbf{ifail}}=22$
Maximum number of nodes exceeded.
The solution returned is the best solution for the number of nodes investigated in the B&B tree.
${\mathbf{ifail}}=23$
The solver terminated after the maximum time allowed was exhausted.
Maximum number of seconds exceeded. Use optional parameter Time Limit to change the limit.
${\mathbf{ifail}}=27$
No feasible solution was found for the number of nodes investigated in the B&B tree.
${\mathbf{ifail}}=51$
The problem was found to be primal infeasible.
${\mathbf{ifail}}=52$
The problem was found to be dual infeasible.
This means the primal unboundness was detected.
${\mathbf{ifail}}=53$
The problem seems to be primal or dual infeasible, the algorithm was stopped.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
If ${\mathbf{ifail}}={\mathbf{0}}$ on the final exit, the returned point satisfies feasibility and gap conditions to the requested accuracy and thus it is a good estimate of the solution. If the maximum number of nodes set by Milp Max Nodes is exceeded, the best solution for the number of nodes investigated will be returned.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
h02bkf is not thread safe and should not be called from a multithreaded user program. Please see Section 1 in FL Interface Multithreading for more information on thread safety.
h02bkf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
9.1Description of the Printed Output
The solver can print information to give an overview of the problem and of the progress of the computation. The output may be sent to two independent streams (files) which are set by optional parameters Print File and Monitoring File. Optional parameters Print Level, Print Solution and Print Options determine the exposed level of detail. This allows, for example, a detailed log file to be generated while the condensed information is displayed on the screen.
By default (${\mathbf{Print\; File}}=6$, ${\mathbf{Print\; Level}}=2$), six sections are printed to the standard output:
Header
Optional parameters list (if ${\mathbf{Print\; Options}}=\mathrm{YES}$)
The header is a message indicating the start of the solver. It should look like:
---------------------------------
H02BK, Solver for MILP problems
---------------------------------
Optional parameters list
The list shows all options of the solver, each displayed on one line. The output contains the option name, its current value and an indicator for how it was set. The options unchanged from the default setting are noted by ‘d’, options you set are noted by ‘U’, and options reset by the solver are noted by ‘S’. Note that the output format is compatible with the file format expected by e04zpf. The output might look as follows:
Milp Presolve = Yes * d
Milp Random Seed = 0 * d
Milp Feasibility Tol = 1.00000E-07 * U
Milp Rel Gap = 1.00000E-04 * d
Problem statistics
If ${\mathbf{Print\; Level}}\ge 2$, statistics on the original problems are printed, for example:
Problem Statistics
No of variables 5
integer 3
inc. binary 1
free (unconstrained) 0
bounded 2
No of lin. constraints 2
nonzeroes 4
Objective function Linear
Iteration log
If ${\mathbf{Print\; Level}}\ge 2$, the solver prints the status of each iteration, the output shows the number of nodes processed and in queue, the number of leaves in the B&B tree and the number of leaves explored, best bound and best primal objective function value and their gap, the number of cuts in the cut pool, number of cuts in the current linear model, size of the conflict pool, iteration count and time spent. The output might look as follows:
Solving MIP model with:
2 rows
5 cols (0 binary, 3 integer, 0 implied int., 0 continuous)
4 nonzeros
Nodes | B&B Tree | Objective Bounds | Dynamic Constraints | Work
Proc. InQueue | Leaves Expl. | BestBound BestSol Gap | Cuts InLp Confl. | LpIters Time
0 0 0 0.00% -27.8 1.79769313e+308 inf 0 0 0 0 0.0s
Summary
Once the solver finishes, a detailed summary is produced:
------------------------------------------------------------------------------
Status: converged, an optimal solution found
------------------------------------------------------------------------------
Final primal objective value 1.390000E+01
Final dual objective bound 1.390000E+01
Primal infeasibility 0.000000E+00
Integrality Violation 0.000000E+00
Optimality gap 0.000000E+00
Total number of nodes 1
Total LP iterations 2
It starts with the status line of the overall result which matches the ifail value and is followed by the final primal objective values and dual objective bound as well as the error measures and iteration count.
Solution
If ${\mathbf{Print\; Solution}}=\mathrm{YES}$, the values of the primal variables and their bounds on the primary and secondary outputs. It might look as follows:
The branch-and-bound (B&B) method applies directly to (1) as the basic framework. 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). In the optimal solution, if an integer variable ${x}_{k}$ takes a non-integer value ${x}_{k}^{*}$, then two LP sub-problems are created by branching. One sub-problem imposes ${x}_{k}\le \left[{x}_{k}^{*}\right]$, and the other imposes ${x}_{k}\ge \left[{x}_{k}^{*}\right]+1$, where $\left[{x}_{k}^{*}\right]$ denotes the integer part of ${x}_{k}^{*}$. 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 a dual revised simplex method, see Huangfu and Hall (2018) for more details.
11.1Stopping Criteria
Let $z$ and $\underset{\_}{z}}\phantom{\rule{0.25em}{0ex}$ denote the primal objective value and the dual objective bound, respectively. Then the optimality is measured by
The iteration is considered nearly optimal, and the B&B algorithm is stopped when the following conditions
$${g}_{\mathrm{abs}}\le {\epsilon}_{1}\text{\hspace{1em} and \hspace{1em}}{g}_{\mathrm{rel}}\le {\epsilon}_{2}$$
are satisfied, and the feasibility violation is below the tolerance set by Milp Feasibility Tol. Here ${\epsilon}_{1}$ and ${\epsilon}_{2}$ may be set using Milp Abs Gap and Milp Rel Gap, respectively.
12Optional Parameters
Several optional parameters in h02bkf define choices in the problem specification or the algorithm logic. In order to reduce the number of formal arguments of h02bkf these optional parameters have associated default values that are appropriate for most problems. Therefore, you need only specify those optional parameters whose values are to be different from their default values.
The remainder of this section can be skipped if you wish to use the default values for all optional parameters.
The optional parameters can be changed by calling e04zmf anytime between the initialization of the handle and the call to the solver. Modification of the optional parameters during intermediate monitoring stops is not allowed. Once the solver finishes, the optional parameters can be altered again for the next solve.
If any options are set by the solver (typically those with the choice of $\mathrm{AUTO}$), their value can be retrieved by e04znf. If the solver is called again, any such arguments are reset to their default values and the decision is made again.
The following is a list of the optional parameters available. A full description of each optional parameter is provided in Section 12.1.
For each option, we give a summary line, a description of the optional parameter and details of constraints.
The summary line contains:
the keywords;
a parameter value,
where the letters $a$, $i$ and $r$ denote options that take character, integer and real values respectively;
the default value, where the symbol $\epsilon $ is a generic notation for machine precision (see x02ajf), and $\mathit{Imax}$ represents the largest representable integer value (see x02bbf).
All options accept the value $\mathrm{DEFAULT}$ to return single options to their default states.
Keywords and character values are case and white space insensitive.
Defaults
This special keyword may be used to reset all optional parameters to their default values. Any value given with this keyword will be ignored.
Infinite Bound Size
$r$
Default $\text{}={10}^{20}$
This defines the ‘infinite’ bound $\mathit{bigbnd}$ in the definition of the problem constraints. Any upper bound greater than or equal to $\mathit{bigbnd}$ will
be regarded as $+\infty $ (and similarly any lower bound less than or equal to $-\mathit{bigbnd}$ will be regarded as $-\infty $). Note that a modification of this optional parameter does not influence constraints which have already been defined; only the constraints formulated after the change will be affected.
Tolerance on absolute gap, the absolute value of the difference between the primal objective value and the dual objective bound, to determine whether optimality has been reached.
This parameter controls whether symmetry should be detected. Symmetry arises when there are multiple equivalent solutions that have the same objective function value but different variable assignments. Identifying and handling symmetry can significantly improve the efficiency and speed of the solver, and reduce memory usage. However, it's worth noting for smaller problems, the time spent on symmetry detection and breaking may outweigh the benefits.
Constraint: ${\mathbf{Milp\; Detect\; Symmetry}}=\mathrm{YES}$ or $\mathrm{NO}$.
Milp Feasibility Tol
$r$
Default $={10}^{\mathrm{-6}}$
The maximum acceptable absolute violation in each constraint (bound, linear or integrality constraint) at a ‘feasible’ point; i.e., a constraint is considered satisfied if its violation does not exceed Milp Feasibility Tol$r$. For example, if the integer variable ${x}_{j}$ is near unity then ${x}_{j}$ is considered to be integer only if $(1-r)\le {x}_{j}\le (1+r)$.
The maximum number of nodes that are to be searched in the B&B tree in order to find a solution.
Constraint: ${\mathbf{Milp\; Max\; Nodes}}\ge 0$.
Milp Presolve
$a$
Default $=\mathrm{YES}$
This parameter allows you to turn the presolving of the problem off completely. If the presolver is turned off, the solver will try to handle the original problem you have given. In such a case, the presence of linear dependencies in the constraint matrix can cause numerical instabilities to occur. In normal circumstances, it is recommended to use the presolve which is the default.
Constraint: ${\mathbf{Milp\; Presolve}}=\mathrm{YES}$ or $\mathrm{NO}$.
Milp Random Seed
$i$
Default $=0$
Initial seed used for random selection in tasks such as primal heuristics and cut generation.
Lower limit on the absolute value of the linear constraint coefficients in the matrix $A$ defined in (1). Values smaller than this will be treated as zero.
If $i\ge 0$, the
unit number
for the secondary (monitoring) output. If set to $\mathrm{-1}$, no secondary output is provided. The following information is output to the unit:
–a listing of the optional parameters if set by Print Options;
–problem statistics, the iteration log and the final status as set by Monitoring Level;
This parameter sets the amount of information detail that will be printed by the solver to the secondary output. The meaning of the levels is the same as with Print Level.
If $i\ge 0$, the
unit number
for the primary output of the solver. If ${\mathbf{Print\; File}}=\mathrm{-1}$, the primary output is completely turned off independently of other settings. The default value is the advisory message unit number as defined by x04abf at the time of the optional parameters initialization, e.g., at the initialization of the handle. The following information is output to the unit:
–a listing of optional parameters if set by Print Options;
–problem statistics, the iteration log and the final status from the solver as set by Print Level;
This parameter defines how detailed information should be printed by the solver to the primary output.
$\mathit{i}$
Output
$0$
No output from the solver
$1$
The Header and Summary
$2$, $3$, $4$, $5$
Additionally, the Iteration log
Constraint: $0\le {\mathbf{Print\; Level}}\le 5$.
Print Options
$a$
Default $=\mathrm{YES}$
If ${\mathbf{Print\; Options}}=\mathrm{YES}$, a listing of optional parameters will be printed to the primary and secondary output.
Constraint: ${\mathbf{Print\; Options}}=\mathrm{YES}$ or $\mathrm{NO}$.
Print Solution
$a$
Default $=\mathrm{NO}$
If ${\mathbf{Print\; Solution}}=\mathrm{YES}$, the final values of the primal variables are printed on the primary and secondary outputs.
Constraint: ${\mathbf{Print\; Solution}}=\mathrm{YES}$ or $\mathrm{NO}$.
Task
$a$
Default $=\mathrm{MINIMIZE}$
This parameter specifies the required direction of the optimization. If ${\mathbf{Task}}=\mathrm{FEASIBLEPOINT}$, the objective function (if set) is ignored and the algorithm stops as soon as a feasible point is found with respect to the given tolerance. If no objective function is set, Task reverts to $\mathrm{FEASIBLEPOINT}$ automatically.
Constraint: ${\mathbf{Task}}=\mathrm{MINIMIZE}$, $\mathrm{MAXIMIZE}$ or $\mathrm{FEASIBLE\; POINT}$.
Time Limit
$r$
Default $\text{}={10}^{6}$
This parameter specifies a limit in seconds that the solver can use to solve one problem. If during the convergence check this limit is exceeded, the solver will terminate with ${\mathbf{ifail}}={\mathbf{23}}$ error message.