Skip to main content

A Python interface to the Exact integer linear programming solver

Project description

Exact

Exact solves decision and optimization problems formulated as integer linear programs. Under the hood, it converts integer variables to binary (0-1) variables and applies highly efficient propagation routines and strong cutting-planes / pseudo-Boolean conflict analysis.

Exact is a fork of RoundingSat and improves upon its predecessor in reliability, performance and ease-of-use. The name "Exact" reflects that the answers are fully sound, as approximate and floating-point calculations only occur in heuristic parts of the algorithm. As such, Exact can soundly be used for verification and theorem proving, where its envisioned ability to emit machine-checkable certificates of optimality and unsatisfiability should prove useful.

Stay updated

Follow @ExactSolver on Twitter and join the reddit community.

Features

  • Native conflict analysis over binary linear constraints, constructing full-blown cutting planes proofs.
  • Highly efficient watched propagation routines.
  • Seamless use of arbitrary precision arithmetic when needed.
  • Hybrid linear (top-down) and core-guided (bottom-up) optimization.
  • Optional integration with the SoPlex LP solver.
  • Core solver also compiles on macOS and Windows.
  • Under development: Python interface with assumption solving and reuse of solver state (Linux only for now).
  • Under development: generation of certificates of optimality and unsatisfiability that can be automatically verified by VeriPB.

Python interface

Either compile a shared library locally or use the published PyPI package (Linux only for now) via the pip or poetry package managers.

The header file Exact.hpp contains the C++ methods exposed to Python via cppyy as well as their description. This is probably the place to start to learn about Exact's Python usage.

Next, python/examples contains instructive, fully commented examples.

File-based usage

Exact takes as input an integer linear program and outputs a(n optimal) solution or reports that none exists. Either pipe the program

cat test/instances/opb/opt/stein15.opb | build/Exact

or pass the file as a parameter

build/Exact test/instances/opb/opt/stein15.opb

Use the flag --help to display a list of runtime parameters.

Exact supports five input formats (described in more detail in InputFormats.md):

  • .opb pseudo-Boolean PBO (only linear objective and constraints)
  • .cnf DIMACS Conjunctive Normal Form (CNF)
  • .wcnf Weighted Conjunctive Normal Form (WCNF)
  • .mps Mathematical Programming System (MPS) via the optional CoinUtils library
  • .lp Linear Program (LP) via the optional CoinUtils library

Note that .mps and .lp allow rational variables, which are not supported by Exact. Additionally, these formats permit floating point values, which may lead to tricky issues. Rewrite constraints with fractional values to integral ones by multiplying with the lowest common multiple of the denominators.

By default, Exact decides on the format based on the filename extension, but this can be overridden with the --format option.

Compilation

In the root directory of Exact:

cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

For a debug build:

cd build_debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
make

For more builds, similar build directories can be created.

For installing system-wide or to the CMAKE_INSTALL_PREFIX root, use make install.

Dependencies

  • C++17 (i.e., a reasonably recent C++ compiler)
  • Boost library. On a Debian/Ubuntu system, install with sudo apt install libboost-dev.
  • Optionally: CoinUtils library to parse MPS and LP file formats. Use cmake option -Dcoinutils=ON after installing the library.
  • Optionally: SoPlex LP solver (see below).

SoPlex

Exact supports an integration with the LP solver SoPlex to improve its search routine. For this, first download SoPlex 6.0.1 and place the downloaded file in the root directory of Exact. Next, follow the above build process, but configure with the cmake option -Dsoplex=ON:

cd build
cmake -DCMAKE_BUILD_TYPE=Release -Dsoplex=ON ..
make

The location of the SoPlex package can be configured with the cmake option -Dsoplex_pkg=<location>.

License

Exact is licensed under the AGPLv3. If this would hinder your intended usage, please get in touch via jodevriendt.com/contact.

Benchmarks

The current set of benchmarks which is used to assess performance is available here.

Citations

Origin paper with a focus on cutting planes conflict analysis:
[EN18] J. Elffers, J. Nordström. Divide and Conquer: Towards Faster Pseudo-Boolean Solving. IJCAI 2018

Integration with SoPlex:
[DGN20] J. Devriendt, A. Gleixner, J. Nordström. Learn to Relax: Integrating 0-1 Integer Linear Programming with Pseudo-Boolean Conflict-Driven Search. CPAIOR 2020 / Constraints journal

Watched propagation:
[D20] J. Devriendt. Watched Propagation for 0-1 Integer Linear Constraints. CP 2020

Core-guided optimization:
[DGDNS21] J. Devriendt, S. Gocht, E. Demirović, J. Nordström, P. J. Stuckey. Cutting to the Core of Pseudo-Boolean Optimization: Combining Core-Guided Search with Cutting Planes Reasoning. AAAI 2021

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

exact-1.0.3.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

exact-1.0.3-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file exact-1.0.3.tar.gz.

File metadata

  • Download URL: exact-1.0.3.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9

File hashes

Hashes for exact-1.0.3.tar.gz
Algorithm Hash digest
SHA256 faa29f4da69bf9057d8abb3746285acaf5d100c79e73ff25d7723bbec6c813a2
MD5 cfcdd41f0662c9ad7cb82307216c8eac
BLAKE2b-256 f3af0ca266d1eeaf1f13e91b656ba016e8115681c38b22c095999720b0581f18

See more details on using hashes here.

File details

Details for the file exact-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: exact-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9

File hashes

Hashes for exact-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b100482f8b13979e737186086127ae89c74efb4f2d881d3a55f6d2a398bdf6bf
MD5 4f97086d52f741d670dbe8952a3d75de
BLAKE2b-256 fea98b647a95c3da089b34439c9c7076c0a874297419b88142bbebcba0c8cc67

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page