ENFORCE: Hard-constrained neural networks in Python

ENFORCE: Hard-constrained neural networks in Python

ENFORCE is an open-source Python package for neural networks that satisfy nonlinear equality and inequality constraints, for constrained regression and self-supervised parametric optimization.

The package implements ENFORCE (Nonlinear Constrained Learning with Adaptive-depth Neural Projection): a neural network backbone combined with an adaptive-depth neural projection module (AdaNP) that corrects the network output until the constraint residual falls below a set tolerance. It includes tutorial notebooks, benchmark problems, and examples for constrained regression and parametric optimization.

The method, its application regimes, and the related publications are described on the project page ENFORCE: Nonlinear constrained learning with adaptive-depth neural projection.

Open-source code

Key publications

  • Lastrucci, G., & Schweidtmann, A. M. (2025). ENFORCE: Nonlinear constrained learning with adaptive-depth neural projection. arXiv preprint. arXiv:2502.06774 · Details