diff options
author | RĂ©mi Flamary <remi.flamary@gmail.com> | 2017-08-30 15:47:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-30 15:47:16 +0200 |
commit | 16697047eff9326a0ecb483317c13a854a3d3a71 (patch) | |
tree | b9a8659370286820563a1fd1a9ea09ed0a9003a3 /ot/lp/EMD_wrapper.cpp | |
parent | a2ec6e55e458c719484e86a4e6a6e764c2e38dc8 (diff) | |
parent | fadaf2ab3c3844d281b22f8d5c3404c3c4cf7d97 (diff) |
Merge pull request #25 from aje/master
Add iter_max to lp solver and fixes #24
Diffstat (limited to 'ot/lp/EMD_wrapper.cpp')
-rw-r--r-- | ot/lp/EMD_wrapper.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ot/lp/EMD_wrapper.cpp b/ot/lp/EMD_wrapper.cpp index cad4750..c8c2eb3 100644 --- a/ot/lp/EMD_wrapper.cpp +++ b/ot/lp/EMD_wrapper.cpp @@ -15,11 +15,10 @@ #include "EMD.h" -void EMD_wrap(int n1,int n2, double *X, double *Y,double *D, double *G, double *cost) { +int EMD_wrap(int n1,int n2, double *X, double *Y,double *D, double *G, double *cost, int max_iter) { // beware M and C anre strored in row major C style!!! int n, m, i,cur; double max; - int max_iter=10000; typedef FullBipartiteDigraph Digraph; DIGRAPH_TYPEDEFS(FullBipartiteDigraph); @@ -46,7 +45,7 @@ void EMD_wrap(int n1,int n2, double *X, double *Y,double *D, double *G, double * std::vector<int> indI(n), indJ(m); std::vector<double> weights1(n), weights2(m); Digraph di(n, m); - NetworkSimplexSimple<Digraph,double,double, node_id_type> net(di, true, n+m, n*m,max_iter); + NetworkSimplexSimple<Digraph,double,double, node_id_type> net(di, true, n+m, n*m, max_iter); // Set supply and demand, don't account for 0 values (faster) @@ -116,5 +115,5 @@ void EMD_wrap(int n1,int n2, double *X, double *Y,double *D, double *G, double * }; - + return ret; } |