Answer Set Programming with a friendly interface.
Project description
ASPish - Answer Set Programming for Python
ASPish is a library that aims to provide some parts of ASP (Anser Set Programming) in a Python-friendly way. All the heavy lifting is done by clingo, a mature implementation of ASP. This library merely provides an interface that allows for a more streamlined usage from Python than the official Python bindings.
ASP can be approximately viewed as the combination of query language that extends datalog, and a satisfiability solver. Both are integrated into a single coherent language which makes ASP particularly convenient when dealing with relational data.
This project is in early stages and is not stable.
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
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.7.0.tar.gz.
File metadata
- Download URL: aspish-0.7.0.tar.gz
- Upload date:
- Size: 6.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28ad4273aef60c371b8721ae7464edf06b9fc847320633287d16a73940c73fac
|
|
| MD5 |
d67f36fb02075cea9df6f91664f6fc70
|
|
| BLAKE2b-256 |
724f9a1528cc00cb4379d28931032efd1ed13a742b29fe4113f04c9a82554424
|
File details
Details for the file aspish-0.7.0-py3-none-any.whl.
File metadata
- Download URL: aspish-0.7.0-py3-none-any.whl
- Upload date:
- Size: 9.2 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 |
e63d1b59394f23fef59c47667c48ead9a59d227ebec486b81c380df8c5806acb
|
|
| MD5 |
b34e89c5256c02080b383c474fe072a0
|
|
| BLAKE2b-256 |
8dc65d82377d6332f6e7aa10894d508fb9a948ee1805386ad0705a20a4720e08
|