Skip to main content

Answer Set Programming with a friendly interface.

Project description

ASPish - Answer Set Programming for Python

aspish is an adjective meaning relating to, resembling, or having the qualities of an asp

ASPish is a library that aims to resemble ASP (Anser Set Programming) in a Python-friendly way.

Basic Usage

from aspish import Solver, predicate, var

# declarations
edge = predicate('edge', ('x', 'y'))
path = predicate('path', ('x', 'y'))

solver = Solver()
X, Y, Z = map(var, 'XYZ')

# add facts
solver.add(
    edge(1, 2),
    edge(2, 3)
)

# add rules
solver.add(
    path(X, Y) <= edge(X, Y),
    path(X, Y) <= (
        edge(X, Z),
        path(Z, Y)
    )
)

# run
solver.solve()
solver.get(path)

# returns
[{'x': 1, 'y': 2}, {'x': 2, 'y': 3}, {'x': 1, 'y': 3}]

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

aspish-0.3.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

aspish-0.3.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file aspish-0.3.0.tar.gz.

File metadata

  • Download URL: aspish-0.3.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/24.6.0

File hashes

Hashes for aspish-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b1180b8f6ca23435fb056d23c6604db9251d6d7671ad451509162bbb640464c2
MD5 00b866ee332f2c59120460992d920a11
BLAKE2b-256 372e67aa6db9dda68d40e9ac094dc55b55642b6fd3786eec4db1c9f25f095970

See more details on using hashes here.

File details

Details for the file aspish-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: aspish-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/24.6.0

File hashes

Hashes for aspish-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30eca6603b2f61a372ec5575db4b8ac55298fbb0a12d0cf9058a09a347939ede
MD5 e7d7218bb2f2771e517e2369d831957e
BLAKE2b-256 2b7895c60a684ba110a57046b2ea61bae14552b22daf9fb37d02e3280d1e57ec

See more details on using hashes here.

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