ENFORCE: Nonlinear constrained learning with adaptive-depth neural projection
Neural networks are increasingly used as surrogate models and decision-support methods in engineering. However, their predictions often fail to satisfy physical, operational, or safety-related constraints.
In ENFORCE, we develop a hard-constrained neural network architecture that embeds nonlinear equality and inequality constraints directly into the prediction pipeline. The framework combines a neural network backbone with an adaptive-depth neural projection module, AdaNP, which iteratively corrects the network output until the constraint residual falls below a prescribed tolerance. This allows the model to produce predictions that are not only accurate, but also feasible with respect to the underlying domain knowledge.
The method supports two main application regimes:
- Constrained supervised regression: neural networks are trained as surrogate models for engineering systems while respecting known physical or process constraints.
- Self-supervised parametric optimization: the model learns to map problem parameters directly to feasible optimal solutions.
ENFORCE handles both nonlinear equality and inequality constraints. Inequality constraints are incorporated through a Fischer–Burmeister reformulation. For affine constraints, feasibility can be recovered exactly in a single projection step, while for nonlinear constraints the adaptive projection recovers feasibility up to a user-defined tolerance.
With ENFORCE, we aim to contribute to hybrid neural network models that do not only fit data, but also respect the structure, constraints, and safety requirements of the systems they are meant to represent.
ENFORCE is part of our research on hybrid modeling and physics-informed machine learning.
Software
ENFORCE is available as an open-source Python package, including the implementation, tutorial notebooks, benchmark problems, and examples for constrained regression and parametric optimization. See the ENFORCE software page.
- Code: GitHub repository
- Install:
pip install enforce-nn
Key publications
- Lastrucci, G., & Schweidtmann, A. M. (2025). ENFORCE: Nonlinear constrained learning with adaptive-depth neural projection. arXiv preprint. arXiv:2502.06774 · Details
- Lastrucci, G., Karia, T., Gromotka, Z., & Schweidtmann, A. M. (2025). Picard-KKT-hPINN: Enforcing nonlinear enthalpy balances for physically consistent neural networks. Systems and Control Transactions (Proceedings of ESCAPE 35). doi:10.69997/sct.108423 · Details