## Problem Statement

In a previous post I presented an approach to solve the shortest path problem using different implementations of algorithms. The shortest path problem is a classic and important combinatorial optimisation problem. It often appears as a subproblem when solving difficult combinatorial problems like the multicommodity network flow (MCNF) problems.

The problem is to route a set of demands (commodities) through a network^{1} with limited arc capacities. The inherent assumption with the following implementation is that the commodities can be shipped in fractions, hence are divisible.

The technique that is implemented in the Java code is the Column Generation a.k.a. the Dantzig-Wolfe Decomposition. This technique has many applications to practical problems. For instance routing data packets through telephone networks, routing electricity demand in power grids, routing vehicles on the road network, allocating airline crews to flights, production scheduling and planning, etc.

The column generation algorithm can be interpreted as applying the Simplex Method to a Linear Problem with a huge number of columns. Only a few columns are present at the start, other columns are *generated* when needed.

## Problem Example

Taking the small network shown below as an example, we can state that all edges are bidirectional with a cost of 1 and a total capacity of 2.5 (D-F has 2.6)

If the commodities:

- A-F: 3 units
- e-D: 2 units

## Implementation

^{2}.

## References

1. The network in the present example is defined as a graph V, which is a set of vertices V= {1,…n}.

It also includes a set j in E of (directed) edges specified by a start and end verted and also the cost and cpacity of each vertex: Cj, CAPj.

Finally a set i in C of commodities which is given by the source and target of each commodity: Si, Ti, and the demand Di.

2. You can find the library at http://lpsolve.sourceforge.net. To use it on Windows you need to copy the shared libraries lpsolve55.dll, lpsolve55j.dll as well as the interface lpsolve55ja.jar into the project workspace.

To compile use:

javac -cp lpsolve55ja.jar;. Mcnf.java

To run the program use:

java -cp lpsolve55ja.jar;. Mcnf

### Remark

For OSX you’ll needto compile from source. Change to the `lib/mac`

directory and edit the file `build_osx`

. Change the directory paths as indicated in the comments. Follow the compilation instructions to get the binaries of the solver