Low-level interface to the optimal transportation solver.
Only ever useful if you plan to use the stubs directly. This is used to store the cost of the transportation plan produced by
kanto_solve x y D G u v cost num_iter computes an optimal transportation plan from
y according to the cost matrix
D. The optimal plan is stored in the matrix
G, and the dual optimal variables (the "prices") are stored in
v. Note that
D need not satisfy the triangle inequality.
The cost associated to
G is stored in the reference cell
num_iter specifies the maximum number of iterations of the algorithm.
kanto_solve also returns the state of the solver at the end of the process as a value of type
kanto_solve does not allocate memory. All matrices and vectors must be preallocated by the user.
High-level interface to the optimal transportation solver.
type result =
result type encodes the outcome of solving an instance of the optimal mass transportation problem.
kantorovich x y d num_iter is a wrapper around
kanto_solve which will allocate all intermediate structures for you. If you plan to perform a lot of calls to the solver for fixed sizes of
y you might want to consider using the low-level interface, to avoid reallocating those intermediate structures.