Paper reading: A neural network approach for solving the Monge–Ampère equation with transport boundary condition

Abstract. A close reading of Hacking et al. (2025), who solve the Monge–Ampère equation with the transport boundary condition by an MLP trained with L-BFGS and compare it with a least-squares finite-difference solver. On three problems with exact solutions the network is two to three orders of magnitude more accurate; on the two problems evaluated by ray tracing the gain is only a factor of 1.4 and 3.8.

Keywords: PDE, Monge–Ampère, PINN

1 Introduction

A classical problem in illumination optics is to design a mirror that turns a given light source into a prescribed light distribution. The problem is an instance of optimal transport, with energy playing the role of mass and optical path length the role of cost [1], and it leads to the Monge–Ampère equation with the transport boundary condition. On the one hand, the established solvers for this problem (finite differences [2], finite elements, and the least-squares method of Prins et al. [3]) are tailored to it, and, as the paper argues, each new optical system needs new update rules. On the other hand, neural solvers that minimize the residual of the equation (the PINN family) are generic: a new equation only needs a new loss. Nyström and Vestberg [4] used this approach for the Dirichlet problem of the Monge–Ampère equation; according to the authors of the paper discussed here, no neural method had handled the transport boundary condition before.

The paper of Hacking, Kusch, Mitra, Anthonissen and IJzerman [1] fills this gap. The reflector surface is a multilayer perceptron (MLP), the loss combines the residual, a boundary term and a convexity penalty, the optimizer is L-BFGS, and the method is compared with the least-squares solver on five test problems. This post goes through the paper in detail. Section 2 derives the equation from the optics and explains why it is hard. Section 3 collects the relevant theory; the paper itself has no theorems, so we state the classical results that its formulation relies on and point out which test problems fall outside them. Section 4 describes the loss, the network, the sampling and the optimizer. Section 5 goes through every experiment and its numbers, and Section 6 discusses what the results do and do not show.

2 The parallel-to-far-field reflector problem

2.1 Geometry and the law of reflection

The paper considers one optical configuration, the parallel-to-far-field reflector [1]. A planar source occupies a region of the plane and emits light upward in the direction with intensity . Above it sits a perfect mirror of height . A ray leaving is reflected at into the direction

where is the unit normal of the surface. In the far field the mirror is small compared with the distance the light travels, so all reflected rays can be treated as leaving from one point and are distinguished only by their direction , a point on the unit sphere. The paper represents by stereographic projection from the north pole, which gives plane coordinates , and prescribes the target distribution in these coordinates, with support the target region .

The paper states without derivation that, by the law of reflection, the gradient of equals the stereographic coordinates of the reflected ray. This takes three lines to check. With we have and , so

Stereographic projection from sends to , and , hence

The gradient of the mirror tells each ray where to go, which is why the paper calls the "mapping" of the reflector. Figure 1 shows both steps.

Rays on a section of the reflector, and the stereographic projection
Figure 1. (a) The section of the reflector of Problem A (black solid line). Thin grey arrows are vertical rays from the source (thick grey line), black arrows the reflected directions given by the law of reflection. (b) The reflected direction (black arrow from the center of the grey unit circle) projected from the north pole onto the horizontal plane (grey horizontal line): the black dashed line runs from the north pole through the projected point (open square) to , and the projected point has coordinate . Both panels are drawn from the formulas.

2.2 The Monge–Ampère equation and the transport boundary condition

Energy conservation says that for every subset the energy leaving arrives in : . If is smooth and injective, the change of variables on the right and the arbitrariness of give ; on the convex branch (see below) the absolute value can be dropped:

which is Eq. (2a) of the paper. The paper's argument is that since , the determinant is positive everywhere, so is either strictly convex or strictly concave; the paper takes the convex branch. All light must also land in the target, . The paper argues that for convex the gradient is a diffeomorphism, so this condition reduces to a condition on the boundary only,

the transport boundary condition [2]. The paper also notes that the parallel-to-parallel reflector and the parallel-to-far-field lens lead to the same mathematical problem, so the method covers them as well [1].

Integrating over and using shows a hidden compatibility condition: , that is, the source and the target carry the same total energy. Besides, and only involve derivatives of , so is determined at most up to an additive constant. This matters for the error metric discussed in Section 6.

2.3 Why the problem is hard

Compared with the Dirichlet problem for the Poisson equation, the problem with is harder in three ways. First, the equation is fully nonlinear, and its right-hand side depends on the gradient of the unknown through . Second, the boundary condition does not prescribe the values of ; it prescribes that maps one curve onto another. This condition is nonlinear, and where on a given boundary point should land is not known in advance. Third, the equation behaves well only on convex functions: convexity decides both uniqueness and ellipticity, as discussed in the previous post. A plain residual loss knows nothing about convexity, so the solver needs an extra mechanism.

3 Theoretical background

The paper is a numerical paper: it states no theorem and gives no convergence analysis. Its formulation does rest on two classical results of optimal transport. We state them here because two of the five test problems turn out to violate their assumptions.

The first is Brenier's theorem [5, Theorem 4.22]: if and are probability measures with finite second moments, the optimal transport map for the quadratic cost exists, is unique -almost everywhere, and is the gradient of a convex function . So among convex functions is unique and is unique up to a constant. The second is Caffarelli's regularity theory, which says when is continuous or smooth.

Theorem 3.1 (Regularity of the optimal transport map). ([5, Theorem 4.23, Remark 4.25]) Let be bounded open sets and let be probability densities that vanish outside and respectively and are bounded away from zero and infinity on and respectively. Let be the optimal transport map given by Brenier's theorem, and assume that is convex. Then

  1. there is such that ;
  2. if in addition and , then ;
  3. if moreover and are smooth and both and are smooth and uniformly convex, then is a smooth diffeomorphism.

Remark 4.25 states (3) as a condition on the domains, right after the Hölder assumption on and ; the explicit smoothness of and in (3) is our reading, since a smooth forces to be smooth. Parts (1) and (2) are interior estimates and say nothing about the boundary. Smoothness up to the boundary needs (3), which requires both domains to be smooth and uniformly convex. The paper's step from " is convex" to " is a diffeomorphism, hence " needs, strictly speaking, a condition like (3). The convexity of the target cannot be dropped: Figalli gives an example where the target consists of two separated half-disks and the optimal map is discontinuous along a segment [5, pp. 97–98]. When introducing Problem D, the paper only mentions that the source must be convex [1]; it does not discuss the target.

Against the five test problems of Section 5: in Problems A–C both domains are the unit disk, which satisfies the geometric condition of (3). In Problem D the source is a square, convex but with corners, so (3) does not apply while (1) and (2) still hold. In Problem E the target is a "flower". We computed the curvature of its boundary curve as given in the paper: the curvature is negative on about 39% of the boundary, measured in polar angle (Figure 3), so the target is not convex, the assumption of Theorem 3.1 fails, and the classical theory no longer guarantees that is continuous. This does not mean that the solution of Problem E is discontinuous, but it does mean that E is a different kind of problem from A–C.

4 Method

4.1 The loss

The reflector is represented by an MLP , where collects all weights and biases. The paper asks the loss to penalize three things: the residual of the equation in the interior of , the distance from to the target boundary on , and non-convexity in the interior. The three terms are

where are the entries of the Hessian . The total loss is the integral of these terms, approximated by averages over interior points and boundary points :

The paper uses for every problem, reports that this choice consistently gave satisfactory results on the problems studied, and leaves the optimal choice of weights open [1]. Both and are computed exactly by automatic differentiation.

The boundary term is easy to read. When the target is the unit circle, the distance from a point to it is , so . For complicated targets the shortest distance to is hard to compute. The paper's way out is that any function that attains its minimum on will push the images of the boundary points onto . For Problem E it uses the radial surrogate

with (Eq. (19) of the paper writes as ). The authors also tried computing the shortest distance by numerical minimization, which was more expensive and not significantly more accurate [1]. Note that is one-sided: it asks every boundary point to land on , but not that the images cover all of . Coverage is enforced only indirectly, through the interior equation (energy conservation).

4.2 Why the trace is enough for convexity

is the term that moved the PINN from the concave to the convex solution in the previous post. The paper calls it the same penalty as that of Nyström and Vestberg [4]. Strictly, the two differ in form: Nyström and Vestberg penalise the two diagonal entries, , while penalises their sum. Both rest on the same elementary fact.

Proposition 4.1 (Trace criterion in two dimensions). Let be a real symmetric matrix with . Then if and only if . If , then if and only if .

Proof. The eigenvalues satisfy , so they have the same sign or one of them is zero, and that sign is the sign of . If , neither eigenvalue is zero, and the same argument applies.∎

The eigenvalue formula in the paper is missing the factor under the square root, which does not affect its conclusion. Since the residual already pushes towards , it only remains to penalize a negative trace. The argument needs two dimensions and a small , and the penalty acts only at the collocation points. In three dimensions a matrix can have positive determinant and positive trace and still be indefinite, for example one with eigenvalues .

4.3 Network, sampling and optimizer

The network is a fully connected MLP with hidden layers of neurons. The hidden activation is , which the authors found empirically to generalize well across problems, and the output layer is linear [1]. By our count the network has parameters. One constraint is easy to overlook: the loss contains , so the activation must be twice differentiable, and a ReLU network, whose Hessian vanishes almost everywhere, cannot be used. Unlike the usual , is even, takes values in and is not monotone; the paper does not explain why it works better than .

The collocation points come from Poisson disk sampling, which keeps every pair of points at least a fixed distance apart. The points are therefore more evenly spread than independent uniform samples, without lying on a grid. Problem A uses interior points and boundary points spaced evenly along the boundary, the paper states that B, C and D keep these settings, and the point set stays fixed during training. Figure 4 of the paper shows the interior points on the disk, used for Problems A, B, C and E, and on the square , used only for Problem D.

The optimizer is L-BFGS with the Moré–Thuente line search. The authors' reasons are that the loss is deterministic, so stochastic gradients are not needed; that Adam, which uses gradients only, struggles on this loss to reach the accuracy one expects from a classical PDE solver in reasonable time; and that L-BFGS approximates the Hessian with little extra cost in time and memory. Training stops when the line search fails to find an acceptable step within iterations or after seconds. The implementation uses JAX [1].

4.4 The baseline: a least-squares solver

The baseline is the least-squares solver of Prins et al. [3], called LSS in the paper. It does not compute directly. Instead, it computes a mapping on grid points, with the Jacobian from finite differences, and alternates three steps: project on the boundary onto to get ; find the symmetric positive semidefinite matrix with determinant closest to ; and, with and fixed, minimize over , where

The final need not be a gradient field, so is recovered at the end by minimizing . In the LSS, convexity enters as a hard constraint on the auxiliary matrix (positive semidefinite), toward which is pulled, and each step has a dedicated solution method; in the MLP method, convexity is only a penalty.

5 Experiments

5.1 Setup and error metric

All experiments ran on one desktop with an AMD Ryzen 5 3600 CPU, an NVIDIA GTX 1060 6 GB GPU and 24 GB of RAM. The LSS is an existing MATLAB implementation run in MATLAB R2023b; the MLP method is written in Python with JAX and runs on the GPU [1]. The paper does not say whether the LSS used the GPU. For Problem A, and with the same settings for B and C, the LSS works on a polar grid; the paper does not state the LSS grid for D and E. Both methods get seconds.

For Problems A–C, which have exact solutions, the error metric is the normalized mean absolute error (NMAE)

evaluated on the same grid that the LSS uses. Problems D and E have no exact solution, so the paper evaluates them by ray tracing: quasi-random points are drawn in the source, each ray is reflected by the computed mirror and assigned to one of bins, rays in total, and the NMAE is computed between the resulting image and the target distribution . For the MLP the reflected direction comes from automatic differentiation; the LSS mapping exists only on grid points and is interpolated with cubic splines.

5.2 Three problems with exact solutions

Problems A–C are built backwards: choose a convex and a target density , then compute from . Source and target are both the unit disk.

  • Problem A (symmetric circle-to-circle): and .
  • Problem B (asymmetric circle-to-circle 1): , with the same as Problem A.
  • Problem C (asymmetric circle-to-circle 2): and .

To understand these problems we evaluated a few quantities from the formulas (the script only evaluates closed-form expressions; nothing is trained). All three reflectors are uniformly convex on the disk: the smallest eigenvalue of is bounded below by about , and . The resulting source densities range over about , and . Moreover, all three satisfy on the unit circle. In Problem A, ; in Problems B and C the perturbation carries the factor , which vanishes together with its gradient at . So the boundary map is the identity in all three problems, and the difficulty lies in the interior. Figure 2 shows and the mapping .

Source densities and gradient maps of Problems A–C
Figure 2. The exact solutions of Problems A–C, computed from the and given in the paper. (a)–(c) Source density , from dark purple (low) to yellow (high), each problem on its own color scale; the thin black line is the unit circle. (d)–(f) Image of a polar grid on the source under (thin black lines); the outer circle coincides with the unit circle, so the boundary map is the identity.

The final errors are in Table 1. On all three problems the MLP reaches an NMAE of order , two to three orders of magnitude below the LSS; the ratios, which we computed from the paper's numbers, are about , and . The convergence curves (Figures 6(a), 8(a) and 10(a) of the paper) also show that the MLP error drops faster than the LSS error, that the MLP runs end well before the 15-second limit (the line search stops them), and that the LSS error stops decreasing well before that limit. In Problem C the LSS error has a small artifact at the center of the domain, which the authors attribute, tentatively, to the polar coordinates the LSS needs and the MLP does not [1].

Table 1. Final NMAE. Data from Table 1 of the paper; the last column is ours. Problems A–C compare the surface (Eq. ), Problems D and E compare ray-traced images, so the two groups of numbers are not comparable.
LSSMLP-L-BFGSRatio LSS / MLP
Problem A
Problem B
Problem C
Problem D (ray tracing)
Problem E (ray tracing)

5.3 Two problems evaluated by ray tracing

  • Problem D (square-to-circle): the source is a square, the target the unit disk, both with uniform densities.
  • Problem E (circle-to-flower): the source is the unit disk and the target is , again both with uniform densities.

Neither problem has a known exact solution, so both are evaluated by ray tracing. For D the paper states that the training setup is the same as for A–C; for E it gives no separate setup. Figure 3 shows the domains.

Source and target domains of Problems D and E
Figure 3. (a) Problem D: square source, circular target. (b) Problem E: circular source, flower-shaped target. The light grey filled region is the source , the black solid line the target boundary . The thick vermillion dashed arcs mark where the target boundary has negative curvature, i.e. where it is not convex (computed by us from the boundary curve given in the paper). The black dotted line is the curve of Eq. (19) of the paper, which differs from the target boundary .

The results are in the last two rows of Table 1 and in Figure 4. On Problem D the two methods end at similar accuracy ( against ), with the MLP converging somewhat faster; in the error maps, both methods have trouble removing the corners of the square to produce the round target [1]. Problem E is harder for both methods. The MLP ends somewhat more accurate ( against ) and converges slightly faster, and its error is still decreasing when it reaches the 15-second limit (Figure 14(a) of the paper); the errors of both methods concentrate near the boundary, and the LSS in particular struggles to represent the target boundary [1].

Final errors of the LSS and MLP-L-BFGS
Figure 4. Final NMAE of the LSS and MLP-L-BFGS. Data from Table 1 of the paper. Green triangles are the LSS, blue circles the MLP-L-BFGS; a thin grey line joins the two values of each problem, and the number next to it is the ratio of the LSS error to the MLP error. (a) Problems A–C, error of the surface. (b) Problems D and E, error of the ray-traced image.

Taken together, the MLP gains two to three orders of magnitude on the smooth problems with exact solutions, but only a factor of and on the problems evaluated by ray tracing. This is consistent with the abstract's wording, "competitive, and often superior".

We also noticed that two formulas for Problem E disagree. The target region is defined by , so its boundary is , while the boundary loss (19) uses the radius , with roughly twice the amplitude (solid and dotted lines in Figure 3(b)). By our computation the first curve encloses an area of exactly , equal to the area of the source disk; the second encloses about . The paper does not publish code, so we cannot tell which one was used in the experiments.

5.4 Hyperparameter study

On Problems A–C the paper varies four hyperparameters: the number of interior points, the number of boundary points, the depth and the width of the network. Each setting uses random seeds and is shown with a confidence interval [1]. The legends of Figure 16 of the paper show the ranges: the square root of the number of interior points from to , boundary points from to , depth from to and width from to . The findings are as follows.

  • Interior points: more points give smaller errors at slightly higher cost, and reaching the accuracy of the LSS takes considerably fewer points than the LSS grid has. The trend is the same on all three problems.
  • Boundary points: the effect is small. A few boundary points suffice to enforce the transport condition, and more do not help. The authors note that all three problems use circular domains, and expect that more complex boundaries, or a larger difference between source and target boundaries, need more points.
  • Depth: one hidden layer fails to give an accurate solution; a little more depth already gives acceptable accuracy, after which the accuracy saturates and the cost grows only mildly.
  • Width: very narrow networks are inaccurate, and the accuracy saturates quickly as the width grows, but the cost grows markedly. With neurons per layer, near-optimal accuracy takes less than seconds; with it takes more than seconds, for little gain. The authors explain this by the quadratic growth of the weight matrices between hidden layers, which raises the cost of both the loss and the L-BFGS vector products.

Given the earlier observation, the small effect of the boundary points may also reflect that the boundary map in A–C is the identity.

Finally, the paper compares L-BFGS with Adam on Problem A, both on the same deterministic loss (Figure 17 of the paper). L-BFGS converges much faster and ends several orders of magnitude more accurate [1]. The paper gives only the curves of Figure 17: no final NMAE for Adam, and no learning rate or other settings.

6 Discussion

6.1 What the paper shows

On problems with smooth convex domains and smooth exact solutions, an MLP with about thousand parameters trained by L-BFGS within a -second budget reaches a surface error two to three orders of magnitude below that of a solver designed specifically for the problem. The method is simple: a new optical system should only need a new loss, while the network and the optimizer stay generic. Not needing a grid also helps in practice; for example, the LSS has to use polar coordinates on the disk, which the authors suspect causes the artifact in Problem C. The authors state that this is, to their knowledge, the first paper to include the transport boundary condition in a neural-network PDE solver [1].

6.2 Limitations stated by the authors

In their discussion the authors admit that L-BFGS sometimes stops early and then gives poor accuracy; falling back to a first-order method such as Adam helps but slows convergence [1]. How often this happens is not reported. They also do not know whether the method works for reflectors with many high-frequency components, such as the "Girl with a Pearl Earring" problem studied by Prins et al., and suggest that Fourier features or sinusoidal activations may be needed. They note that five test problems is a small set and call for a larger, more representative test set, and they only treat the parallel-to-far-field configuration. Besides, they mention replacing the deterministic optimization on a fixed point set by stochastic optimization with resampling, which would need a stochastic variant of L-BFGS.

6.3 Further limitations we see

Beyond the points the authors raise, we noticed the following while reading the paper.

  1. Table 1 has no error bars. Section 5 of the paper uses random seeds, but Section 4 states neither the number of runs behind Table 1 nor any variance. The caption speaks of a "mean Normalized Mean Absolute Error", which may or may not mean an average over runs. Since the authors admit that L-BFGS sometimes stops early, the reader cannot tell from Table 1 how much the result varies between runs.
  2. The LSS is compared at one resolution only. On A–C its error stops decreasing before the time limit, so more time would not help. We suspect that its error is dominated by the discretization error of the grid, but the paper does not refine the grid, so this cannot be confirmed. The two methods also differ in size: the LSS computes the mapping at grid points, while the MLP trains parameters on collocation points.
  3. The fixed-time comparison mixes implementation and hardware. One side is MATLAB, the other JAX on a GPU, and the comparison is accuracy within the same seconds. The paper does not discuss this.
  4. The NMAE depends on an unstated constant. is determined only up to an additive constant (Section 2), and the loss as well as the last step of the LSS only see . Eq. compares values of directly and divides by the mean of , so the result depends on how the constant is fixed. The paper does not say.
  5. The boundary condition in Problems A–C is easy. Source and target are the same circle and the exact boundary map is the identity, so no boundary point has to move along the boundary. The problems that really test it are D and E, and on those the MLP gains only a factor of and .
  6. The evaluation of D and E includes errors that do not come from the solver. The ray-traced NMAE contains binning and sampling error, and the paper does not report its floor (for example, the same ray tracing applied to a very accurate map). Moreover, the LSS map goes through cubic-spline interpolation while the MLP map comes from automatic differentiation, so the two evaluation pipelines differ. How much of the gap between and is due to the solvers themselves cannot be told.
  7. Convexity is not checked after training. The penalty acts only at the collocation points, and the paper does not report whether the trained network is convex between them. With errors as small as in A–C this is not a concern, but on D and E, which have no exact solution, the check matters more. The experiment in the previous post shows that the loss alone does not reveal which branch a solution is on.
  8. Problem E lies outside the classical theory. As discussed in Section 3, its target is not convex, and it is exactly the problem on which both methods struggle most, with errors concentrated at the boundary. The paper does not discuss the convexity of the target. We cannot claim that this is the cause of the difficulty, but it suggests that the difficulty of E may not be purely numerical.
  9. There is no comparison with other solvers. The paper cites the finite-difference method of Froese [2] and the finite-element method of Kawecki et al., but compares only with the LSS.

7 Conclusion

Hacking et al. [1] extend the residual loss of Nyström and Vestberg to the Monge–Ampère equation with the transport boundary condition: a residual term, a distance-to-target-boundary term and the two-dimensional trace penalty, all with weight , minimized for a MLP by L-BFGS. On three smooth problems with exact solutions it is two to three orders of magnitude more accurate than the least-squares solver; on the square-to-circle and circle-to-flower problems, evaluated by ray tracing, the gain shrinks to a factor of and . The paper shows that handling a new boundary condition by changing the loss is a workable route. Its experiments leave several questions open: whether the results are stable across random seeds, what accuracy the LSS reaches on finer grids, and how the method behaves when the target is not convex and the map may be discontinuous. Convexity rests on a penalty that only works in two dimensions, so three and more dimensions need a different mechanism. These are questions for later posts.

References

  1. Hacking, Roel, Kusch, Lisa, Mitra, Koondanibha, Anthonissen, Martijn, and IJzerman, Wilbert, A neural network approach for solving the Monge–Ampère equation with transport boundary condition, Journal of Computational Mathematics and Data Science 15 (2025) 100119.
  2. Froese, Brittany D., A Numerical Method for the Elliptic Monge–Ampère Equation with Transport Boundary Conditions, SIAM Journal on Scientific Computing 34 no. 3 (2012) A1432–A1459.
  3. Prins, C. R., Beltman, R., Thije Boonkkamp, J. H. M. ten, IJzerman, W. L., and Tukker, T. W., A Least-Squares Method for Optimal Transport Using the Monge–Ampère Equation, SIAM Journal on Scientific Computing 37 no. 6 (2015) B937–B961.
  4. Nyström, Kaj, and Vestberg, Matias, Solving the Dirichlet problem for the Monge–Ampère equation using neural networks, Journal of Computational Mathematics and Data Science 8 (2023) 100080.
  5. Figalli, Alessio, The Monge–Ampère Equation and Its Applications, Zurich Lectures in Advanced Mathematics, European Mathematical Society, Zürich, 2017.

Cite this post

Chengrui Zhang. Paper reading: A neural network approach for solving the Monge–Ampère equation with transport boundary condition. 2026. https://chengrui.dev/en/posts/nn-mae-reflector/

@misc{zhang2026nn-mae-reflector,
  author = {Zhang, Chengrui},
  title  = {{Paper reading: A neural network approach for solving the Monge–Ampère equation with transport boundary condition}},
  year   = {2026},
  url    = {https://chengrui.dev/en/posts/nn-mae-reflector/},
  note   = {Blog post},
}

Search the published posts.↑ ↓ to choose, Enter to open, Esc to close