diff options
author | Arnur Nigmetov <a.nigmetov@gmail.com> | 2017-07-05 10:01:51 -0700 |
---|---|---|
committer | Arnur Nigmetov <a.nigmetov@gmail.com> | 2017-07-05 10:01:51 -0700 |
commit | 5d304d5720cd23ab9aa1179a147ae1e12ee17950 (patch) | |
tree | 163e239eb98823b1e36b6dd74c8bf09b3fb35543 /geom_matching/wasserstein/include/dnn/local/kd-tree.hpp | |
parent | 4cf869f64724d0f7e2e3a3c88bcc3da3a8e3b1a9 (diff) |
Price adjustment; maxIterNum increased
For high Wasserstein powers price adjustment (subtract minimal price) is
needed.
Diffstat (limited to 'geom_matching/wasserstein/include/dnn/local/kd-tree.hpp')
-rw-r--r-- | geom_matching/wasserstein/include/dnn/local/kd-tree.hpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/geom_matching/wasserstein/include/dnn/local/kd-tree.hpp b/geom_matching/wasserstein/include/dnn/local/kd-tree.hpp index 6b0852c..22108aa 100644 --- a/geom_matching/wasserstein/include/dnn/local/kd-tree.hpp +++ b/geom_matching/wasserstein/include/dnn/local/kd-tree.hpp @@ -164,11 +164,15 @@ search(PointHandle q, ResultsFunctor& rf) const template<class T> void dnn::KDTree<T>:: -increase_weight(PointHandle p, DistanceType w) +change_weight(PointHandle p, DistanceType w) { size_t idx = indices_[p]; - // weight should only increase - assert( weights_[idx] <= w ); + + if ( weights_[idx] == w ) { + return; + } + + bool weight_increases = ( weights_[idx] < w ); weights_[idx] = w; typedef std::tuple<HCIterator, HCIterator> KDTreeNode; @@ -223,10 +227,21 @@ increase_weight(PointHandle p, DistanceType w) min_w = weights_[im]; } - if (subtree_weights_[im] < min_w ) // increase weight - subtree_weights_[im] = min_w; - else - break; + if (weight_increases) { + + if (subtree_weights_[im] < min_w ) // increase weight + subtree_weights_[im] = min_w; + else + break; + + } else { + + if (subtree_weights_[im] > min_w ) // decrease weight + subtree_weights_[im] = min_w; + else + break; + + } } } |