Extra solver backends for pycsp3 (OR-Tools, IBM CPO)
Project description
pycsp3-solvers-extra
Extension library that adds some extra solver backends to pycsp3.
Supported Solvers
- OR-Tools CP-SAT - Google's constraint programming solver
- IBM DOcplex CP Optimizer - IBM's CP solver (requires CPLEX Studio)
Installation
pip install pycsp3-solvers-extra
Dependencies
pycsp3- base constraint modeling libraryortools- for OR-Tools backenddocplex- for CPO backend (requires IBM CPLEX Studio installed separately)
Usage
from pycsp3 import *
from pycsp3_solvers_extra import solve
# Define your model
x = VarArray(size=3, dom=range(1, 10))
satisfy(AllDifferent(x))
minimize(Sum(x))
# Solve with OR-Tools
status = solve(solver="ortools")
# Or solve with CPO
status = solve(solver="cpo")
# Of course, you still can use the native supported pycsp3 solvers as well ('ace', 'choco')
status = solve(solver="ace")
# Access solution values
print([v.value for v in x])
API
solve(
solver="ortools", # "ortools" or "cpo"
time_limit=None, # seconds
sols=None, # number of solutions to find
verbose=0, # verbosity level (0-2)
options="" # solver-specific options
)
Returns TypeStatus.SAT, TypeStatus.OPTIMUM, TypeStatus.UNSAT, or TypeStatus.UNKNOWN.
Examples
See the examples/ directory:
python examples/send_more_money.py --solvers ortools cpo
Running Tests
pytest tests/ -v
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
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 pycsp3_solvers_extra-0.1.2.tar.gz.
File metadata
- Download URL: pycsp3_solvers_extra-0.1.2.tar.gz
- Upload date:
- Size: 29.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b95eeb1946bbf3fa4476a2d30e5fd6197a89835feaa48ee1fea9821a3a2f5145
|
|
| MD5 |
761ee1acfa43cf2ee68fd88244cdc0b2
|
|
| BLAKE2b-256 |
71648ef9928c7e0a367661922e4eca03c0bc3acf9edbbfea084f701b9ac71725
|
Provenance
The following attestation bundles were made for pycsp3_solvers_extra-0.1.2.tar.gz:
Publisher:
publish.yml on sohaibafifi/pycsp3-solvers-extra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycsp3_solvers_extra-0.1.2.tar.gz -
Subject digest:
b95eeb1946bbf3fa4476a2d30e5fd6197a89835feaa48ee1fea9821a3a2f5145 - Sigstore transparency entry: 808981502
- Sigstore integration time:
-
Permalink:
sohaibafifi/pycsp3-solvers-extra@e7cb1d6900686a2f3455ad85a9d51c2de53cf320 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/sohaibafifi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e7cb1d6900686a2f3455ad85a9d51c2de53cf320 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pycsp3_solvers_extra-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pycsp3_solvers_extra-0.1.2-py3-none-any.whl
- Upload date:
- Size: 31.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c91fbb4a46b0bcdc50917c20a1910f67e7fbf6c7b8d32a3f32b756abb5b265f
|
|
| MD5 |
5df3be3edeb8be5270454c759249ad43
|
|
| BLAKE2b-256 |
6082088ef82c0b20d192a84c34949bc0d803f2b3c3615cdca255f57e6b710225
|
Provenance
The following attestation bundles were made for pycsp3_solvers_extra-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on sohaibafifi/pycsp3-solvers-extra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycsp3_solvers_extra-0.1.2-py3-none-any.whl -
Subject digest:
7c91fbb4a46b0bcdc50917c20a1910f67e7fbf6c7b8d32a3f32b756abb5b265f - Sigstore transparency entry: 808981507
- Sigstore integration time:
-
Permalink:
sohaibafifi/pycsp3-solvers-extra@e7cb1d6900686a2f3455ad85a9d51c2de53cf320 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/sohaibafifi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e7cb1d6900686a2f3455ad85a9d51c2de53cf320 -
Trigger Event:
push
-
Statement type: