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.4.0.tar.gz (3.9 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.4.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aspish-0.4.0.tar.gz
  • Upload date:
  • Size: 3.9 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.4.0.tar.gz
Algorithm Hash digest
SHA256 da8e8d056468bc9931f831ee75256a3fc7a4af9684d00d6130e95d0a46f7c9ac
MD5 13d5e75866d59e453f11e1c2288c0d55
BLAKE2b-256 4fab55415cad99432fde4738f166f7c21831f357a5352dfa17f8c7e3731f4705

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aspish-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c894ce666597ff90ee515841761e57368264c00e3a28b39873e774ede93a705a
MD5 9e2dfced4cd7cacc0a4dac504f280656
BLAKE2b-256 594b5b68300d0c64924cf3a65fc98ea8163df63d203f67f4599a0638058c5677

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