|
deblais
Exact optimal transport between point clouds
|
An optimal transport plan and its dual certificate. More...
#include <deblais/plan.hpp>
Public Member Functions | |
| std::size_t | size () const |
| Number of arcs of the plan. | |
Public Attributes | |
| Status | status = Status::optimal |
| Outcome of the solve. | |
| Method | method = Method::simplex |
| Method that ran, never Method::automatic. | |
| double | cost = 0 |
| Transport cost \(\sum_k \text{mass}_k\,|x_{\text{source}_k} - y_{\text{target}_k}|^p\). | |
| double | p = 2 |
| Exponent of the cost, Options::p of the solve. | |
| std::vector< std::int32_t > | source |
| Index of the source point of every arc. | |
| std::vector< std::int32_t > | target |
| Index of the target point of every arc. | |
| std::vector< double > | mass |
| Mass shipped along every arc, in the units of the source masses. | |
| std::vector< double > | potential_source |
| Kantorovich potential \(f\) of every source point. Empty when Options::potentials is false. | |
| std::vector< double > | potential_target |
| Kantorovich potential \(g\) of every target point. Empty when Options::potentials is false. | |
| Stats | stats |
| Counters and timings of the solve. | |
An optimal transport plan and its dual certificate.
The plan is sparse: it is a vertex of the transport polytope, with at most n1 + n2 - 1 arcs for n1 sources and n2 targets. Arc k ships mass[k] from the source point source[k] to the target point target[k]. The arcs are sorted by source, then by target.
The potentials \(f\) (sources) and \(g\) (targets) solve the dual problem:
\[ f_i + g_j \le |x_i - y_j|^p \ \text{for every pair,} \qquad \text{cost} = \sum_i a_i f_i + \sum_j b_j g_j , \]
with equality in the constraint on the arcs of the plan. They are what certify() checks.
|
inline |
Number of arcs of the plan.
| double deblais::Plan::cost = 0 |
Transport cost \(\sum_k \text{mass}_k\,|x_{\text{source}_k} - y_{\text{target}_k}|^p\).
For probability measures, this is the Wasserstein-p distance to the power p: the squared Wasserstein-2 distance for the default p = 2.