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
[path(x=1, y=2), path(x=2, y=3), path(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.5.0.tar.gz (5.2 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.5.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aspish-0.5.0.tar.gz
  • Upload date:
  • Size: 5.2 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.5.0.tar.gz
Algorithm Hash digest
SHA256 cd2d22957bcbeea1d508fa74673c3cfaee13363993a341c7ecda1232a0ff7177
MD5 580e35b229905770827b79e24f678142
BLAKE2b-256 338a85ca590dd08609badc14dcd61b488e6964d05d9ff3135910576c686847ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aspish-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb8178d2cdce82df4339d7f8b806fa47fa1a072cbb0bfe5586101056165ae4dc
MD5 95202715d3b6179521eff50a9f8cabbc
BLAKE2b-256 d7a031d750344b0293973a7b3cf3db23914aeebe11c659f79864ab7f160b23cd

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