diff options
Diffstat (limited to 'wasserstein/example')
-rw-r--r-- | wasserstein/example/CMakeLists.txt | 21 | ||||
-rw-r--r-- | wasserstein/example/wasserstein_dist.cpp | 11 | ||||
-rw-r--r-- | wasserstein/example/wasserstein_dist_dipha.cpp | 12 | ||||
-rw-r--r-- | wasserstein/example/wasserstein_dist_point_cloud.cpp | 8 |
4 files changed, 25 insertions, 27 deletions
diff --git a/wasserstein/example/CMakeLists.txt b/wasserstein/example/CMakeLists.txt new file mode 100644 index 0000000..2e2f1f2 --- /dev/null +++ b/wasserstein/example/CMakeLists.txt @@ -0,0 +1,21 @@ +add_executable(wasserstein_dist wasserstein_dist.cpp) +target_link_libraries(wasserstein_dist PUBLIC ${libraries}) + +add_executable(wasserstein_dist_dipha wasserstein_dist_dipha.cpp) +target_link_libraries(wasserstein_dist_dipha PUBLIC ${libraries}) + +# pure geometric version, arbitrary dimension +add_executable(wasserstein_dist_point_cloud wasserstein_dist_point_cloud.cpp) +target_link_libraries(wasserstein_dist_point_cloud PUBLIC ${libraries}) + +if(MSVC) + target_compile_options(wasserstein_dist PRIVATE /W4 /WX) + target_compile_options(wasserstein_dist_dipha PRIVATE /W4 /WX) + target_compile_options(wasserstein_dist_point_cloud PRIVATE /W4 /WX) +else() + target_compile_options(wasserstein_dist PRIVATE -Wall -Wextra -Wpedantic) + target_compile_options(wasserstein_dist_dipha PRIVATE -Wall -Wextra -Wpedantic) + target_compile_options(wasserstein_dist_point_cloud PRIVATE -Wall -Wextra -Wpedantic) +endif() + + diff --git a/wasserstein/example/wasserstein_dist.cpp b/wasserstein/example/wasserstein_dist.cpp index cbe83e2..46f06fc 100644 --- a/wasserstein/example/wasserstein_dist.cpp +++ b/wasserstein/example/wasserstein_dist.cpp @@ -33,8 +33,6 @@ derivative works thereof, in binary and source code form. #include "opts/opts.h" -//#define LOG_AUCTION - //#include "auction_runner_fr.h" //#include "auction_runner_fr.hpp" @@ -138,14 +136,7 @@ int main(int argc, char* argv[]) params.max_bids_per_round = std::numeric_limits<decltype(params.max_bids_per_round)>::max(); - std::string log_filename_prefix = ( 11 <= argc ) ? argv[10] : ""; - - -#ifdef LOG_AUCTION - spdlog::set_level(spdlog::level::info); -#endif - - Real res = hera::wasserstein_dist(diagramA, diagramB, params, log_filename_prefix); + Real res = hera::wasserstein_dist(diagramA, diagramB, params); std::cout << std::setprecision(15) << res << std::endl; if (print_relative_error) diff --git a/wasserstein/example/wasserstein_dist_dipha.cpp b/wasserstein/example/wasserstein_dist_dipha.cpp index 2ed9c2c..1bfc41b 100644 --- a/wasserstein/example/wasserstein_dist_dipha.cpp +++ b/wasserstein/example/wasserstein_dist_dipha.cpp @@ -32,8 +32,6 @@ derivative works thereof, in binary and source code form. #include <iomanip> #include <vector> -//#define LOG_AUCTION - //#include "auction_runner_fr.h" //#include "auction_runner_fr.hpp" @@ -50,7 +48,7 @@ int main(int argc, char* argv[]) hera::AuctionParams<double> params; if (argc < 4 ) { - std::cerr << "Usage: " << argv[0] << " file1 file2 ph_dim [wasserstein_degree] [relative_error] [internal norm] [initial epsilon] [epsilon_factor] [max_bids_per_round] [gamma_threshold][log_filename_prefix]. By default power is 1.0, relative error is 0.01, internal norm is l_infinity, initall epsilon is chosen automatically, epsilon factor is 5.0, Jacobi variant is used (max bids per round is maximal), gamma_threshold = 0.0." << std::endl; + std::cerr << "Usage: " << argv[0] << " file1 file2 ph_dim [wasserstein_degree] [relative_error] [internal norm] [initial epsilon] [epsilon_factor] [max_bids_per_round] [gamma_threshold]. By default power is 1.0, relative error is 0.01, internal norm is l_infinity, initall epsilon is chosen automatically, epsilon factor is 5.0, Jacobi variant is used (max bids per round is maximal), gamma_threshold = 0.0." << std::endl; return 1; } @@ -116,15 +114,9 @@ int main(int argc, char* argv[]) params.gamma_threshold = (11 <= argc) ? atof(argv[10]) : 0.0; - std::string log_filename_prefix = ( 12 <= argc ) ? argv[11] : ""; - params.max_num_phases = 800; -#ifdef LOG_AUCTION - spdlog::set_level(spdlog::level::info); -#endif - - double res = hera::wasserstein_dist(diagramA, diagramB, params, log_filename_prefix); + double res = hera::wasserstein_dist(diagramA, diagramB, params); std::cout << std::setprecision(15) << res << std::endl; diff --git a/wasserstein/example/wasserstein_dist_point_cloud.cpp b/wasserstein/example/wasserstein_dist_point_cloud.cpp index ab7ff4f..754d0e3 100644 --- a/wasserstein/example/wasserstein_dist_point_cloud.cpp +++ b/wasserstein/example/wasserstein_dist_point_cloud.cpp @@ -86,7 +86,7 @@ int main(int argc, char* argv[]) hera::AuctionParams<Real> params; if (argc < 3 ) { - std::cerr << "Usage: " << argv[0] << " file1 file2 [wasserstein_degree] [relative_error] [internal norm] [initial epsilon] [epsilon_factor] [max_bids_per_round] [gamma_threshold][log_filename_prefix]. By default power is 1.0, relative error is 0.01, internal norm is l_infinity, initall epsilon is chosen automatically, epsilon factor is 5.0, Jacobi variant is used (max bids per round is maximal), gamma_threshold = 0.0." << std::endl; + std::cerr << "Usage: " << argv[0] << " file1 file2 [wasserstein_degree] [relative_error] [internal norm] [initial epsilon] [epsilon_factor] [max_bids_per_round] [gamma_threshold]. By default power is 1.0, relative error is 0.01, internal norm is l_infinity, initall epsilon is chosen automatically, epsilon factor is 5.0, Jacobi variant is used (max bids per round is maximal), gamma_threshold = 0.0." << std::endl; return 1; } @@ -159,14 +159,8 @@ int main(int argc, char* argv[]) params.gamma_threshold = (10 <= argc) ? atof(argv[9]) : 0.0; - std::string log_filename_prefix = ( 11 <= argc ) ? argv[10] : ""; - params.max_num_phases = 800; -#ifdef LOG_AUCTION - spdlog::set_level(spdlog::level::critical); -#endif - Real res = hera::ws::wasserstein_dist(set_A, set_B, params); std::cout << std::setprecision(15) << res << std::endl; |