Skip to content

AbdullahMohammad/Numberjack

 
 

Repository files navigation

Numberjack

A Python constraint programming platform

What is Numberjack?

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

  • 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, Minisat, and Walksat is included in the Numberjack distribution and interfaces to additional solvers are available.

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

  • python 2
  • swig
  • libxml2-dev
  • zlib1g-dev
  • python-dev
  • libgmp-dev

Building the Solvers

Gurobi Optimizer

Numberjack provides an interface to the mathematical programming solver, Gurobi. To use it in Numberjack, please follow the following steps:

  1. Download and install Gurobi Optimizer from their website. Numberjack has been tested against Gurobi versions 5.1, 5.5, and 5.6.

  2. Numberjack will try to 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 OSX install dir
  3. In the Numberjack directory, move the folder available_interfaces/gurobi to solvers/gurobi.

  4. Run make, followed by make install from the Numberjack directory.

CPLEX

Numberjack provides an interface to IBM ILOG CPLEX Optimizer. If you have it installed on your system, follow these steps to use in in Numberjack:

  1. If the executable cplex is in the PATH Numberjack will be able to find the location of CPLEX on your system. If not, you should set the environment variable CPLEXDIR to the location where CPLEX is installed, for example:

    export CPLEXDIR="/opt/ibm/ILOG/CPLEX_Studio1251/cplex"
    export CPLEXDIR="/Applications/IBM/ILOG/CPLEX_Studio1251/cplex"
  2. In the Numberjack directory, move the folder available_interfaces/cplex to solvers/cplex.

  3. Run make, followed by make install from the Numberjack directory.

SCIP

Due to licensing restrictions Numberjack cannot include the sources for SCIP. The SCIP source code is available from: http://scip.zib.de/download.shtml (available for free under an academic license). Please download version 3.1.0.

  1. Download the source code of SCIP Optimization Suite v3.1.0, unarchive it, however, do not install nor compile it.

    tar zxf scipoptsuite-?.?.?.tgz
  2. In the scipoptsuite directory, unarchive the SCIP and SoPlex archives.

    cd scipoptsuite-3.1.0/
    tar zxf scip-?.?.?.tgz
    tar zxf soplex-?.?.?.tgz
  3. Set an environment variable ZIBPATH to the scipoptsuite directory, for example:

    export ZIBPATH=path_to/scipoptsuite-3.1.0
  4. Move the folder available_interfaces/scip to solvers/scip.

  5. Run make, followed by make install from the Numberjack directory.

Osi Solvers

Some of the solvers cannot be included in the source tree. 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.

About

Python Combinatorial Optimisation Platform

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 88.7%
  • Python 6.8%
  • Shell 2.4%
  • C 1.9%
  • Awk 0.2%
  • CSS 0.0%