summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnur Nigmetov <a.nigmetov@gmail.com>2018-05-31 23:42:22 +0200
committerArnur Nigmetov <a.nigmetov@gmail.com>2018-05-31 23:42:22 +0200
commitc563d463ffce73b070b35e62baf980d19d0bc4ac (patch)
tree94712f7d2b7f618166b3021dfa3b03930739c945
parent8ffc1482c88fd1c503524f6e328f69fe3fdede6c (diff)
2 bugs fixed in Jacobi for point cloud
-rw-r--r--geom_matching/wasserstein/example/wasserstein_dist_point_cloud.cpp2
-rw-r--r--geom_matching/wasserstein/include/auction_oracle_kdtree_restricted.hpp4
-rw-r--r--geom_matching/wasserstein/include/auction_runner_jac.hpp9
-rw-r--r--geom_matching/wasserstein/include/wasserstein_pure_geom.hpp1
4 files changed, 10 insertions, 6 deletions
diff --git a/geom_matching/wasserstein/example/wasserstein_dist_point_cloud.cpp b/geom_matching/wasserstein/example/wasserstein_dist_point_cloud.cpp
index 6f699a4..2f9718e 100644
--- a/geom_matching/wasserstein/example/wasserstein_dist_point_cloud.cpp
+++ b/geom_matching/wasserstein/example/wasserstein_dist_point_cloud.cpp
@@ -35,6 +35,7 @@ derivative works thereof, in binary and source code form.
int main(int argc, char* argv[])
{
+
//{
//int n_points = 3;
//int dim = 3;
@@ -106,7 +107,6 @@ int main(int argc, char* argv[])
params.dim = dimension_A;
-
params.wasserstein_power = (4 <= argc) ? atof(argv[3]) : 1.0;
if (params.wasserstein_power < 1.0) {
std::cerr << "The third argument (wasserstein_degree) was \"" << argv[3] << "\", must be a number >= 1.0. Cannot proceed. " << std::endl;
diff --git a/geom_matching/wasserstein/include/auction_oracle_kdtree_restricted.hpp b/geom_matching/wasserstein/include/auction_oracle_kdtree_restricted.hpp
index 7817bf3..3c3cba3 100644
--- a/geom_matching/wasserstein/include/auction_oracle_kdtree_restricted.hpp
+++ b/geom_matching/wasserstein/include/auction_oracle_kdtree_restricted.hpp
@@ -243,7 +243,7 @@ AuctionOracleKDTreeRestricted<Real_, PointContainer_>::get_optimal_bid_debug(Idx
Real best_item_value = std::numeric_limits<Real>::max();
Real second_best_item_value = std::numeric_limits<Real>::max();
- for(IdxType item_idx = 0; item_idx < this->items.size(); ++item_idx) {
+ for(IdxType item_idx = 0; item_idx < static_cast<IdxType>(this->items.size()); ++item_idx) {
auto item = this->items[item_idx];
if (item.type != bidder.type and item_idx != bidder_idx)
continue;
@@ -258,7 +258,7 @@ AuctionOracleKDTreeRestricted<Real_, PointContainer_>::get_optimal_bid_debug(Idx
for(size_t item_idx = 0; item_idx < this->items.size(); ++item_idx) {
auto item = this->items[item_idx];
- if (item.type != bidder.type and item_idx != bidder_idx)
+ if (item.type != bidder.type and static_cast<IdxType>(item_idx) != bidder_idx)
continue;
if (item_idx == best_item_idx)
continue;
diff --git a/geom_matching/wasserstein/include/auction_runner_jac.hpp b/geom_matching/wasserstein/include/auction_runner_jac.hpp
index 8663bae..c519de1 100644
--- a/geom_matching/wasserstein/include/auction_runner_jac.hpp
+++ b/geom_matching/wasserstein/include/auction_runner_jac.hpp
@@ -42,7 +42,6 @@ derivative works thereof, in binary and source code form.
#undef DEBUG_AUCTION
#endif
-
namespace hera {
namespace ws {
@@ -350,6 +349,8 @@ namespace ws {
typename AuctionRunnerJac<R, AO, PC>::Real
AuctionRunnerJac<R, AO, PC>::get_relative_error(const bool debug_output) const
{
+ if (partial_cost == 0.0 and unassigned_bidders.empty())
+ return 0.0;
Real result;
#ifndef WASSERSTEIN_PURE_GEOM
Real gamma = get_gamma();
@@ -560,7 +561,7 @@ namespace ws {
wasserstein_cost = get_item_bidder_cost(0,0);
return;
}
- double init_eps = (initial_epsilon > 0.0) ? initial_epsilon : oracle.max_val_ / 4.0;
+ R init_eps = (initial_epsilon > 0.0) ? initial_epsilon : oracle.max_val_ / 4.0;
run_auction_phases(max_num_phases, init_eps);
is_distance_computed = true;
wasserstein_cost = partial_cost;
@@ -703,7 +704,11 @@ namespace ws {
template<class R, class AO, class PC>
bool AuctionRunnerJac<R, AO, PC>::continue_auction_phase() const
{
+#ifdef WASSERSTEIN_PURE_GEOM
+ return not unassigned_bidders.empty();
+#else
return not unassigned_bidders.empty() and not is_done();
+#endif
}
template<class R, class AO, class PC>
diff --git a/geom_matching/wasserstein/include/wasserstein_pure_geom.hpp b/geom_matching/wasserstein/include/wasserstein_pure_geom.hpp
index 13a94d5..096d95d 100644
--- a/geom_matching/wasserstein/include/wasserstein_pure_geom.hpp
+++ b/geom_matching/wasserstein/include/wasserstein_pure_geom.hpp
@@ -72,7 +72,6 @@ inline double wasserstein_cost(const DynamicPointVector<double>& set_A, const Dy
auction.run_auction();
return auction.get_wasserstein_cost();
}
-
}
inline double wasserstein_dist(const DynamicPointVector<double>& set_A, const DynamicPointVector<double>& set_B, const AuctionParams<double>& params)