JuliaOptimalTransport / OptimalTransport.jl

Optimal transport algorithms for Julia
https://juliaoptimaltransport.github.io/OptimalTransport.jl/dev
MIT License
94 stars 8 forks source link

Refactor quadreg #119

Closed zsteve closed 3 years ago

zsteve commented 3 years ago

Refactored quadreg to follow the conventions introduced for entropy-regularised OT.

This PR introduces QuadraticOT as a base problem type, with an associated solver QuadraticOTSolver. The method of Lorenz et al. (2019) is re-implemented as the algorithm QuadraticOTNewton.

The implementation of solve! currently relies on two functions descent_dir! and descent_step!, which respectively compute the descent direction (in terms of the dual variables u, v) and perform the descent step (currently following the Armijo step size rule in the Lorenz paper). This is actually quite general, and an alternative approach could be to rename QuadraticOT to a RegularizedOT type for optimal transport problems with arbitrary regularizer.

The previous implementation of quadreg relied on sparse matrices from SparseArrays, but passed between dense and sparse matrices repeatedly since transposes needed to be computed. The implementation in this PR uses dense matrices.

This could be implemented in future, but may also mean more work, since Sinkhorn maybe should then also inherit from RegularizedOT.

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 1162444673

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/quadratic_newton.jl 102 104 98.08%
<!-- Total: 122 124 98.39% -->
Totals Coverage Status
Change from base Build 1161394375: 0.9%
Covered Lines: 666
Relevant Lines: 682

💛 - Coveralls