Notions of Optimal Transport Theory and How To
Notions of Optimal Transport Theory and How To
Notions of Optimal Transport Theory and How To
Abstract
This article gives an introduction to optimal transport, a mathematical
theory that makes it possible to measure distances between functions (or
distances between more general objects), to interpolate between objects
or to enforce mass/volume conservation in certain computational physics
simulations. Optimal transport is a rich scientific domain, with active
research communities, both on its theoretical aspects and on more ap-
plicative considerations, such as geometry processing and machine learn-
ing. This article aims at explaining the main principles behind the theory
of optimal transport, introduce the different involved notions, and more
importantly, how they relate, to let the reader grasp an intuition of the
elegant theory that structures them. Then we will consider a specific set-
ting, called semi-discrete, where a continuous function is transported to
a discrete sum of Dirac masses. Studying this specific setting naturally
leads to an efficient computational algorithm, that uses classical notions
of computational geometry, such as a generalization of Voronoi diagrams
called Laguerre diagrams.
1 Introduction
This article presents an introduction to optimal transport. It summarizes and
complements a series of conferences given by B. Lévy between 2014 and 2017.
The presentations stays at an elementary level, that corresponds to a computer
scientist’s vision of the problem. In the article, we stick to using standard no-
tions of analysis (functions, integrals) and linear algebra (vectors, matrices),
and give an intuition of the notion of measure. The main objective of the pre-
sentation is to understand the overall structure of the reasoning 1 , and to follow
a continuous path from the theory to an efficient algorithm that can be imple-
mented in a computer.
1
Figure 1: Comparing functions: one would like to say that f1 is nearer to
f2 than f3 , but the classical L2 norm “does not see” that the graph of f2
corresponds to the graph of f1 slightly shifted along the x axis.
transport makes it possible to define a distance that will take into account that
the graph of f2 can be obtained from f1 through a translation (like here), or
through a deformation of the graph of f1 . From the point of view of this new
distance, the function f1 will be nearer to f2 than to f3 .
2
Figure 3: Given two terrains defined by their height functions u and v, symbol-
ized here as gray levels, Monge’s problem consists in transforming one terrain
into the other one by moving matter through an application T . This application
needs to satisfy a mass conservation constraint.
The two sections that follow are partly inspired by [Vil09], [San14], [Caf03]
and [AG13], but stay at an elementary level. Here the main goal is to give an
intuition of the different concepts, and more importantly an idea of the way
the relate together. Finally we will see how they can be directly used to design
a computational algorithm with very good performance, that can be used in
practice in several application domains.
2 or more general objects, called probability measures, more on this later.
3
2 Monge’s problem
The initial optimal transport problem was first introduced and studied by
Monge, right before the French revolution [Mon84]. We first give an intuitive
idea of the problem, then quickly introduce the notion of measure, that is nec-
essary to formally state the problem in its most general form and to analyze
it.
2.1 Intuition
Monge’s initial motivation to study this problem was very practical: supposing
you have an army of workmen, how can you transform a terrain with an initial
landscape into a given desired target landscape, while minimizing the total
amount of work ?
Monge’s initial problem statement was as follows:
R
inf c(x, T (x))u(x)dx
T :X→X X
subject to:
R R
∀B ⊂ X, u(x)dx = v(x)dx
T −1 (B) B
2
where X isR a subset of R
R , u and v are two positive functions defined on X and
such that X u(x)dx = Y v(x)dx, and c(·, ·) is a convex distance (the Euclidean
distance in Monge’s initial problem statement).
The functions u and v represent the height of the current landscape and the
height of the target landscape respectively (symbolized as gray levels in Figure
3). The problem consists in finding (if it exists) a function T from X to X that
transforms the current landscape u into the desired one v, while minimizing the
product of the amount of transported earth u(x) with the distance c(x, T (x))
to which it was transported. Clearly, the amount of earth is conserved during
transport, thus the total quantity of earth should be the same in the source
and target landscapes (the integrals of u and v over X should coincide). This
global matter conservation constraint needs to be completed with a local one.
The local matter conservation constraint enforces that in the target landscape,
the quantity of earth received in any subset B of X corresponds to what was
transported here, that is the quantity of earth initially present in the pre-image
T −1 (B) of B under T . Without this constraint, one could locally create matter
in some places and annihilate matter in other places in a counterbalancing way.
A map T that satisfies the local mass conservation constraint is called a transport
map.
4
Figure 4: Transport from a function (gray levels) to a discrete point-set (blue
disks).
now on), that represent for instance a set of factories that exploit a resource,
see Figure 4. Each factory wishes to receive a certain quantity of resource (de-
pending for instance of the number of potential customers around the factory).
Thus, the function v that represents the “target landscape” is replaced with a
function on a finite set of points. However, if a function v is zero everywhere
except on a finite set of points, then its integral over X is also zero. This is a
problem, because for instance one cannot properly express the mass conserva-
tion constraint. For this reason, the notion of function is not rich enough for
representing this configuration. One can use instead measures (more on this
below), and associate with each factory a Dirac mass weighted by the quantity
of resource to be transported to the factory.
From now on, we will use measures µ and ν to represent the “current land-
scape” and the “target landscape”. These measures are supported by sets X
and Y , that may be different sets (in the present example, X is a subset of R2
and Y is a discrete set of points). Using measures instead of function not only
makes it possible to study our “transport to discrete set of factories” problem,
but also it can be used to formalize computer objects (meshes) and directly
leads to a computational algorithm. This algorithm is very elegant because it is
a verbatim computer translation of the mathematical theory (see §7.6). In this
particular setting, translating from the mathematical language to the algorith-
mic setting does not require to make any approximation. This is made possible
by the generality of the notion of measure.
The reader who wishes to learn more on measure theory may refer to the
textbook [Tao11]. To keep the length of this article reasonable, we will not
give here the formal definition of a measure. In our context, one can think of
a measure as a “function” that can be only queried using integrals and that
can be “concentrated” on very small sets (points). The following table can be
used to intuitively translate from the “language of functions” to the “language
5
Figure 5: A classical example of the existence problem: there is no optimal
transport between a segment L1 and two parallel segments L2 and L3 (it is
always possible to find a better transport by replacing h with h/2).
of measures” :
Function u Measure µ
R R
B
u(x)dx µ(B) or B dµ
R R
B
f (x)u(x)dx B
f (x)dµ
u(x) N/A
(Note: in contrast with functions, measures cannot be evaluated at a point,
they can be only integrated over domains).
where X and Y are Borel sets (that is, sets that can be measured), µ and ν
are two measures on X and Y respectively such that µ(X) = ν(Y ) and c(·, ·)
is a convex distance. The constraint ν = T ]µ, that reads “T pushes µ onto ν”
corresponds to the local mass conservation constraint. Given a measure µ on X
and a map T from X to Y , the measure T ]µ on Y , called “the pushforward of
µ by T ”, is such that T ]µ(B) = µ(T −1 (B)) for all Borel set B ⊂ Y . Thus, the
local mass conservation constraint means that µ(T −1 (B)) = ν(B) for all Borel
set B ⊂ Y .
The local mass conservation constraint makes the problem very difficult:
imagine now that you want to implement a computer program that enforces it:
the constraint concerns all the subsets B of Y . Could you imagine an algorithm
that just tests whether a given map satisfies it ? What about enforcing it ? We
will see below a series of transformations of the initial problem into equivalent
problems, where the constraint becomes linear. We will finally end up with a
simple convex optimization problem, that can be solved numerically using clas-
sical methods.
Before then, let us get back to examine the original problem. The local
mass conservation constraint is not the only difficulty: the functional optimized
6
Figure 6: Four example of transport plans in 1D. A: a segment is translated.
B: a segment is split into two segments. C: a Dirac mass is split into two Dirac
masses; D: a Dirac mass is spread along two segments. The first two examples
(A and B) have the form (Id × T )]µ where T is a transport map. The third
and fourth ones (C and D) have no corresponding transport map, because each
of them splits a Dirac mass.
7
Figure 7: A discrete version of Kantorovich’s problem.
However, once again, we cannot use standard functions to represent the graph
of T : if you think about the graph of a univariate function x 7→ f (x), it is
defined on R2 but concentrated on a curve. For this reason, as in our previous
example with factories, one needs to use measures. Thus, we are now looking
for a measure γ supported by the product space X × Y . The relaxed problem
is stated as follows:
( )
R
inf c(x, y)dγ | γ ≥ 0 and γ ∈ Π(µ, ν)
γ
X×Y
(K)
where:
Intuitively, the first constraint (PX )]γ = µ means that everything that comes
from a subset B of X should correspond to the amount of matter (initially) con-
tained by B in the source landscape, and the second one (PY )]γ = ν means that
everything that goes into a subset B 0 of Y should correspond to the (prescribed)
amount of matter contained by B 0 in the target landscape ν.
We now examine the relation between the relaxed problem (K) and the initial
problem (M). One can easily check that among the optimal transport plans,
those with the form (Id × T )]µ correspond to a transport map T :
Observation 1. If (Id × T )]µ is a transport plan, then T pushes µ onto ν.
8
Proof. (Id×T )]µ is in Π(µ, ν), thus (PY )](Id×T )]µ = ν, or ((PY ) ◦ (Id × T )) ]µ =
ν, and finally T ]µ = ν.
We can now observe that if a transport plan γ has the form γ = (Id × T )]µ,
then problem (K) becomes:
Z Z
min c(x, y)d ((Id × T )]µ) = min c(x, T (x))dµ
X×Y X
integrals with γ.
4 Note that the measure µ is supposed to be absolutely continuous with respect to the
Lebesgue measure. This is required, because for instance in example (B) of Figure 6, the
transport map T is undefined at the center of the segment. The absolute continuity require-
ment allows one to remove from X any subset with zero measure.
9
(K) is a linear optimization problem subject to linear constraints. This suggests
using certain tools, such as the dual formulation, that was also developed by
Kantorovich. With this dual formulation, it is possible to exhibit an interesting
structure of the problem, that can be used to answer both questions (existence
of a transport plan, and existence of an associated transport map).
where γ is the vector of Rm×n with all coefficients γij (that is, the matrix γij
“unrolled” into a vector), and C the vector of Rm×n with the coefficients cij
indicating the transport cost between point i and point j (for instance, the
Euclidean cost). The objective function is simply the dot product, denoted
by < C, γ >, of the cost vector C and the vector γ. The objective function
is linear in γ. The constraints on the marginals (1) impose in this discrete
version that the sums of the γij coefficients over the columns correspond to
the ui coefficients (Figure 7-B) and the sums over the rows correspond to the
vj coefficients (Figure 7-C). Intuitively, everything that leaves point i should
correspond to ui , that is the quantity of matter initially present in i in the
source landscape, and everything that arrives at a point j should correspond
to vj , that is the quantity of matter desired at j in the target landscape. As
one can easily notice, in this form, both constraints are linear in γ. They can
be written with two matrices Px and Py , of dimensions m × mn and n × mn
respectively.
10
4.2 Constructing the Kantorovich dual in the discrete set-
ting
We introduce, arbitrarily for now, the following function L defined by:
There is equality, because to minimize sup[L(ϕ, ψ)], γ has no other choice than
satisfying the constraints (see the previous observation). Thus, we obtain a
new expression (left-hand side) of the discrete Kantorovich problem (right-hand
side). We now further examine it, and replace L by its expression:
" #
< C, γ > − < ϕ, Px γ − U >
inf sup (3)
γ≥0 ϕ,ψ − < ψ, Py γ − V >
< C, γ > − < ϕ, Px γ − U >
= sup inf (4)
ϕ,ψ γ≥0 − < ψ, Py γ − V >
" !#
< γ, C − Px t ϕ − Py t ψ > +
= sup inf (5)
ϕ,ψ γ≥0 < ϕ, U > + < ψ, V >
The first step (4) consists in exchanging the “inf” and “sup”. Then we
rearrange the terms (5). By reinterpreting this equation as a constrained op-
timization problem (similarly to what we did in the previous paragraph), we
finally obtain the constrained optimization problem in (6). In the constraint
Px t ϕ + Py t ψ ≤ C, the inequality is to be considered componentwise. Finally,
the problem (6) can be rewritten as:
11
sup [< ϕ, U > + < ψ, V >]
ϕ,ψ (7)
subject to ϕi + ψj ≤ cij , ∀i, j.
As compared to the primal problem (2) that depends on m × n variables
(all the coefficients γij of the optimal transport plan for all couples of points
(i, j)), this dual problem depends on m + n variables (the components ϕi and
ψj attached to the source points and target points). We will see later how
to further reduce the number of variables, but before then, we go back to the
general continuous setting (that is, with functions, measures and operators).
The classical image that gives an intuitive meaning to this dual problem is
to consider that instead of transporting earth by ourselves, we are now hiring a
company that will do the work on our behalf. The company has a special way
of determining the price: the function ϕ(x) corresponds to what they charge
for loading earth at x, and ψ(y) corresponds to what they charge for unloading
earth at y. The company aims at maximizing its profit (this is why the dual
problem is a “sup” rather than an “inf)”, but it cannot charge more than what
it would cost us if we were doing the work by ourselves (hence the constraint).
The existence of solutions for (DK) remains difficult to study, because the
set of functions ϕ, ψ that satisfy the constraint is not compact. However, it is
possible to reveal more structure of the problem, by introducing the notion of
c-transform, that makes it possible to exhibit a set of admissible functions with
sufficient regularity:
Definition 1. • For f any function on Y with values in R ∪ {−∞} and not
identically −∞, we define its c-transform by
with problem (K) requires more precautions than in the discrete case, in particular step (4)
(exchanging sup and inf), that uses a result of convex analysis (due to Rockafellar), see [Vil09]
chapter 5.
12
• If a function ϕ is such that there exists a function f such that ϕ = f c ,
then ϕ is said to be c-concave;
• Ψc (X) denotes the set of c-concave functions on X.
We now show two properties of (DK) that will allow us to restrict the problem
to the class of c-concave functions to search for ϕ and ψ:
Observation 2. If the pair (ϕ, ψ) is admissible for (DK), then the pair (ψ c , ψ)
is admissible as well.
Proof. (
∀(x, y) ∈ X × Y, ϕ(x) + ψ(y) ≤ c(x, y)
ψ c (x) = inf [c(x, y) − ψ(y)]
y∈Y
ψ c (x) + ψ(y) = inf [c(x, y 0 ) − ψ(y 0 )] + ψ(y)
y 0 ∈Y
≤ (c(x, y) − ψ(y)) + ψ(y)
≤ c(x, y).
Observation 3. If the pair (ϕ, ψ) is admissible for (DK), then one obtains a
better pair by replacing ϕ with ψ c :
Proof.
)
ψ c (x) = inf [c(x, y) − ψ(y)]
y∈Y ⇒ ψ c (x) ≤ ϕ(x).
∀y ∈ Y, ϕ(x) ≤ c(x, y) − ψ(y)
ϕ dµ + ϕc dν
R R
inf(K) = sup
ϕ∈Ψc (X) X Y
c
R R
= sup ψ dµ + ψ dν
ψ∈Ψc (Y ) X Y
We do not give here the detailed proof for existence. The reader is referred
to [Vil09], Chapter 4. The idea is that we are now in a much better situation,
since the set of admissible functions Ψc (X) is compact6 .
13
5 From the Kantorovich dual to the optimal trans-
port map
5.1 The c-superdifferential
Suppose now that in addition to the optimal cost you want to know the associ-
ated way to transform µ into ν, in other words, when it exists, the map T from
X to Y which associated transport plan (Id × T )]µ minimizes the functional of
the Monge problem. A result characterizes the support of γ, that is the subset
∂ c ϕ ⊂ X × Y of the pairs of points (x, y) connected by the transport plan:
Theorem 1. Let ϕ a c-concave function. For all (x, y) ∈ ∂ c ϕ, we have
∇ϕ(x) − ∇x c(x, y) = 0,
where ∂ c ϕ = {(x, y) | ϕ(z) ≤ ϕ(x) + (c(z, y) − c(x, y)), ∀z ∈ X}7 denotes the
so-called c-superdifferential of ϕ.
Proof. See [Vil09] chapters 9 and 10.
In order to give an idea of the relation between the c-superdifferential and the
associated transport map T , we present below a heuristic argument: consider a
point (x, y) in the c-superdifferential ∂ c ϕ, then for all z ∈ X we have
c(x, y) − ϕ(x) ≤ c(z, y) − ϕ(z). (9)
Now, by using (9), we can compute the derivative at x with respect to an
arbitrary direction w
ϕ(x + tw) − ϕ(x) c(x + tw, y) − c(x, y)
lim ≤ lim+
t→0+ t t→0 t
and we obtain ∇ϕ(x) · w ≤ ∇x c(x, y) · w. We can do the same derivation along
direction −w instead of w, and then we get ∇ϕ(x) · w = ∇x c(x, y) · w, ∀w ∈ X.
In the particular case of the L2 cost, that is with c(x, y) = 1/2kx − yk2 ,
this relation becomes ∀(x, y) ∈ ∂ c ϕ, ∇ϕ(x) + y − x = 0, thus, when the optimal
transport map T exists, it is given by
T (x) = x − ∇ϕ(x) = ∇(kxk2 /2 − ϕ(x)).
Not only this gives an expression of T in function of ϕ, which is of high interest
to us if we want to compute the transport explicitly. In addition, this makes it
possible to characterize T as the gradient of a convex function (see also Brenier’s
polar factorization theorem [Bre91]). This convexity property is interesting,
because it means that two “transported particles” x1 7→ T (x1 ) et x2 7→ T (x2 )
will never collide. We now see how to prove these two assertions (T gradient of
a convex function and absence of collision) in the case of the L2 transport (with
(c(x, y) = 1/2kx − yk2 ).
7 By definition of the c-transform, if (x, y) ∈ ∂ c ϕ, then ϕc (y) = c(x, y) − ϕ(x). Then,
the c-superdifferential can be characterized by the set of all points (x, y) ∈ X × Y such that
ϕ(x) + ϕc (y) = c(x, y).
14
Figure 8: The upper envelope of a family of affine functions is a convex function.
15
Observation 5. We now consider the trajectories of two particles parameterized
by t ∈ [0, 1], t 7→ (1 − t)x1 + tT (x1 ) and t 7→ (1 − t)x2 + tT (x2 ). If x1 6= x2 and
0 < t < 1 then there is no collision between the two particles.
Proof. By contradiction, suppose there is a collision, that is there exists t ∈ (0, 1)
and x1 6= x2 such that
Therefore,
The last step leads to a contradiction, between the left-hand side is the sum
of two strictly positive numbers (recalling the definition of the convexity of ϕ̄:
∀x1 6= x2 , (x1 − x2 ) · (∇ϕ̄(x1 ) − ∇ϕ̄(x2 )) > 0 )8
16
where JT denotes the Jacobian matrix of T and det denotes the determinant.
R
If µ and νR have densities u and v respectively, that is ∀B, µ(B) = B u(x)dx
and ν(B) = B v(x)dx, then one can (formally) consider (10) pointwise in X:
where H ϕ̄ denotes the Hessian matrix of ϕ̄. Equation (12) is known ad the
Monge-Ampère equation. It is a highly non-linear equation, and its solutions
when they exist often present singularities9 . Note that the derivation above is
purely formal, and that studying the solutions of the Monge-Ampère equation
require using more sophisticated tools. In particular, it is possible to define sev-
eral types of weak solutions (viscosity solutions, solution in the sense of Brenier,
solutions in the sense of Alexandrov . . . ). Several algorithms to compute numer-
ical solutions of the Monge-Ampère equations were proposed. As such, see for
instance the Benamou-Brenier algorithm [BB00], that uses a dynamic formu-
lation inspired by fluid dynamics (incompressible Euler equation with specific
boundary conditions). See also [PPO14].
17
Figure 10: Semi-discrete transport: gray levels symbolize the quantity of a
resource that will be transported to 4 factories. Each factory will be allocated a
part of the terrain in function of the quantity of resource that it should collect.
7 Semi-discrete transport
We now suppose that the source measure µ is continuous, and that the target
measure ν is a sum of Dirac masses. A practical example of this type of config-
uration corresponds to a resource which available quantity is represented by a
function u. The resource is collected by a set of n factories, as shown in Figure
10. Each factory is supposed to collect a certain prescribed quantity of resource
νj . Clearly, the sum
Pnof all prescriptions
R corresponds to the total quantity of
available resource ( j=1 νj = X u(x)dx).
R R
inf c(x, T (x))u(x)dx, subject to u(x)dx = νj , ∀j.
T :X→Y X
T −1 (yj )
Let us now examine the form of the dual Kantorovich problem. In terms of
measure, the source measure
Pn µ has a density u, and the target measure ν is a
sum of Dirac masses ν = j=1 νj δyj , supported by the set of points Y = {yj }.
We recall that in its general form, the dual Kantorovich problem is written as
follows: Z Z
c
sup ψ (x)dµ + ψ(y)dν . (13)
ψ∈Ψc (Y ) X Y
18
Figure 11: The objective function of the dual Kantorovich problem is concave,
because its graph is the lower envelope of a family of affine functions.
Xn Z n
X
= (c(x, yj ) − ψj ) u(x)dx + ψj νj . (17)
j=1 c (y ) j=1
Lagψ j
The first step (15) takes into account the nature of the measures µ and ν.
In particular, one can notice that the measure ν is completely defined by the
scalars νj associated with the points yj , and the function ψ is definedR by the
scalars ψj that correspondPto its value at each point yj . The integral Y ψ(y)dν
becomes the dot product j ψj νj . Thus, the functional that corresponds to the
dual Kantorovich problem becomes a function F that depends on n variables
(the ψj ). Let us now replace the c-conjugate ψ c with its expression, which gives
(16). The integral in the left term can be reorganized, by grouping the points of
X for which the same point yj minimizes c(x, yj ) − ψj , which gives (17), where
the Laguerre cell Lagψc (yj ) is defined by:
The Laguerre diagram, formed by the union of the Laguerre cells, is a clas-
sical structure in computational geometry. In the case of the L2 cost c(x, y) =
1/2kx − yk2 , it corresponds to the power diagram, that was studied by Au-
renhammer at the end of the 80’s [Aur87]. One of its particularities is that
the boundaries of the cells are rectilinear, making it reasonably easy to design
computational algorithms to construct them.
19
7.2 Concavity of F
The objective function F is a particular case of the Kantorovich dual, and
naturally inherits its properties, such as its concavity (that we did not discuss
yet). This property is interesting both from a theoretical point of view, to study
the existence and uniqueness of solutions, and from a practical point of view, to
design efficient numerical solution mechanisms. In the semi-discrete case, the
concavity of F is easier to prove than in the general case. We summarize here
the proof by Aurenhammer et. al [AHA92], that leads to an efficient algorithm
[Mér11], [Lév15], [KMT16].
Theorem 2. The objective function F of the semi-discrete Kantorovich dual
problem (13) is concave.
Proof. Consider the function G defined by:
Z
G(A, [ψ1 , . . . ψn ]) = c(x, yA(x) ) − ψA(x) u(x)dx, (18)
X
The first term does not depend on the ψj , and the second one is a linear combi-
nation of the ψj coefficients, thus, for a given fixed assignment A, ψ 7→ G(A, ψ)
is an affine function of ψ. Figure 11 depicts the appearance of the graph of G
for different assignment. The horizontal axis symbolizes the components of the
vector ψ (of dimension n) and the vertical axis the value of G(A, ψ). For a given
assignment A, the graph of G is an hyperplane (symbolized here by a straight
line).
Among all the possible assignments A, we distinguish Aψ that associates
with a point x the index j of the Laguerre cell x belongs to 10 , that is:
For a fixed vector ψ = ψ 0 , among all the possible assignments A, the assign-
0
ment Aψ minimizes the value G(A, ψ 0 ), because it minimizes the integrand
pointwise (see Figure 11 on the left. Thus, since G is affine with respect to
ψ, the graph of the function ψ → G(Aψ , ψ) is the lower envelope of a family
of hyperplanes (symbolized as straight lines in Figure 11 on the right), hence
ψ → G(Aψ , ψ) is a concave function. Finally, the objective function F of the
10 A is undefined on the set of Laguerre cell boundaries, this does not cause any difficulty
20
dual Kantorovich problem can be written as F (ψ) = G(Aψ , ψ) + j νj ψj , that
P
is, the sum of a concave function and a linear function, hence it is also a concave
function.
= ψ(yi ).
This allows to conclude that ψ is a c-convex function (see [San15, Proposition
1.34]).
21
Moreover, the converse of the theorem is also true:
Theorem 4. Let Y = {y1 , . . . , yn } be a set of n points. Let ψ be a c-concave
function defined on Y . Then the sets Lagψc (yi ) are not empty for all i =
1, . . . , n,.
Proof. Reasoning by contradiction, we suppose that ψ is a c-concave function
and there exist i0 ∈ {1, . . . , n} such that Lagψc (yi0 ) = ∅. Then, from definition
= inf [ψ(yi0 ) + j ]
j
> ψ(yi0 ).
This contradicts the fact that ψ is a c-concave function, because [San15, Propo-
sition 1.34].
We now proceed to compute the first and second order derivatives of the
objective function F . These derivatives are useful in practice to design compu-
tational algorithms.
22
Let x ∈ Lagψc (ym ), then for t small enough we have
c(x, ym ) − ψm ≤ c(x, yj ) − ψj − t.
P
Recalling that the objective function F is given by F (ψ) = G(Aψ , ψ) + j νj ψj ,
we finally obtain: Z
∂F
= νj − u(x)dx. (26)
∂ψj
c (y )
Lagψ j
∂2G
Z
u(x)
(ψ) = dS(x) (i 6= j),
∂ψi ∂ψj kyi − yj k
c c
Lagψ (yi )∩Lagψ (yj )
(27)
2 X ∂2G
∂ G
(ψ) = − (ψ).
∂ψj2 ∂ψi ∂ψj
i6=j
23
7.6 A computational algorithm for L2 semi-discrete opti-
mal transport
With the definition of F (ψ), the expression of its first order derivatives (gradient
∇F ) and second order derivatives (Hessian matrix ∇2 F = ∂ 2 F/∂ψi ∂ψj ij ),
we are now equipped to design a numerical solution mechanism that computes
semi-discrete optimal transport by maximizing F , based on a particular version
[KMT16] of Newton’s optimization method [NW06]:
Input: a mesh that supports the source density u
the points (yj )nj=1
the prescribed quantities (νj )nj=1
Output: the (unique)
R Laguerre diagram Lagψc such that:
u(x)dx = νj ∀j
c (y )
Lagψ j
(1) ψ ← [0 . . . 0]
(2) While convergence is not reached
(3) Compute ∇F and ∇2 F
(4) Find p ∈ Rn such that ∇2 F (ψ)p = −∇F (ψ)
(5) Find the descent parameter α
(6) ψ ← ψ + αp
(7) End while
The source measure is given by its density, that is a positive piecewise linear
function u, supported by a triangulated mesh (2D) or tetrahedral mesh (3D)
of a domain X. The target measure is discrete, and supported by the pointset
Y = (yj )nj=1 . Each target point will receive the prescribed quantity of matter
νj . Clearly,
R the prescriptions
P should be balanced with the available resource,
that is X u(x)dx = j νj . The algorithm computes for each point of the target
measure the subset of X that is affected to it through the optimal transport,
T −1 (yj ) = Lagψc (yj ), that corresponds to the Laguerre cell of yj . The Laguerre
diagram is completely determined by the vector ψ that maximizes F .
Line (2) needs a criterion for convergence. The classical convergence cri-
terion for a Newton algorithm uses the norm of the gradient of F . In our
case, the components of the gradient of F have a geometric meaning, since
∂F/∂ψj corresponds to the difference between the prescribed quantity νj asso-
ciated
R with j and the quantity of matter present in the Laguerre cell of yj given
by Lagc (yj )u(x)dx. Thus, we can decide to stop the algorithm as soon as the
ψ
largest absolute value of a component becomes smaller than a certain percent-
age of the smallest prescription. Thus we consider that convergence is reached if
max |∇Fj | < minj νj , for a user-defined (typically 1% in the examples below).
Line (3) computes the coefficients of the gradient and the Hessian matrix of
F , using (26) and (27). These computations involve integrals over the Laguerre
24
cells and over their boundaries. For the L2 cost c(x, y) = 1/2kx − yk2 , the
boundaries of the Laguerre cells are rectilinear, which dramatically simplifies
the computations of the Hessian coefficients (27). In addition, it makes it possi-
ble to use efficient algorithms to compute the Laguerre diagram [Bow81, Wat81].
Their implementation is available in several programming libraries, such as GE-
OGRAM11 et CGAL12 . Then one needs to compute the intersection between
each Laguerre cell and the mesh that supports the density u. This can be done
with specialized algorithms [Lév15], also available in GEOGRAM.
Line (4) finds the Newton step p by solving a linear system. We use the
Conjugate Gradient algorithm [HS52] with the Jacobi preconditioner. In our
empirical experiments below, we stopped the conjugate iterations as soon as
k∇2 F p + ∇F k/k∇F k < 10−3 .
Line (5) determines the descent parameter α. A result due to Mérigot and
Kitagawa [KMT16] ensures the convergence of the Newton algorithm if the mea-
sure of the smallest Laguerre cell remains larger than a certain threshold (that
is, half the smallest prescription νj ). There is also a condition on the norm of
the gradient k∇F k that we do not repeat here (the reader is referred to Mérigot
and Kitagawa’s original article for more details). In our implementation, start-
ing with α = 1, we iteratively divide α by two until both conditions are satisfied.
Let us now make one step backwards and think about the original definition
of Monge’s problem (M). We wish to stress that the initial constraint (local
mass conservation) that characterizes transport maps was terribly difficult. It
is remarkable that after several rewrites (Kantorovich relaxation, duality, c-
convexity), the final problem becomes as simple as optimizing a regular (C 2 )
concave function, for which computing the gradient and Hessian is easy in the
semi-discrete case and boils down to evaluating volumes and areas in a Laguerre
diagram. We wish also to stress that the computational algorithm did not re-
quire to make any approximation or discretization. The discrete, computer
version is a particular setting of the general theory, that fully describes not only
transport between smooth objects (functions), but also transport between less
regular objects, such as pointsets and triangulated meshes. This is made possi-
ble by the rich mathematical vocabulary (measures) on which optimal transport
theory acts. Thus, the computational algorithm is an elegant, direct verbatim
translation of the theory into a computer program.
25
Figure 12: A: transport between a uniform density and a random pointset; B:
transport between a varying density and the same pointset; C: intersections be-
tween meshes used to compute the coefficients; D: transport between a measure
supported by a surface and a 3D pointset.
26
Figure 13: Interpolation of 3D volumes using optimal transport.
27
Figure 16: Numerical simulation of an incompressible bi-phasic flow in a bottle.
To ensure that our results are reproducible, the source-code associated with
28
Figure 17: Top: Numerical simulation of the Taylor-Rayleigh instability using a
3D version of the Gallouet-Mérigot scheme, with a cross-section that reveals the
29
internal structure of the vortices. Bottom: a closeup that shows the interface
between the two fluids, represented by the Laguerre facets that bound two
Laguerre cells of different fluid elements.
the numerical solution mechanism used in all these experiments is available in
the EXPLORAGRAM component of the GEOGRAM programming library13 .
Acknowledgments
This research is supported by EXPLORAGRAM (Inria Exploratory Research
Grant). The authors wish to thank Quentin Mérigot, Yann Brenier, Jean-David
Benamou, Nicolas Bonneel and Lénaı̈c Chizat for many discussions.
References
[AG13] Luigi Ambrosio and Nicolas Gigli. A users guide to optimal trans-
port. Modelling and Optimisation of Flows on Networks, Lecture
Notes in Mathematics, pages 1–155, 2013.
[AHA92] Franz Aurenhammer, Friedrich Hoffmann, and Boris Aronov.
Minkowski-type theorems and least-squares partitioning. In Sym-
posium on Computational Geometry, pages 350–357, 1992.
[Ale05] A. D. Alexandrov. Intrinsic geometry of convex surfaces (transla-
tion of the 1948 Russian original). CRC Press, 2005.
30
[Bre91] Yann Brenier. Polar factorization and monotone rearrangement
of vector-valued functions. Communications on Pure and Applied
Mathematics, 44:375–417, 1991.
[BvdPPH11] Nicolas Bonneel, Michiel van de Panne, Sylvain Paris, and Wolf-
gang Heidrich. Displacement interpolation using lagrangian mass
transport. ACM Trans. Graph., 30(6):158, 2011.
[Caf03] Luis Caffarelli. The monge-ampère equation and optimal trans-
portation, an elementary review. Optimal transportation and ap-
plications (Martina Franca, 2001), Lecture Notes in Mathematics,
pages 1–10, 2003.
31
[McC95] Robert J. McCann. Existence and uniqueness of monotone
measure-preserving maps. Duke Mathematical Journal, 80(2):309–
323, 1995.
[Mém11] Facundo Mémoli. Gromov-wasserstein distances and the met-
ric approach to object matching. Foundations of Computational
Mathematics, 11(4):417–487, 2011.
[Mér11] Quentin Mérigot. A multiscale approach to optimal transport.
Comput. Graph. Forum, 30(5):1583–1592, 2011.
[MMT17] Quentin Mérigot, Jocelyn Meyron, and Boris Thibert. Light in
power: A general and parameter-free algorithm for caustic design.
CoRR, abs/1708.04820, 2017.
[Mon84] Gaspard Monge. Mémoire sur la théorie des déblais et des rem-
blais. Histoire de l’Acadmie Royale des Sciences (1781), pages
666–704, 1784.
32