This chapter provides methods to solve certain integer programming, transportation and shortest path problems. Additionally ‘best subset’ methods are included.
Syntax
C# 

public static class H 
Visual Basic 

Public NotInheritable Class H 
Visual C++ 

public ref class H abstract sealed 
F# 

[<AbstractClassAttribute>] [<SealedAttribute>] type H = class end 
Background to the Problems
General linear programming (LP) problems (see Dantzig (1963)) are of the form:
 find $x={\left({x}_{1},{x}_{2},\dots ,{x}_{n}\right)}^{\mathrm{T}}$ to maximize $F\left(x\right)={\displaystyle \sum _{j=1}^{n}}{c}_{j}{x}_{j}$
 subject to linear constraints which may have the forms:
$$\begin{array}{lll}\sum _{j=1}^{n}{a}_{ij}{x}_{j}={b}_{i}\text{,}& i=1,2,\dots ,{m}_{1}& \text{(equality)}\\ \sum _{j=1}^{n}{a}_{ij}{x}_{j}\le {b}_{i}\text{,}& i={m}_{1}+1,\dots ,{m}_{2}& \text{(inequality)}\\ \sum _{j=1}^{n}{a}_{ij}{x}_{j}\ge {b}_{i}\text{,}& i={m}_{2}+1,\dots ,m& \text{(inequality)}\\ {x}_{j}\ge {l}_{j}\text{,}& j=1,2,\dots ,n& \text{(simple bound)}\\ {x}_{j}\le {u}_{j}\text{,}& j=1,2,\dots ,n& \text{(simple bound)}\end{array}$$
This chapter deals with integer programming (IP) problems in which some or all the elements of the solution vector $x$ are further constrained to be integers. For general LP problems where $x$ takes only real (i.e., noninteger) values, refer to E04 class.
IP problems may or may not have a solution, which may or may not be unique.
Consider for example the following problem:
The hatched area in Figure 1 is the feasible region, the region where all the constraints are satisfied, and the points within it which have integer coordinates are circled. The lines of hatching are in fact contours of decreasing values of the objective function $3{x}_{1}+2{x}_{2}$, and it is clear from Figure 1 that the optimum IP solution is at the point $\left(1,1\right)$. For this problem the solution is unique.
$$\begin{array}{llll}\mathrm{minimize}& 3{x}_{1}& +& 2{x}_{2}\\ \text{subject to}& 4{x}_{1}& +& 2{x}_{2}\ge 5\\ & & & 2{x}_{2}\le 5\\ & \phantom{0}{x}_{1}& & \phantom{0}{x}_{2}\le 2\\ \text{and}& \phantom{0}{x}_{1}& \ge & 0,{x}_{2}\ge 0\text{.}\end{array}$$ 
However, there are other possible situations.
(a)  There may be more than one solution; e.g., if the objective function in the above problem were changed to ${x}_{1}+{x}_{2}$, both $\left(1,1\right)$ and $\left(2,0\right)$ would be IP solutions.  
(b)  The feasible region may contain no points with integer coordinates, e.g., if an additional constraint


(c)  There may be no feasible region, e.g., if an additional constraint


(d)  The objective function may have no finite minimum within the feasible region; this means that the feasible region is unbounded in the direction of decreasing values of the objective function, e.g., if the constraints

Figure 1
Algorithms for IP problems are usually based on algorithms for general LP problems, together with some procedure for constructing additional constraints which exclude noninteger solutions (see Beale (1977)).
The Branch and Bound (B&B) method is a wellknown and widely used technique for solving IP problems (see Beale (1977) or Mitra (1973)). It involves subdividing the optimum solution to the original LP problem into two mutually exclusive subproblems by branching an integer variable that currently has a fractional optimal value. Each subproblem can now be solved as an LP problem, using the objective function of the original problem. The process of branching continues until a solution for one of the subproblems is feasible with respect to the integer problem. In order to prove the optimality of this solution, the rest of the subproblems in the B&B tree must also be solved. Naturally, if a better integer feasible solution is found for any subproblem, it should replace the one at hand.
A common method for specifying IP and LP problems in general is the use of the MPSX file format (see IBM (1971)). A full description of this file format is provided in the method document for (H02BUF not in this release).
The efficiency in computations is enhanced by discarding inferior subproblems. These are problems in the B&B search tree whose LP solutions are lower than (in the case of maximization) the best integer solution at hand.
The B&B method may also be applied to convex quadratic programming (QP) problems. Methods have been introduced into this chapter to formally apply the technique to dense general QP problems and to sparse LP or QP problems.
A special type of linear programming problem is the transportation problem in which there are $p\times q$ variables ${y}_{kl}$ which represent quantities of goods to be transported from each of $p$ sources to each of $q$ destinations.
The problem is to minimize
where ${c}_{kl}$ is the unit cost of transporting from source $k$ to destination $l$. The constraints are:
Note that the availabilities must equal the requirements:
and if all the ${A}_{k}$ and ${B}_{l}$ are integers, then so are the optimal ${y}_{kl}$.
$$\sum _{k=1}^{p}\sum _{l=1}^{q}{c}_{kl}{y}_{kl}$$ 
$$\begin{array}{ll}\sum _{l=1}^{q}{y}_{kl}={A}_{k}& \left(\text{availabilities}\right)\\ \sum _{k=1}^{p}{y}_{kl}={B}_{l}& \left(\text{requirements}\right)\\ {y}_{kl}\ge 0\text{.}\end{array}$$ 
$$\sum _{k=1}^{p}{A}_{k}=\sum _{l=1}^{q}{B}_{l}=\sum _{k=1}^{p}\sum _{l=1}^{q}{y}_{kl}$$ 
The shortest path problem is that of finding a path of minimum length between two distinct vertices ${n}_{s}$ and ${n}_{e}$ through a network. Suppose the vertices in the network are labelled by the integers $1,2,\dots ,n$. Let $\left(i,j\right)$ denote an ordered pair of vertices in the network (where $i$ is the origin vertex and $j$ the destination vertex of the arc), ${x}_{ij}$ the amount of flow in arc $\left(i,j\right)$ and ${d}_{ij}$ the length of the arc $\left(i,j\right)$. The LP formulation of the problem is thus given as
where
and
The above formulation only yields a meaningful solution if ${x}_{ij}=0\text{ or}1$; that is, $\mathrm{arc}\left(i,j\right)$ forms part of the shortest route only if ${x}_{ij}=1$. In fact since the optimal LP solution will (in theory) always yield ${x}_{ij}=0\text{ or}1$, (1) can also be solved as an IP problem. Note that the problem may also be solved directly (and more efficiently) using a variant of Dijkstra's algorithm (see Ahuja et al. (1993)).
$$\text{minimize \hspace{1em}}\sum \sum {d}_{ij}{x}_{ij}\text{subject to}Ax=b\text{, \hspace{1em}}0\le x\le 1\text{,}$$  (1) 
$${a}_{ij}=\left\{\begin{array}{ll}+1& \text{if arc}j\text{ is directed away from vertex}i\text{,}\\ 1& \text{if arc}j\text{ is directed towards vertex}i\text{,}\\ 0& \text{otherwise}\end{array}\right.$$ 
$${b}_{i}=\left\{\begin{array}{ll}+1& \text{for}i={n}_{s}\text{,}\\ 1& \text{for}i={n}_{e}\text{,}\\ 0& \text{otherwise.}\end{array}\right.$$ 
The travelling salesman problem is that of finding a minimum distance route round a given set of cities. The salesperson must visit each city only once before returning to his or her city of origin. It can be formulated as an IP problem in a number of ways. One such formulation is described in Williams (1993). There are currently no methods in the Library for solving such problems.
The best $\mathit{n}$ subsets problem assumes a scoring mechanism and a set of $m$ features. The problem is one of choosing the best $n$ subsets of size $p$. It is addressed by two methods in this chapter. The first of these uses reverse communication; the second direct communication.
Recommendations on Choice and Use of Available Methods
h02bb  solves dense integer programming problems using a branch and bound method. 
(H02BFF not in this release)  solves dense integer or linear programming problems defined by a MPSX data file. 
(H02BUF not in this release)  converts an MPSX data file defining an integer or a linear programming problem to the form required by e04mf or h02bb. 
(H02BVF not in this release)  prints the solution to an integer or a linear programming problem using specified names for rows and columns. 
(H02BZF not in this release)  supplies further information on the optimum solution obtained by h02bb. 
h02cb  solves dense integer general quadratic programming problems. 
(H02CCF not in this release)  reads optional parameter values for h02cb from external file. 
(H02CDF not in this release)  supplies optional parameter values to h02cb. 
h02ce  solves sparse integer linear programming or quadratic programming problems. 
(H02CFF not in this release)  reads optional parameter values for h02ce from external file. 
(H02CGF not in this release)  supplies optional parameter values to h02ce. 
(H03ABF not in this release)  solves transportation problems. It uses integer arithmetic throughout and so produces exact results. On a few machines, however, there is a risk of integer overflow without warning, so the integer values in the data should be kept as small as possible by dividing out any common factors from the coefficients of the constraint or objective functions. 
(H03ADF not in this release)  solves shortest path problems using Dijkstra's algorithm. 
h02bb (H02BFF not in this release) (H03ABF not in this release) treat all matrices as dense and hence are not intended for large sparse problems. For solving large sparse LP problems, use e04nq or e04ug.
Transportation Problem
(H03ABF not in this release) solves transportation problems. It uses integer arithmetic throughout and so produces exact results. On a few machines, however, there is a risk of integer overflow without warning, so the integer values in the data should be kept as small as possible by dividing out any common factors from the coefficients of the constraint or objective functions.
Feature Selection – Best Subset Problem
(H05AAF not in this release) selects the best $n$ subsets of size $p$ using a reverse communication branch and bound algorithm.
(H05ABF not in this release) selects the best $n$ subsets of size $p$ using a direct communication branch and bound algorithm.
References
Ahuja R K, Magnanti T L and Orlin J B (1993) Network Flows: Theory, Algorithms and Applications Prentice–Hall
Beale E M (1977) Integer programming The State of the Art in Numerical Analysis (ed D A H Jacobs) Academic Press
Dantzig G B (1963) Linear Programming and Extensions Princeton University Press
IBM (1971) MPSX – Mathematical programming system Program Number 5734 XM4 IBM Trade Corporation, New York
Mitra G (1973) Investigation of some branch and bound strategies for the solution of mixed integer linear programs Math. Programming 4 155–170
Williams H P (1993) Model Building in Mathematical Programming (3rd Edition) Wiley