Skip to content

Commit e7cba02

Browse files
authored
[MRG] update LP barycenter with new scipy solvers (#537)
* update lp barycenter with new scipy solvers * use default solver in exmaple qnd add release info
1 parent a9de7a0 commit e7cba02

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

RELEASES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
+ The `linspace` method of the backends now has the `type_as` argument to convert to the same dtype and device. (PR #533)
1010
+ The `convolutional_barycenter2d` and `convolutional_barycenter2d_debiased` functions now work with different devices.. (PR #533)
1111
+ New API for Gromov-Wasserstein solvers with `ot.solve_gromov` function (PR #536)
12+
+ New LP solvers from scipy used by default for LP barycenter (PR #537)
1213

1314
#### Closed issues
1415
- Fix line search evaluating cost outside of the interpolation range (Issue #502, PR #504)

examples/barycenters/plot_barycenter_lp_vs_entropic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484

8585
ot.tic()
86-
bary_wass2 = ot.lp.barycenter(A, M, weights, solver='interior-point', verbose=True)
86+
bary_wass2 = ot.lp.barycenter(A, M, weights)
8787
ot.toc()
8888

8989
pl.figure(2)
@@ -149,7 +149,7 @@
149149

150150

151151
ot.tic()
152-
bary_wass2 = ot.lp.barycenter(A, M, weights, solver='interior-point', verbose=True)
152+
bary_wass2 = ot.lp.barycenter(A, M, weights)
153153
ot.toc()
154154

155155

@@ -223,7 +223,7 @@
223223

224224

225225
ot.tic()
226-
bary_wass2 = ot.lp.barycenter(A, M, weights, solver='interior-point', verbose=True)
226+
bary_wass2 = ot.lp.barycenter(A, M, weights)
227227
ot.toc()
228228

229229

ot/lp/cvx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def scipy_sparse_to_spmatrix(A):
2525
return SP
2626

2727

28-
def barycenter(A, M, weights=None, verbose=False, log=False, solver='interior-point'):
28+
def barycenter(A, M, weights=None, verbose=False, log=False, solver='highs-ipm'):
2929
r"""Compute the Wasserstein barycenter of distributions A
3030
3131
The function solves the following optimization problem [16]:
@@ -115,13 +115,13 @@ def barycenter(A, M, weights=None, verbose=False, log=False, solver='interior-po
115115
A_eq = sps.vstack((A_eq1, A_eq2))
116116
b_eq = np.concatenate((b_eq1, b_eq2))
117117

118-
if not cvxopt or solver in ['interior-point']:
118+
if not cvxopt or solver in ['interior-point', 'highs', 'highs-ipm', 'highs-ds']:
119119
# cvxopt not installed or interior point
120120

121121
if solver is None:
122122
solver = 'interior-point'
123123

124-
options = {'sparse': True, 'disp': verbose}
124+
options = {'disp': verbose}
125125
sol = sp.optimize.linprog(c, A_eq=A_eq, b_eq=b_eq, method=solver,
126126
options=options)
127127
x = sol.x

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
numpy>=1.20
2-
scipy>=1.3
2+
scipy>=1.6
33
matplotlib
44
autograd
55
pymanopt

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
scripts=[],
7070
data_files=[],
7171
setup_requires=["oldest-supported-numpy", "cython>=0.23"],
72-
install_requires=["numpy>=1.16", "scipy>=1.0"],
72+
install_requires=["numpy>=1.16", "scipy>=1.6"],
7373
python_requires=">=3.6",
7474
classifiers=[
7575
'Development Status :: 5 - Production/Stable',

0 commit comments

Comments
 (0)