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.2.0.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aspish-0.2.0.tar.gz.
File metadata
- Download URL: aspish-0.2.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
757e5c50930767092becd3883e342be5fa13b75a847616504cc2a58f33d0056b
|
|
| MD5 |
ec0a13803ae0f864329f7004c1c648eb
|
|
| BLAKE2b-256 |
a065916016c0c6365da230c3fcaeab7b08b4996e294465c2a6801b65e76af238
|
File details
Details for the file aspish-0.2.0-py3-none-any.whl.
File metadata
- Download URL: aspish-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d44110d3bf19a877e99ef5452cf01c195cc49aa1d3c742d323d8952b6a8657ad
|
|
| MD5 |
dbc837be948013dbf334b33b0e0415e0
|
|
| BLAKE2b-256 |
f31c05878421cb219f148734000964133caa25901159403974ad200b09c9bdea
|