Python Interface for Automated Solvers
SolverPy provides a uniform Python interface for several automated ATP and SMT solvers.
Currently supported solvers are
E,
Vampire,
Prover9,
Lash,
cvc5,
Z3,
and Bitwuzla.
The interface can be used for:
đĄ Solving a single problem instance with compatible results.
đ§ Benchmark parallel evaluation with database storage.
đ§ Machine learning of models and strategies for solver guidance.
Installation
Install the Python package using pip:
$ pip install solverpy
Or clone our GitHub repository:
$ git clone https://github.com/cbboyan/solverpy.git
đī¸ Note: The solver binaries/libraries are not part of this Python package and must be installed separately. The binaries must be (by default) in
PATHor specified usingbinaryparameter inSetup, if you wish to use them fromsolverpy.
Overview
đĄ Single problem solving
Single problem solving involves creating a solver object and calling its
solve method.
from solverpy.solver.smt.cvc5 import Cvc5
cvc5 = Cvc5("T5") # time limit of 5 seconds
result = cvc5.solve("myproblem.smt2", "--enum-inst") # problem and strategy
Strategies are solver-specific, typically command line options as a string.
â The result is a dictionary guaranteed to contain at least two keys:
statusas a string andruntimein seconds, apart from solver-specific keys.
đ For more details, see the solver module.
đ§ Benchmark evaluation
SolverPy provides dataclass Setup that describes the evaluation configuration.
It auromatically connects to database DB to store results, by default, using the Jsons provider.
To evaluate a set of strategies on a set of benchmark problems, you just need to provide your experiment description as a Python dict.
đĄ Use typed version
Setupto avoid typos and type errors.
Functions from the setups module are used to fill in the required keys and values.
To run the evaluation you setup a solver for an evaluation, then launch it.
đ¤ Before launching the evaluation, you need to setup the SolverPy database by creating directories
solverpy_db/stratsin the current directory. This directory stores the strategy files. For the above example, there should be an empty filesolverpy_db/strats/default(default cvc5 strategy). The problem files should be inproblems/directory.
from solverpy import setups
mysetup = setups.Setup(
cores=4,
bidlist=["problems"],
sidlist=["default"],
limit='T10',
)
setups.cvc5(mysetup)
setups.evaluation(mysetup)
setups.launch(mysetup)
â After the evaluation, you can inspect the results in the database directory
solverpy_db/results.
đ For more details, see the benchmark module.
đ§ Machine learning
Similarly, you can use the enigma and cvc5ml
from setups module.
to setup several loops of
interleaved evaluation and model training.
đ For more details, see the builder module.