Skip to main content

Python wrapper for the Revisiting SATZilla 2024 feature extractor

Project description

Revisiting SATZilla in 2024

Code for the paper: "Revisiting SATZilla Features in 2024" by Hadar Shavit and Holger H. Hoos accepted to SAT 2024.

Abstract

Boolean satisfiability (SAT) is an $\mathcal{NP}$-complete problem with important applications, notably in hardware and software verification. Characterising a SAT instance by a set of features has shown great potential for various tasks, ranging from algorithm selection to benchmark generation. In this work, we revisit the widely used SATZilla features and introduce a new version of the tool used to compute them.
In particular, we utilise a new preprocessor and SAT solvers, adjust the code to accommodate larger formulas, and determine better settings of the feature extraction time limits. We evaluate the extracted features on three downstream tasks: satisfiability prediction, running time prediction, and algorithm selection. We observe that our new tool is able to extract features from a broader range of instances than before. We show that the new version of the feature extractor produces features that achieve up to $25%$ lower RMSE for running time prediction, up to $5%$ higher accuracy for satisfiability prediction, and up to $80%$ higher closed gap for algorithm selection on benchmarks from recent SAT competitions.

Usage

We provide precompiled binaries for the SATZilla feature extraction tool for linux. Currently the SATZilla features extractor supports only linux.

SAT-feature-computation code contains the new SATZilla feature extraction tool.

Recompile by running make, then the executable features will be created.

To run a package-level smoke test for the extractor, use make test inside SAT-features-competition2024.

To compute features, simply run ./features [--timeout SECONDS] [--group-timeout SECONDS] [--preprocess-timeout SECONDS] [-base] [-structure] [-ncnf-graphs] [-ncnf-constraints] [-ncnf-rwh] [-dia] [-ls] [-lp] [-lobjois] INFILE OUTFILE Where -lp, -dia etc are the feature groups:

  • base: Base feature group, including pre, KLB, and clause graph
  • structure: Structural features from SATfeatPy
  • ncnf-graphs: New-CNF graph features
  • ncnf-constraints: New-CNF constraint features
  • ncnf-rwh: New-CNF recursive weight heuristic features
  • dia: Diameter
  • ls: Local search (both GSAT and Sparrow)
  • lp: Linear programming
  • lobjois: Lobjois
  • cl: Clause learning
  • unit: Unit propagation
  • sp: Survey propagation

To compute all features use the -all option. The input INFILE is a DIMACS CNF file. NOTE: currently, only raw CNF files are supported, and not compressed one (like .cnf.xz) The output is a CSV file containing the features for one instance.

Timeout controls:

  • --timeout: total extraction timeout
  • --group-timeout: per-feature-group timeout override; timed-out groups emit reserved values and extraction continues with the next selected group
  • --preprocess-timeout: timeout override for the preprocessing step

Python Interface

Install from PyPI:

pip install satzilla

An importable Python interface is available in the satzilla_features package. It accepts PySAT CNF formulas directly and calls the extractor through a bundled shared library using ctypes; it does not shell out to the CLI.

PySAT documents that pysat.formula.CNF exposes clauses and nv, and supports DIMACS I/O: https://pysathq.github.io/docs/html/api/formula.html

Example:

from pysat.formula import CNF
from satzilla_features import extract_features

cnf = CNF(from_clauses=[[-1, 2], [-2, 3], [1, 3]])
features = extract_features(
    cnf,
    groups=["base", "structure", "ncnf-graphs"],
    group_timeout=180,
)
print(features["variable_alpha"])

You can also extract directly from a CNF file path with extract_features_from_path(...). Both Python entry points accept timeout=..., group_timeout=..., and preprocess_timeout=....

When building the Python package, the C/C++ extractor is compiled into libsatzilla_features.so and packaged together with the solver binaries it needs at runtime. The direct Python interface is currently Linux-only.

Experiments

rt_pred.py contains the code for running time prediction. sat_pred.py contains the code for satisfiability prediction. Both are using submitit for execution on a SLURM cluster. For algorithm selection, the scenarios are available in the aslib directory. The AutoFolio code is available at https://github.com/hadarshavit/AutoFolio.

Contact

To contact us, please send an email to shavit@aim.rwth-aachen.de

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

satzilla-0.0.1.tar.gz (7.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

satzilla-0.0.1-py3-none-any.whl (5.1 MB view details)

Uploaded Python 3

File details

Details for the file satzilla-0.0.1.tar.gz.

File metadata

  • Download URL: satzilla-0.0.1.tar.gz
  • Upload date:
  • Size: 7.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for satzilla-0.0.1.tar.gz
Algorithm Hash digest
SHA256 154912eb0f39e14ac381e199b9ad0ea4517e0c80bd13f7e29c7ba2c969e3f496
MD5 4cf7eca6e4edc7db7e14374ada02eb39
BLAKE2b-256 aa54205e91b74ec1981e123c04ec79b100e6a698d02042c594bade32b42dd138

See more details on using hashes here.

Provenance

The following attestation bundles were made for satzilla-0.0.1.tar.gz:

Publisher: publish.yml on hadarshavit/satzilla

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file satzilla-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: satzilla-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for satzilla-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee0ae593e6441a8ddfc53b044dde9acfd0cbc3472d95cc47c50e6decbd5c5aa9
MD5 8b43485819932836d23fb325279a3530
BLAKE2b-256 fe23198c3d031cb216fa2c78a2a0f1bd83d3810ce6436206edcc9b2925f3bea8

See more details on using hashes here.

Provenance

The following attestation bundles were made for satzilla-0.0.1-py3-none-any.whl:

Publisher: publish.yml on hadarshavit/satzilla

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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