Skip to content
OMT Examples using OptiMathSAT's python API
SMT Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This is a collection of Optimization Modulo Theories examples using the Python API interface of OptiMathSAT.


This project requires Python 3.X and gmplib.


Download the package of the latest version of OptiMathSAT (v. 1.6.2 or superior) inside the directory optimathsat, and unpack it. Then, run the script as follows:

~$ python3

This command builds the Python API of OptiMathSAT, and places the generated file in the include directory and the generated file in the lib directory.

For convenience, you may want to permanently add both of these locations to your PYTHONPATH environment variable:

export PYTHONPATH=${PYTHONPATH}:.../omt_python_examples/include
export PYTHONPATH=${PYTHONPATH}:.../omt_python_examples/lib

This step is useful to avoid import complaints with pylint3. The unit-test scripts, however, are expected to work even without performing this step.


Run all unit-test examples with

~$ python3

Each unit-test can also be executed on its own. For instance, the unit-test can be run with

~$ ./unit-tests/

or with

~$ python3 unit-tests/


Please contact the author of this repository, or the current maintainer of the OptiMathSAT, in the case that there is still any persisting issue with these unit-tests.


This project is authored by Patrick Trentin (

You can’t perform that action at this time.