arXiv:2610.32914cs.LGOct 2026

Manuscript Offprint

arXiv:2610.32914

A Tutorial on Physics Constrained Machine Learning for Hybrid Modeling, Optimization, and Control

Rahul Golder, Bimol Nath Roy, MM Faruque Hasan

Abstract

Physics-constrained machine learning (PCML) integrates domain knowledge, first-principles, and physical constraints into AI/ML models. In this work, we present a step-by-step tutorial of a modular PCML framework, KKT-HardNet, and illustrate how it could be used for hybrid modeling, process simulation, optimization and model predictive control in a single platform. KKT-HardNet combines fast inference capabilities of neural networks with guaranteed satisfaction of algebraic constraints through differential projection. It can handle heterogeneous data and enforce both linear and nonlinear equality and inequality constraints. The modular design supports custom neural-network backbones and user-defined projection mechanisms for PCML. To enable efficient end-to-end training, KKT-HardNet exploits implicit function theorem to backpropagate through the projection layer. This avoids computationally expensive automatic differentiation. This work also introduces an exact reduced-order Fischer–Burmeister reformulation and a primal–dual interior-point method as an alternative projection solve strategy. We also provide a diverse set of benchmarking problems for PCML in engineering applications. KKT-HardNet achieves orders of magnitude better performance in terms of both constraint satisfaction and inference time. The KKT-HardNet code and the benchmark datasets are available at https://github.com/souls-tamu/kkt-hardnet.

https://github.com/souls-tamu/kkt-hardnet

pip install kkt-hardnet

Keywords: Scientific Machine Learning, Hybrid Modeling, Physics Informed Neural Networks, Optimization, Process Control

∗^{*}Corresponding author: hasan@tamu.edu

Preprint. October 26, 2026

Contents

1 Introduction ..... 2
2 KKT-HardNet: A Physics Constrained Machine Learning Framework ..... 4
2.1 Neural Network Backbone ..... 4
2.2 Projection Layer ..... 6
2.3 Loss Function and Backpropagation ..... 7
2.4 A Modular Python Package (pip install kkt-hardnet) ..... 8
3 PCML for Hybrid Modeling ..... 11
3.1 Hybrid Modeling of Chemical Processes ..... 11
3.2 Hybrid Modeling of a Two-Phase Reactor-Condensor System ..... 12
4 PCML for Real-Time Optimization ..... 16
4.1 A CSTR Optimization Case Study ..... 16
5 PCML-based Model Predictive Control ..... 19
5.1 A CSTR Control Example ..... 20
6 PCML for Grey-Box Optimization ..... 27
6.1 Simulation-based Optimization of a Syngas Production Process ..... 27
7 Conclusions ..... 32
A Benchmarking: metrics and other methods ..... 36
B Methods Included to Solve the Projection Problem ..... 36
C Reduction and Heuristics on KKT Conditions via Fishcer-Burmeister Reformulation ..... 37
D Additional Closed-Loop Analysis of the RTO–LMPC Framework ..... 38
E Multi-Start Projected Adam Optimization ..... 40

References (38)