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

A reference coordinate maps along a ray to a feasible decision Φ z x BK

1. Choose a coordinate. Pick zz inside the reference ball BB. 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 KK. Scale the point to keep the same fraction of that ray.

3. Read the decision. Apply Φ\Phi to obtain xx inside KK. 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 KK contain the admissible decisions, and let BB be the unit ball: all coordinates with length at most one. In our 2D figures, BB is a filled disk. The point zz is a reference coordinate; xx is the actual decision. A homeomorphism Φ\Phi pairs each zz in BB with exactly one xx in KK, and its inverse Φ−1\Phi^{-1} takes xx back to zz. Both directions are continuous: small changes remain small in either coordinate system. The map can still stretch or compress distances.

With Φ(B)=K\Phi(B)=K, any coordinate zz 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.

A spotted sphere continuously deforms into a cow-shaped surface and back.
Topology intuition. Follow a spot as the sphere becomes a cow: the shape changes without tearing or merging points. The animation illustrates a surface; our constraint maps act on filled regions. Animation: Nepluno and JPxG; model: Keenan Crane. Source · CC BY-SA 4.0. Reproduced unchanged.

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 x0x_0. Each ray reaches the boundary at a unique distance. Rescaling the corresponding ball radius by that distance gives the map.

Write z=ruz=ru, where uu is a unit direction and 0≤r≤10\le r\le1. If R(u)R(u) is the distance from x0x_0 to the boundary along uu, the map is

Φ(ru)=x0+r R(u) u,Φ(0)=x0.\begin{aligned}\Phi(ru) &= x_0 + r\,R(u)\,u,\\\Phi(0) &= x_0.\end{aligned}

The map preserves the relative distance rr 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 x0=0x_0=0.

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 ℓ∞\ell_\infty 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.

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 zz, enforce z∈Bz\in B, and return Φ(z)\Phi(z). 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 f(x)f(x) over x∈Kx\in K is equivalent, under an exact homeomorphism, to minimizing the composite objective h(z)=f(Φ(z))h(z)=f(\Phi(z)) over z∈Bz\in B. Every feasible decision has a coordinate, so the best objective value is preserved.

When projection onto KK 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 BB, and maps the iterate back.[6] With step size η\eta, the update is

zk+1=ΠB ⁣(zk−η ∇h(zk)),xk+1=Φ(zk+1).\begin{aligned}z_{k+1} &= \Pi_B\!\left(z_k - \eta\,\nabla h(z_k)\right),\\x_{k+1} &= \Phi(z_{k+1}).\end{aligned}

ΠB\Pi_B is projection onto the unit ball: keep a point if its length is at most one; otherwise divide it by its length. The gradient ∇h\nabla h is taken with respect to the reference coordinate zz, so it accounts for how the map changes the decision. The method avoids projection onto the original set KK; 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

400 equal-area illustrative points distributed over the unit disk.The same 400 points mapped to a star-shaped region, with denser points where the radial map compresses area.
All mapped points are feasible, yet their spacing changes. Equal probability weights do not imply equal density.

Even uniform samples in the ball generally become nonuniform after mapping. A region that expands under Φ\Phi 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 Φ−1\Phi^{-1}, then train a velocity field on that transformed distribution. At inference, start from a prior supported inside BB, use reflected flow sampling within BB, and map the generated coordinates into KK.

Which direction prepares the training data, and which direction produces new decisions?

Figure 04 Learn in ball coordinates, then decode

Ball coordinates BB
Feasible decisions KK
Training data
Data in BB
Inverse mapΦ−1\Phi^{-1}
Training data
Generation
PriorReflected flow
within BB
DecodeΦ\Phi
Generated samples
The domains stay fixed: training data move right to left; generated coordinates move left to right through Φ\Phi into KK.

Gauge Flow Matching therefore uses a reflected sampler within BB. 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:

  1. Tabas and Zhang. Computationally Efficient Safe Reinforcement Learning for Power Systems. ACC, 2022 (preprint, 2021).
  2. Tabas and Zhang. Safe and Efficient Model Predictive Control Using Neural Networks: An Interior Point Approach. CDC, 2022.
  3. Tordesillas et al. RAYEN: Imposition of Hard Convex Constraints on Neural Networks. arXiv:2307.08336, 2023; updated 2026.
  4. Teshima et al. Coupling-based Invertible Neural Networks Are Universal Diffeomorphism Approximators. NeurIPS, 2020.
  5. Liang, Chen, and Low. Homeomorphic Projection to Ensure Neural-Network Solution Feasibility for Constrained Optimization. JMLR, 2024. ICML 2023 version.
  6. Liu, Liang, and Chen. Fast Projection-Free Approach (without Optimization Oracle) for Optimization over Compact Convex Set. NeurIPS, 2025.
  7. Papamakarios et al. Normalizing Flows for Probabilistic Modeling and Inference. JMLR, 2021.
  8. Lipman et al. Flow Matching for Generative Modeling. ICLR, 2023.
  9. Xie et al. Reflected Flow Matching. ICML, 2024.
  10. Li, Liang, and Chen. Gauge Flow Matching: Efficient Constrained Generative Modeling over General Convex Set and Beyond. ICLR, 2026.