Home

Awesome

Min-Cost-Flow-Class

ReadMe for the MCFClass project, a set of C++ solvers for (Linear or Convex Quadratic Separable) Min Cost Flow Problem solvers under the same interface deriving from the base class MCFClass.

The aim of MCFClass is to provide an abstraction layer between practitioners who need to solve MCF problems within complex applications and developers of MCF software. The idea is to provide an interface which caters for all the needs that a practitioner can have, thereby allowing him/her to use whichever algorithm - among those that have an implementation conforming to this interface - without bothering with the details of the implementation, and to easily switch between different algorithms.

MCFClass defines and "exports" the types of "flows" (MCFClass::FNumber), "costs" (MCFClass::CNumber) and so on, together with a set of comparison operators (ETZ, GTZ, ...) which automatically detect whether or not the underlying types are integers or floats, inserting appropriate "epsilons" in the latter case and avoiding them (for speed) in the former; these things are sorted out at compile time without user intervention.

This release comprises:

There are two more complete solvers available under the MCFClass interface, namely CS2 and MCFZIB. These are, however, distributed under a more restrictive academic license, which has to be explicitly accepted before getting hold of the code. Request forms are available in the req/ folder.

Build and install

You can either use CMake or plain makefiles to build the library, your choice. CMake compiles off-source and it is therefore perhaps better suited to one-off, compile-and-forget installations, whereby the provided makefiles compile on-source and we find that they are better suited while developing and testing the code (if that's your cup of tea; it is ours).

In both cases, all external dependencies should be automatically dealt with if they are installed in their default paths, as specified in the *_ROOT values of extlib/makefile-default-paths. If not, the suggested way to change them is to copy the file into extlib/makefile-paths and edit it. The file (if present) is automatically read and the values found there replace the corresponding non-default definitions. The rationale for not changing makefile-default-paths is that makefile-paths file is .gitignore-d. Hence, it should not be necessary to re-change the makefiles (or stash/restore the changes) each time the project is pulled, or manually ignore the changes when it is pushed, which is very convenient for anyone who actually develops MCFClass components (anyone there?). However, note that the reading of both extlib/makefile-default-paths and extlib/makefile-paths can be disabled; see the MCFClass_READ_PATHS option in the CMake section and the MCFC_NO_PATHS macro in the makefile section below.

Using CMake

Configure and build the library with:

mkdir build
cd build
cmake ..
cmake --build .

If CPLEX is not available or you are not interested in MCFCplex, run

cmake -DMCFClass_USE_CPLEX=OFF ..
cmake --install .
find_package(MCFClass)
target_link_libraries(<my_target> MCFClass::MCFClass)
set(MCFClass_READ_PATHS OFF CACHE BOOL
        "Whether MCFClass will read locations for dependencies or not." FORCE)

in your CMake project.

Using makefiles

make -f makefile-lib
MCFCxDIR = $(libMCFClDIR)/MCFCplex
include $(MCFCxDIR)/makefile

You can similarly enable (or disable) any solver, both the LGPL ones and those under the academic license, if you have obtained them, by commenting out (or commenting) the corresponding two lines in lib/makefile.

Other stuff

More information about (some of) the implemented algorithms can be found at

http://pages.di.unipi.it/frangio/abstracts.html#JOC06

A further solver, MCFIntPnt (based on Interior-Point algorithms) has been developed, but it has not yet reached a sufficient maturuty to be distributed; its principles are discussed at

http://pages.di.unipi.it/frangio/abstracts.html#SIOPT04 http://pages.di.unipi.it/frangio/abstracts.html#COAP06 http://pages.di.unipi.it/frangio/abstracts.html#OMS06