Kantorovich Duality [kantorovich_duality]
Kantorovich Duality [kantorovich_duality]
In optimization, duality is a consistently useful way of solving problems. It is mentioned in *Computational Optimal Transport*, but the derivation of the dual problem in that book is quite concise, which can be unfriendly to readers who are still building their optimization background. I therefore studied the relevant material and wrote these annotated notes to clarify this part and strengthen my own understanding.
1. The Discrete Optimal Transport Problem
Consider two discrete probability distributions: a=(a_1,\dots,a_n)\in \mathbb R_+^n, \, b=(b_1,\dots,b_m)\in \mathbb R_+^m, satisfying \sum_{i=1}^n a_i=\sum_{j=1}^m b_j. Let the transport cost matrix be C=(C_{ij})\in \mathbb R^{n\times m}. Here, C_{ij} denotes the cost of transporting one unit of mass from source point i to target point j. The transport plan is denoted by P=(P_{ij})\in \mathbb R_+^{n\times m},
where P_{ij}\ge 0 represents the amount of mass transported from i to j. The Kantorovich optimal transport problem is
subject to
In matrix form, this is
Denote the primal optimal value by
2. Introducing the Lagrangian
The basic idea of constrained optimization is to multiply equality constraints by Lagrange multipliers and add them to the objective function. On the feasible set, the constraint terms are equal to zero, so this operation does not change the original objective. For the constraint
introduce a multiplier f_i. For the constraint
introduce a multiplier g_j. Since these are equality constraints, f_i and g_j are unrestricted in sign. Define the Lagrangian as
If P is primal feasible, then
Therefore, for any f,g, we have
This shows that the Lagrangian coincides with the original objective on the primal feasible set.
3. Rearranging the Lagrangian
Expanding the Lagrangian and collecting the coefficients of P_{ij}, we obtain
Hence,
Let
Then
Here, s_{ij} is the slack variable associated with the dual constraint.
4. Why the Lagrangian Gives a Lower Bound
Although \mathcal L(P,f,g) equals \langle C,P\rangle on the primal feasible set, the derivation of the dual problem does not restrict attention only to that feasible set. Define the dual function:
Note that the marginal constraints have now been relaxed; only
is retained. Since
taking the infimum over the larger set can only decrease the value, or leave it unchanged:
On the primal feasible set,
Therefore,
Thus, d(f,g) is a lower bound on the primal optimal value. The dual problem is to find the tightest such lower bound:
5. Computing the Dual Function
From
we see that when taking the infimum over P\ge0, the behavior of each P_{ij} is determined by the coefficient
Case 1: A Negative Coefficient Exists
If there exists some (i,j) such that
then by letting
we obtain
Therefore,
Such a pair (f,g) cannot provide a meaningful lower bound.
Case 2: All Coefficients Are Nonnegative
If, for all (i,j),
that is,
then
Therefore,
The infimum is attained at P=0. Note that P=0 is generally not primal feasible, but it belongs to the relaxed set P\ge0.
6. Deriving the Kantorovich Dual Problem
From the previous section, to make the dual function finite, it is necessary to require
Under this condition,
Therefore, the Kantorovich dual problem is
subject to
It can also be written as
where
Here, f,g are called Kantorovich potentials.
7. A Direct Understanding of Weak Duality
If (f,g) satisfies
then for any primal feasible P,
Using the marginal constraints, the right-hand side expands as
Since
we have
and
Therefore,
This shows that any dual feasible pair (f,g) gives a lower bound on the primal transport cost. Hence,
This is weak duality.
8. Strong Duality
Since discrete OT is a finite-dimensional linear program, strong duality for linear programming holds whenever the problem is feasible and has a finite optimal value. Therefore,
In other words, the best lower bound is exactly equal to the minimum primal transport cost.
Proving Strong Duality for Linear Programming via Farkas' Lemma
Consider a linear program in the following standard primal form:
Its weak dual is
By weak duality,
We now need to prove the reverse inequality:
Farkas' Lemma
For a matrix A\in \mathbb R^{m\times n} and a vector b\in \mathbb R^m, exactly one of the following two statements is true:
- There exists x\in\mathbb R^n such that
- There exists y\in\mathbb R^m such that
Geometrically, the first case says that b lies in the nonnegative cone generated by the columns of A; the second case says that there exists a hyperplane separating b from this cone.
From Farkas' Lemma to Strong Duality
Suppose the primal optimal solution is x^\star, with optimal value
Take any \varepsilon>0.
Since z^\star is already the minimum value, there does not exist x\ge0 such that
Equivalently, there does not exist x\ge0 satisfying
where
That is, the system
has no solution.
By Farkas' lemma, there exists
such that
Expanding the first condition gives
Therefore,
Expanding the second condition gives
Thus,
Showing That \alpha>0
When \varepsilon=0, we have
Thus, the system
has a solution.
By Farkas' lemma, in this case there cannot exist \widehat y such that
In other words, whenever
we must have
But we already have
Since
the above inequality can be positive only if
Obtaining a Dual Feasible Solution
Since \alpha>0, define
From
we obtain
Thus, \tilde y is dual feasible.
Moreover, from
dividing both sides by \alpha>0 gives
Therefore,
Since \varepsilon>0 is arbitrary,
Together with weak duality,
we conclude that
That is,
This is strong duality for linear programming.
9. Complementary Slackness
Let P^\star be a primal optimal solution, and let (f^\star,g^\star) be a dual optimal solution.
Strong duality gives
On the other hand, by the primal-dual gap identity,
Substituting the optimal solutions gives
Since
every term is nonnegative. A sum of nonnegative terms can equal zero only when each term is zero:
This is the complementary slackness condition. Equivalently,
In other words, optimal transport occurs only along edges where the dual constraint is tight.
10. The Meaning of Complementary Slackness
Define the slack variable:
Complementary slackness is
Its meaning is as follows:
- If P_{ij}^\star>0, then s_{ij}=0, that is,
- If s_{ij}>0, then P_{ij}^\star=0.
That is,
However, the converse is not necessarily true:
only indicates that the edge may be used; it does not guarantee
Therefore,
11. The Role of the Potentials
The Kantorovich potentials f,g mainly serve three purposes.
11.1 Proving Optimality
If we find a primal feasible P and a dual feasible pair (f,g) such that
then both P and (f,g) are optimal. The reason is that the dual objective is a lower bound on the primal objective. If a primal feasible solution exactly attains this lower bound, it cannot be improved further.
11.2 Locating the Support of the Optimal Transport Plan
By complementary slackness,
Therefore, the potentials help rule out edges that cannot be used:
11.3 Interpreting Potentials as Prices or Potential Energy
One can interpret f_i as the price of source point i and g_j as the price of target point j. The constraint
means that the total potential from i to j cannot exceed the true transport cost. At optimality, every edge that actually carries mass satisfies
That is, on the used edges, the potential exactly matches the transport cost.
12. Summary
The primal problem of discrete Kantorovich optimal transport is
Using the Lagrangian
and taking the infimum over P\ge0, we obtain the dual feasibility condition
Therefore, the Kantorovich dual problem is
Strong duality guarantees that
The optimal solutions satisfy complementary slackness:
Thus,
This means that optimal transport occurs only where the potentials are tangent to the cost matrix.
Reference
- Jianlin Su. "From Wasserstein Distance and Duality Theory to WGAN." *Scientific Spaces*, 2019-01. https://spaces.ac.cn/archives/6280
- Gabriel Peyré and Marco Cuturi. *Computational Optimal Transport*. *Foundations and Trends in Machine Learning*, 2019. https://optimaltransport.github.io/book/