PyConA: Constraint Acquisition in Python
PyConA (https://github.com/CPMpy/PyConA) is a python-based, open-source package for Constraint Acquisition (CA). In CA, the goal is to assist the user in modeling Constraint Programming (CP) problems, by learning the constraints through user interaction.
PyConA is based on the powerful CPMpy Constraint Programming and Modeling library in python (https://github.com/CPMpy/cpmpy), which is used for modeling the constraint problems.
Currently, only interactive CA methods are implemented in PyConA; passive CA methods might be added later.
Interactive Constraint Acquisition
In interactive CA, the system interacts with an Oracle, which can be a human user or a software system. The CA system asks queries and based on the answers of the oracle it either learns or excludes constraints.
PyConA is a generic CA library implementing a range of interactive CA methods, using the following modules:
- Interactive CA Algorithm: The top-level algorithm to be used.
- Query Generation: The query generation system to be used to generate top-level queries.
- FindScope: The FindScope system to be used for finding the scope of violated constraints.
- FindConstraint: The FindConstraint system to be used for finding the exact violated constraints in the given scopes.
A detailed presentation of CA methods can be found at:
Features
The repository has implemented various approaches and methods from the literature:
- Algorithms: QuAcq [1-2], MQuAcq [3-4], MQuAcq-2 [5], GrowAcq [6], P-QuAcq[7], G-QuAcq [8]
- Query Generation: TQ-Gen [9], PQ-Gen [6]
- FindScope: FindScope [1], Findscope-2 [2, 4]
- FindC: FindC [1], FindC-2 [2]
- ML-based CA system and query generation objectives from [10]
Installation
Clone and Install from this Repo
git clone -b main https://github.com/CPMpy/PyConA.git
Pip install through pip
You can install pycona through pip
pip install pycona
Basics
In PyConA, the ProblemInstance class represents the instance of the problem the user wants to acquire the constraints for. It must be initialized with the variables of the problem and a language. A CA system is then used to acquire the constraints. A CA system uses a CA environment to configure its options. PyConA currently implements only interactive CA algorithms (module .active_algorithms).The core of interactive CA systems is the AlgorithmCAInteractive class. This is subclassed with different algorithms presented in the literature.
Basic Tutorials
- Introductory Example: https://colab.research.google.com/github/CPMpy/PyConA/blob/main/notebooks/introductory_example.ipynb
- Comparing different algorithms and methods: https://colab.research.google.com/github/CPMpy/PyConA/blob/main/notebooks/Comparing%20different%20algorithms%20and%20methods.ipynb
- Prediction-based CA system: https://colab.research.google.com/github/CPMpy/PyConA/blob/main/notebooks/Prediction-based%20CA%20system.ipynb
- CP24 Tutorial Demo: https://colab.research.google.com/github/CPMpy/PyConA/blob/main/notebooks/CP24%20Tutorial%20Demo.ipynb
Documentation
Coming soon
References
Metadata
Release files for pycona 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pycona-0.4.1.tar.gz | 52.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pycona-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 127.9 kB
Release files / pycona-0.4.1.tar.gz
| Download URL | pycona-0.4.1.tar.gz |
|---|---|
| Size | 52.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8dad3208e835d09c0ea9fcd24b7c1501308fec89cc4bfa48c40fbf62ca9f72b
|
|
BLAKE2b-256 checksum How to use checksums |
af6deabad392cc354f54b23b0b08840eabecd9daf8eb59c3436d333559c116b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 12, 2025.
Transparency logRelease files / pycona-0.4.1-py3-none-any.whl
| Download URL | pycona-0.4.1-py3-none-any.whl |
|---|---|
| Size | 75.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49a140e7c023dcac3806bbec101bb4a64543a8da3d059ea975ee617e1d79dab9
|
|
BLAKE2b-256 checksum How to use checksums |
f5fcc9322ca96a16dcf557c8062229b6462a9924f33ba30b62e36860ac7436ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 12, 2025.
Transparency log