Skip to contents

Minimises <C, F> subject to the marginals. When F is supplied its cost is reported and optimal is FALSE; otherwise the exact optimum is solved and CERTIFIED against its dual before anything is returned.

Usage

morie_kamath_ch8_wmd(x_n, y_n, C, F = NULL)

Arguments

x_n, y_n

Marginal weights of equal total mass.

C

Cost matrix.

F

Optional transport plan.

Value

List with estimate, flow, dual_objective, optimal.

Examples

C <- matrix(c(0, 3, 2, 1, 1, 4), 2, 3)
morie_kamath_ch8_wmd(c(0.5, 0.5), c(0.2, 0.5, 0.3), C)
#> $estimate
#> [1] 0.8
#> 
#> $flow
#>      [,1] [,2] [,3]
#> [1,]  0.2  0.0  0.3
#> [2,]  0.0  0.5  0.0
#> 
#> $dual_objective
#> [1] 0.8
#> 
#> $potentials_u
#> [1] 1 1
#> 
#> $potentials_v
#> [1] -1  0  0
#> 
#> $optimal
#> [1] TRUE
#> 
#> $n
#> [1] 2
#> 
#> $method
#> [1] "Word Mover's Distance, exact transport LP (Kamath Eq 8.10)"
#>