Skip to content

eomahony/Numberjack

Repository files navigation

Numberjack

A Python platform for Combinatorial Optimisation

What is Numberjack?

Numberjack is a modelling package written in Python for combinatorial optimisation. Python benefits from a large and active programming community, Numberjack is therefore a perfect tool to embed optimisation technology into larger applications. It is designed to support a number of underlying C/C++ solvers seamlessly and efficiently. There are a number of available back-ends: three mixed integer programming solvers (Gurobi, CPLEX, and SCIP), satisfiability solvers (MiniSat, Walksat, and many others), a constraint programming solver (Mistral), and a weighted constraint satisfaction solver (Toulbar2).

  • Numberjack offers a high level constraint programming language
  • Numberjack directly benefits from python's features and modules
  • Numberjack uses efficient underlying C/C++ solvers.

Installation

Numberjack offers the ability to use several high-performance solvers, some of which are required to be installed separately or have their own dependencies. The source-code for building Mistral, Toulbar2, Minisat, and Walksat is included in the Numberjack distribution and interfaces to additional solvers are available.

To install Numberjack from source simply run python setup.py build from the Numberjack directory, followed by python setup.py install. This requires the following to be installed:

  • python-dev
  • swig (3.X)
  • libxml2-dev
  • zlib1g-dev
  • libgmp-dev

Building the Solver Interfaces

The following solvers are entirely optional and are not required to use Numberjack however they can be a valuable tool to have. If any of the solvers cannot be found on the system, then their interface will be disabled within Numberjack.

Gurobi Optimizer

Numberjack provides an interface to the mathematical programming solver, Gurobi. To use it in Numberjack, Download and install Gurobi Optimizer from their website. Numberjack has been tested against Gurobi versions 5.1, 5.5, and 5.6.

Numberjack will try to automatically find the Gurobi install location by first checking the GUROBI_HOME environment variable which should be set according to the Gurobi install guide. If not, it will try to find the path based on the location of the gurobi_cl executable.

export GUROBI_HOME="/opt/gurobi550/linux64"    # Example Linux install dir
export GUROBI_HOME="/Library/gurobi550/mac64"  # Example Mac OS X install dir

CPLEX

Numberjack provides an interface to IBM ILOG CPLEX Optimizer and has been tested against CPLEX versions 12.5, and 12.5.1.

Numberjack will try to automatically find the CPLEX install location by first checking the environment variable CPLEXDIR. If this is not set it will try to find it based on the location of the cplex executable.

export CPLEXDIR="/opt/ibm/ILOG/CPLEX_Studio1251/cplex"
export CPLEXDIR="/Applications/IBM/ILOG/CPLEX_Studio1251/cplex"

SCIP

SCIP is an open-source MIP solver available from: http://scip.zib.de, please download version 3.1.0. The simplest way to install SCIP is to download the source code of SCIP Optimization Suite v3.1.0 and place scipoptsuite-3.1.0.tgz in the same folder as Numberjack, alongside this file, so that it can be compiled with the necessary flags.

If you would like to compile SCIP yourself from a different location, then please set the environment variable ZIBPATH to the scipoptsuite directory and compile the static library using the following options:

export ZIBPATH=path_to/scipoptsuite-3.1.0
make scipoptlib ZIMPL=false ZLIB=false READLINE=false GAMS=false GMP=false LEGACY=true SPX_LEGACY=true

Compiling Specific Solvers

If you add one of these solvers after already installing Numberjack, you can compile a subset of the solvers by specifying a comma separated list with the -solver argument, for example:

python setup.py build -solver Mistral,SCIP,MiniSat

OSI Solvers

The following OSI solvers have not been ported to the distutils build system yet.

Before you get started with the compiling Osi solvers for Numberjack you must first get the Osi module working.

Download Osi from: http://www.coin-or.org/download/source/Osi/

To do this you need to download Osi-???.tgz and extract it in the solvers/osi/ folder. The version that the Makefile presumes is Osi-0.105.2. If you download a different version the line OSIVER = 0.105.2 will have to be changed.

OsiClp

Download Clp from: http://www.coin-or.org/download/source/Clp/

The version that the Makefile presumes is Clp-1.14.5. If you download a different version the line CLPVER = 1.14.5 will have to be changed.

OsiCbc

Download Cbc from: http://www.coin-or.org/download/source/Cbc/

The version that the Makefile presumes is Cbc-2.7.5. If you download a different version the line CBCVER = 2.7.5 will have to be changed.

CBC Supports several different lp solver backends(e.g. glpk) but currently dynamically links Clp. There will be some work done on this, but as it stands you need to have Clp installed to the system for CBC to work.

OsiVol

Download Vol from: http://www.coin-or.org/download/source/Vol/

The version that the Makefile presumes is Vol-1.3.2. If you download a different version the line VOLVER = 1.3.2 will have to be changed.

OsiDylp

Download Dylp from: http://www.coin-or.org/download/source/Dylp/

The version that the Makefile presumes is DyLP-1.8.2. If you download a different version the line DYLPVER = 1.8.2 will have to be changed.

OsiSpx (soplex)

Download soplex from: http://soplex.zib.de/download.shtml

The version that the Makefile presumes is soplex-1.6.0. If you download a different version the line SPXVER = 1.6.0 will have to be changed.

OsiGlpk

Download Glpk from: http://ftp.gnu.org/gnu/glpk/

The version that the Makefile presumes is glpk-4.47. If you download a different version the line GLPKVER = 4.47 will have to be changed.