Skip to main content

Quality-of-life and extra features for python-sat

Project description

Sugar Rush

Additions to python-sat (https://github.com/pysathq/pysat) to automate some things. Extra features:

  • Convert disjunction of CNFs to an equivalent CNF
  • Automatic optimization using ITotalizer (binary search)

Design rules

  • Only one method adds constraints to the model (solver.add). Other methods only return the clauses that define the constraint. The reason is that the user may want to negate or reify the constraint, i.e. the user may not wish to use the specific constraint. Another benefit is that the user can easily grep in the model definition code for all places where constraints are added to the model. This simplifies debugging.
  • The solver's state should only consist of 3 parts:
    1. The active CNF.
    2. The used literals.
    3. The solution values to a satisfied model.
    4. can of course be computed directly from 1), but is kept for performance.
  • The used literals can only be added to, and that should only be done via a single method (solver.var). The reason is to prevent strange bugs that result from re-using literals that are not meant to be equal.
  • The solution values to a satisfied model should only be accessible from a single method (solver.solution_value). The reason is to prevent bugs resulting from different sets of solution values being different from each other.
  • All methods names should be lowercase. Underscore is used to separate words.

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

sugarrush-0.0.5.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

sugarrush-0.0.5-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file sugarrush-0.0.5.tar.gz.

File metadata

  • Download URL: sugarrush-0.0.5.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

File hashes

Hashes for sugarrush-0.0.5.tar.gz
Algorithm Hash digest
SHA256 71b7bfc2414c32b3c46dbdf8619ae7cf62b0b54be93ca785677644a1e7d4f826
MD5 198c69b774a3df46470d74e85e3a767f
BLAKE2b-256 1cc39a52b2b4640c3b9f0729c66d498461e02d30b5367e60666e14ec475ec8b3

See more details on using hashes here.

Provenance

File details

Details for the file sugarrush-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: sugarrush-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

File hashes

Hashes for sugarrush-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 89a19bdb2b57636a9181ee4eddd2fb8b2a35dab8daeeed35f297eebefbb56578
MD5 ed27d3f2e9a39350e9560620335575ce
BLAKE2b-256 19fcc621134192b476a606d804cac19020dcddbdb7d05563e78319b7b5000d60

See more details on using hashes here.

Provenance

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