A power-grid operator must choose how much power each generator should produce to meet demand. A neural network trained on past solutions can suggest a dispatch quickly, but even a small error can violate a generator limit. Homeomorphism methods represent the feasible region in simpler coordinates, where valid decisions are easier to construct.
Follow the copper point: what stays the same as it moves from the disk to the target region?
Figure 01 Follow a ray from coordinates to a decision
1. Choose a coordinate. Pick inside the reference ball . Its direction selects a ray; its radius gives the fraction of that ray to use.
2. Scale the ray. Find where the same direction meets the boundary of . Scale the point to keep the same fraction of that ray.
3. Read the decision. Apply to obtain inside . The inverse map takes that decision back to its unique reference coordinate.
The relative position along each ray stays the same. This example uses an exact analytic gauge map.
The same coordinate map supports three tasks: recovering an infeasible prediction, optimizing a decision, and learning a distribution of feasible samples.
A feasible set, in different coordinates
Let contain the admissible decisions, and let be the unit ball: all coordinates with length at most one. In our 2D figures, is a filled disk. The point is a reference coordinate; is the actual decision. A homeomorphism pairs each in with exactly one in , and its inverse takes back to . Both directions are continuous: small changes remain small in either coordinate system. The map can still stretch or compress distances.
With , any coordinate in the ball decodes to a feasible decision. Constraint handling shifts to keeping coordinates inside the ball, where projection is a simple calculation.
The inverse map brings existing decisions and training data into reference coordinates. A homeomorphism preserves topology even when it changes the region’s shape.

What changes when the same coordinates support recovery, optimization, or sampling?
Figure 02 One representation, three different operations
- Learning
- Recover an infeasible prediction by searching along a ray in reference coordinates. Map each probe back to check the original constraints.
- Optimization
- Update the coordinates, project the new iterate onto the ball if needed, then map it back to a feasible decision.
- Sampling
- Generate samples in the ball with a reflected flow, then decode them into feasible decisions.
Constructing the map: follow a ray
For a compact convex set with nonempty interior, a gauge map uses rays from an interior point . Each ray reaches the boundary at a unique distance. Rescaling the corresponding ball radius by that distance gives the map.
Write , where is a unit direction and . If is the distance from to the boundary along , the map is
The map preserves the relative distance along each ray: halfway to the ball boundary maps halfway to the target boundary, and a boundary point maps to the target boundary. The figures and explorer use .
Tabas and Zhang use gauge maps to turn bounded neural-network outputs into state-dependent safe actions for reinforcement learning,[1] and into feasible control sequences for model predictive control (MPC).[2] Their reference domain is an unit ball—a box with each coordinate between −1 and 1—rather than the Euclidean ball illustrated here. Both constructions rescale rays from an interior point.
Set the radius to 1, then change the direction. Where does the mapped point go?
Blue marks the reference boundary, teal the target boundary, and copper the corresponding point and ray.
Radius 0 maps to the center; radius 1 maps to the boundary. Changing direction selects a different ray in both domains.
In the star-shaped example, each ray still reaches a single boundary point, varying continuously with direction. These properties let the radial construction work despite nonconvexity; arbitrary nonconvex regions need not have them.
The map’s cost lies in evaluating the boundary distance. Linear, quadratic, and conic constraints allow structured calculations; general convex constraints can use a one-dimensional search along each ray. The implementation provides these calculations.
Learning: recover a usable prediction
The explorer constructs a feasible decision from a coordinate. A predictor can use this decoder directly, or keep its existing output representation and use the map to recover an infeasible prediction.
Construct the output in feasible coordinates. With an exact map onto the feasible set, a network can predict , enforce , and return . For input-dependent constraints, use the map for that input. Training through the decoder lets the model account for how its coordinates become decisions. A related feasible-output construction appears in RAYEN, an output layer that enforces supported convex constraints.[3]
Recover a prediction after it is made. Here the predictor outputs a decision, while a separate invertible network learns the coordinate map. Coupling-based networks are one established choice, with approximation properties studied by Teshima et al.[4] In Homeomorphic Projection, the network remains invertible outside the feasible region. It can therefore inverse-map an infeasible prediction, recover a feasible point in reference coordinates, and map it back.[5]
Choose a reference-space center whose mapped decision is known to be feasible, then bisect the segment from the prediction’s reference coordinate to that center. Map each midpoint back, test the original constraints, and retain a feasible endpoint as the interval narrows. Return that endpoint’s mapped decision. These checks remain necessary because an invertible learned map need not map its ball exactly onto the true feasible set.
This recovery need not return the Euclidean nearest feasible decision. If the map stretches a direction strongly, a small move in reference coordinates can become a large change in dispatch. Learning a map with small distortion helps keep that correction modest. The paper relates the loss to prediction error, map approximation, distortion, and bisection accuracy.
Optimization: improve the decision inside the ball
Prediction recovery repairs a given decision; optimization searches for a low-cost one. Minimizing over is equivalent, under an exact homeomorphism, to minimizing the composite objective over . Every feasible decision has a coordinate, so the best objective value is preserved.
When projection onto is expensive, Hom-PGD can replace it with ball projection, map evaluation, and differentiation. It takes a gradient step on the transformed objective, projects onto , and maps the iterate back.[6] With step size , the update is
is projection onto the unit ball: keep a point if its length is at most one; otherwise divide it by its length. The gradient is taken with respect to the reference coordinate , so it accounts for how the map changes the decision. The method avoids projection onto the original set ; feasibility of each decoded iterate relies on the map and numerical operations.
A nonlinear map can turn even a convex objective into a nonconvex one. Under the paper’s regularity assumptions, Hom-PGD matches standard unaccelerated first-order convergence rates. Map distortion affects the constants and practical conditioning; the choice of interior center can also influence convergence speed.
Sampling: learn the distribution in simple coordinates
Optimization seeks one low-cost decision. Sampling aims to produce a collection of feasible dispatches with patterns and frequencies learned from data. The point clouds below show why a feasible map alone cannot meet that requirement.
Mapping points also moves probability mass
Where do points become crowded, and where do they spread out after the map?
Figure 03 The same points, a different density
Even uniform samples in the ball generally become nonuniform after mapping. A region that expands under receives the same probability mass spread over more area. A compressed region receives denser mass.
These clouds show geometric mapping without a trained generative model. For a smooth invertible map, local volume change determines the change in density—the principle behind normalizing flows.[7] To match a dataset of dispatches, the model must learn the corresponding distribution in ball coordinates.
Flow matching learns a velocity field that moves samples from a simple starting distribution toward the data distribution.[8] Reflected Flow Matching extends this idea to bounded domains.[9] Reflection adjusts motion at the boundary to keep samples inside.
Gauge Flow Matching learns the data distribution in reference coordinates.[10] Map feasible training data back to the ball with , then train a velocity field on that transformed distribution. At inference, start from a prior supported inside , use reflected flow sampling within , and map the generated coordinates into .
Which direction prepares the training data, and which direction produces new decisions?
Figure 04 Learn in ball coordinates, then decode
Gauge Flow Matching therefore uses a reflected sampler within . An unconstrained numerical flow can leave the ball, and invertibility alone cannot prevent that. With an exact feasible map, ball-space feasibility carries over to the decoded samples; the learned flow determines how closely their distribution matches the data.
The map must fit the geometry
The choice of map depends on the feasible region’s topology and dimension, and on the cost of working in the new coordinates.
- Topology. A disk can deform into a filled nonconvex shape with the same topology. It cannot map homeomorphically onto an annulus with a hole or a disconnected set. Such domains require a different reference space, multiple charts, or another method.
- Dimension. Equality constraints can reduce the number of independent variables. Work in those reduced coordinates and reconstruct the dependent variables when a suitable parameterization exists. A full-dimensional ball cannot be treated as a homeomorphic representation of an arbitrary lower-dimensional feasible surface.
- Distortion and computation. Continuity and invertibility establish a correspondence; bi-Lipschitz control additionally limits stretching and compression. These properties matter for correction quality, optimization conditioning, and distribution error. They must be weighed against map construction, evaluation, and any constraint checks. Here, bi-Lipschitz means that both the map and its inverse have bounded stretching.
For convex bodies, a gauge map offers a direct construction. For more general ball-homeomorphic sets, a learned map may be useful, but invertibility alone establishes neither domain coverage nor constraint satisfaction.
One change of coordinates, three uses
Based on my Homeomorphism Methods slides, this guide follows the shared geometry behind Homeomorphic Projection, Hom-PGD, and Gauge Flow Matching. For the wider landscape, see Hard-Constrained Machine Learning.
Each task pairs the map with a different operation: checked search for prediction recovery, gradient steps for optimization, and learned probability transport for generation.
For the full development, see the slides and the papers below. Implementations are available for Homeomorphic Projection, Hom-PGD, and Gauge Flow Matching.
Papers and further reading
Related work on feasible-output layers, invertible maps, optimization, and probability transport:
- Tabas and Zhang. Computationally Efficient Safe Reinforcement Learning for Power Systems. ACC, 2022 (preprint, 2021).
- Tabas and Zhang. Safe and Efficient Model Predictive Control Using Neural Networks: An Interior Point Approach. CDC, 2022.
- Tordesillas et al. RAYEN: Imposition of Hard Convex Constraints on Neural Networks. arXiv:2307.08336, 2023; updated 2026.
- Teshima et al. Coupling-based Invertible Neural Networks Are Universal Diffeomorphism Approximators. NeurIPS, 2020.
- Liang, Chen, and Low. Homeomorphic Projection to Ensure Neural-Network Solution Feasibility for Constrained Optimization. JMLR, 2024. ICML 2023 version.
- Liu, Liang, and Chen. Fast Projection-Free Approach (without Optimization Oracle) for Optimization over Compact Convex Set. NeurIPS, 2025.
- Papamakarios et al. Normalizing Flows for Probabilistic Modeling and Inference. JMLR, 2021.
- Lipman et al. Flow Matching for Generative Modeling. ICLR, 2023.
- Xie et al. Reflected Flow Matching. ICML, 2024.
- Li, Liang, and Chen. Gauge Flow Matching: Efficient Constrained Generative Modeling over General Convex Set and Beyond. ICLR, 2026.