NeurIPS 2025

Enforcing convex constraints in Graph Neural
Networks
Ahmed Rashwan ˚
University of Bath
Keith Briggs
BT Research
Chris Budd
University of Bath
Lisa Kreusser
University of Bath and Monumo
Abstract
Many machine learning applications require outputs that satisfy complex, dy-
namic constraints. This task is particularly challenging in Graph Neural Network
models due to the variable output sizes of graph-structured data. In this paper,
we introduce ProjNet, a Graph Neural Network framework which satisfies input-
dependant constraints. ProjNet combines a sparse vector clipping method with the
Component-Averaged Dykstra (CAD) algorithm, an iterative scheme for solving
the best-approximation problem. We establish a convergence result for CAD and
develop a GPU-accelerated implementation capable of handling large-scale in-
puts efficiently. To enable end-to-end training, we introduce a surrogate gradient
for CAD that is both computationally efficient and better suited for optimization
than the exact gradient. We validate ProjNet on four classes of constrained op-
timisation problems: linear programming, two classes of non-convex quadratic
programs, and radio transmit power optimization, demonstrating its effectiveness
across diverse problem settings.
1
Introduction
In many machine learning (ML) applications, model outputs must satisfy certain constraints to en-
sure feasibility, safety, or interpretability [22, 40]. A common approach to enforcing constraints
is through activation functions (e.g., Sigmoid, Softmax) in the output layer [41], which restrict
outputs to a predefined set. However, while effective for simple linear or box constraints, this ap-
proach is not applicable for more complicated types of constraints. Many real-world applications
require complex, data-dependent constraints. For example, in robotics, constraints can encode fea-
sible movements or collision avoidance [21, 54, 63]. Similarly, in energy systems, power generation
limits vary with demand fluctua...