Deep neural networks have emerged as incredibly fast surrogates for traditional optimization solvers, offering speedups of $10^2\times$ to $10^4\times$ across domains like power grid management, scheduling, and wireless beamforming. However, standard neural networks operate as black-box statistical approximators. While they excel at minimizing an average loss, they lack the structural awareness required to respect rigid, real-world boundaries.
In safety-critical systems, a small prediction error isn't just a minor statistical deviation—it can mean a physically impossible schedule, an unstable power grid, or a violated safety limit. As noted by Ferdinando Fioretto et al. in End-to-End Constrained Optimization Learning: A Survey, standard architectures typically achieve only near-feasibility.
Why not just use soft penalties, like adding a constraint violation term to the loss function? Soft penalties act as gentle guides during training, but they fail to provide absolute mathematical guarantees at inference time. To bridge this gap, a new paradigm has emerged: embedding hard constraint satisfaction directly into the neural network's architecture, training loop, or post-processing pipeline.
Geometric Projection Layers
One of the most intuitive ways to guarantee feasibility is to let the neural network output an unconstrained prediction and then mathematically "snap" it back onto the feasible region using a specialized layer.
Imagine the set of all valid solutions as a geometric shape—such as a polytope for linear constraints or a smooth manifold for non-linear ones. A projection layer takes the invalid neural output and finds the mathematically closest point inside this valid shape.
Unconstrained Output ──> [ Projection Layer ] ──> Feasible Output
│
(Snaps to valid boundary)
To train such a network end-to-end, the projection step must be differentiable so that gradients can flow backward through the layer. Panagiotis D. Grontas introduces this concept in Pinet: Optimizing hard-constrained neural networks with orthogonal projection layers, utilizing operator splitting and the Implicit Function Theorem to build fast, memory-efficient orthogonal projection layers. Similarly, Hongtai Zeng et al. propose GLinSAT: The General Linear Satisfiability Neural Network Layer By Accelerated Gradient Descent, which reformulates projection as an entropy-regularized optimization solved via accelerated gradient descent, bypassing expensive matrix factorizations.
What if the constraint boundaries are highly complex or non-convex? In Low Complexity Homeomorphic Projection to Ensure Neural-Network Solution Feasibility for Optimization over (Non-)Convex Set, Enming Liang introduces "Homeomorphic Projection." This approach uses an Invertible Neural Network to map complex, non-convex constraint boundaries into a simple unit sphere. Projecting onto a sphere is computationally trivial, allowing the network to achieve exact feasibility guarantees with minimal overhead.
Preventive Learning and Feasibility-Seeking Loops
Rather than projecting outputs after the network has made its guess, another strategy alters the optimization landscape during training or embeds iterative correction loops directly into the forward pass.
In Ensuring DNN Solution Feasibility for Optimization Problems with Linear Constraints, Tianyu Zhao et al. introduce preventive learning. Instead of training the network on the exact boundaries of the problem, the authors systematically "shrink" the constraints during training. By combining this tightened boundary with an adversarial-sample aware algorithm, they ensure that even if the network makes minor prediction errors at test time, the final outputs still fall safely within the true, un-shrunk physical boundaries.
True Constraint Boundary: [─────────────────────────────]
Shrunk Training Boundary: [─────────────────────────]
Neural Output with Error:
* (Safe from true boundary)
Alternatively, networks can embed an internal correction loop. Hoang T. Nguyen et al. develop FSNet: Feasibility-Seeking Neural Network for Constrained Optimization with Guarantees, which integrates a differentiable, iterative feasibility-seeking step directly into the forward pass. This allows the network to dynamically self-correct any constraint violations before producing its final output, achieving up to 1000x speedups over traditional solvers while maintaining rigorous guarantees.
Hybrid Predict-and-Search Frameworks
For complex combinatorial problems like Mixed-Integer Linear Programming (MILP) or scheduling, continuous projection layers are insufficient because the decision variables are discrete (e.g., deciding whether to route a vehicle or activate a generator). In these scenarios, researchers use a hybrid approach: the neural network predicts the continuous structure or likelihood of the solution, and a traditional symbolic solver handles the hard constraints.
For example, Qingyu Han et al. propose a framework in A GNN-Guided Predict-and-Search Framework for Mixed-Integer Linear Programming where a Graph Neural Network predicts variable assignments, and a traditional solver searches within a flexible "trust region" around those predictions. This leverages the speed of neural networks to prune the search space while relying on the mathematical rigor of classical solvers to guarantee absolute feasibility.
This strategy is echoed by Jun Kang Yap et al. in Transformer-based Deep Learning Model for Joint Routing and Scheduling with Varying Electric Vehicle Numbers, where deep learning prunes the search space for electric vehicle routing, achieving massive reductions in computation time without sacrificing constraint satisfaction.
Why Data Scaling Alone Fails
Can we simply solve the feasibility problem by training larger models on more data? Empirical evidence suggests otherwise.
In Scaling Laws of Machine Learning for Optimal Power Flow, Xinyi Liu et al. establish the first systematic scaling laws for machine learning in power systems. Their findings reveal a critical divergence: while raw prediction accuracy improves rapidly with more data and compute, the rate of physical constraint violations does not decrease at the same pace.
This bottleneck underscores why hard constraint enforcement is a distinct and mandatory field of research. Purely data-driven scaling is an inefficient path to reliability; instead, physical and mathematical laws must be explicitly baked into the architecture of neural solvers.