CPMpy
a Constraint Programming and Modeling library in Python, based on numpy, with direct solver access.

Description:
CPMpy is a Python library for constraint programming and modeling, based on numpy with direct solver access. It is intended for combinatorial problems with Boolean and integer variables. It provides many high‑level constraints that are automatically decomposed when not natively supported by the underlying solver. It is lightweight, well-documentend, used in research and industry, and easy to install via “pip install cpmpy.”
CPMpy is solver‑agnostic and supports CP, ILP, SMT, PB, and SAT backends; it is ML‑friendly through NumPy-based decision variables with vectorized operations and constraints; it enables incremental solving via assumption variables and dynamic constraints and objectives; and it is extensively tested through a large test suite and active fuzz testing. Additional tools support parameter tuning, debugging, explanation generation, and XCSP3 benchmarking, and the library remains flexible for extending constraints or integrating new solvers, with direct solver access when needed.
It can translate to a wide variety of constraint solving paradigms, including both commercial and open-source solvers. CP solvers include OR‑Tools (default), IBM CP Optimizer, Choco, Glasgow GCS, Pumpkin, and MiniZinc-compatible solvers; ILP solvers include Gurobi and CPLEX; GO uses Hexaly; SMT uses Z3; PB uses Exact; and multiple SAT encoders and solvers are supported through PySAT and Pindakaas. Decision diagram reasoning is available via PySDD.
More Information:
Originates from the AI-Driven Data Science research challenge (FAIR 2019–2023)
Responsible Research Lead: Tias Guns
Authors: Tias Guns, Ignace Bleuckx, Thomas Sergeys
Programming Language: Python
Categories: Optimization
Publications:
Tias Guns, "Increasing modeling language convenience with a universal n-dimensional array, CPpy as python-embedded example", in Proceedings of the 18th workshop on Constraint Modelling and Reformulation at CP (Modref 2019), vol. 19, 2019.