This release is a pre-release and may not be stable for production use.
Aperture Python API
Aperture is a SAT-based optimization solver providing a Python interface for:
- SAT solving – check satisfiability of CNF Boolean formulas
- MaxSAT solving – minimize satisfied (weighted) soft literals
- OBV solving – optimize modulo bit-vector problems
- Black-box optimization – optimize generic objective functions
All solving quiries can be called incrementally under assumptions.
Quick Start
import aperture as ap
solver = ap.Solver(sat_solver="topor")
x = solver.new_var()
y = solver.new_var()
solver.add_clause(ap.lits([x, y])) # x OR y
sat = solver.solve()
if sat:
print("SAT")
print(solver.get_latest_solution())
else:
print(solver.get_latest_solve_status())
Supported SAT Solvers
"topor""cadical""glucose"(default)"kissat"– initial SAT query only
Core Methods
| Method | Purpose |
|---|---|
new_var() |
Create a new Boolean variable |
add_clause(lits) |
Add a clause |
solve(assumptions=[]) |
Solve SAT |
solve_maxsat(assumptions, soft_lits, fix_model_value, callback_on_solution_found=None) |
Solve MaxSAT |
solve_weighted_maxsat(assumptions, soft_wlits, fix_model_value, callback_on_solution_found=None) |
Solve weighted MaxSAT |
solve_obv(assumptions, targets, callback_on_solution_found=None) |
Optimize bit-vectors |
solve_black_box(assumptions, observables, pb_func, callback_on_solution_found=None) |
Black-box optimization |
get_latest_solution() |
Get solution (assignment) of the last solve query |
get_latest_solve_status() |
Get status ("SAT", "UNSAT", "ERROR", "UNKNOWN") |
Constraints
Add cardinality and pseudo-Boolean constraints:
add_constraint_less_than((w)lits, rhs, selector=None)add_constraint_less_than_equal((w)lits, rhs, selector=None)add_constraint_equal(lits, rhs, selector=None)add_constraint_greater_than_equal(lits, rhs, selector=None)add_constraint_greater_than(lits, rhs, selector=None)
All methods return bool ans supports adding an optional selector to all the generated clauses.
Note that currently only < and <= constraints are supported for weighted literals (wlits).
Documentation
For further information and examples, see the notebook in the docs/ directory. ReadTheDocs documentation will be available in the future.
Metadata
Release files for aperture-solver 0.1.0.dev2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aperture_solver-0.1.0.dev2.tar.gz | 3.6 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aperture_solver-0.1.0.dev2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.7 MB
Release files / aperture_solver-0.1.0.dev2.tar.gz
| Download URL | aperture_solver-0.1.0.dev2.tar.gz |
|---|---|
| Size | 3.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9014f973ccec9001ea19dce32625bf2ea41902acf4bd9896b16e486736fad05
|
|
BLAKE2b-256 checksum How to use checksums |
67b45c763101605b6a92de01259fde7f062ec323a1a0f87245dd1d57992425e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / aperture_solver-0.1.0.dev2-py3-none-any.whl
| Download URL | aperture_solver-0.1.0.dev2-py3-none-any.whl |
|---|---|
| Size | 2.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9af30900d8a6048654a6d9cdfa84d58a77bc7808b9d764edfd16dbbeba69864
|
|
BLAKE2b-256 checksum How to use checksums |
96847fa963dddb98650a224493b99744429dbaef134fd1f58de8f01756dc6fc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for aperture-solver 0.1.0.dev2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.