diff options
Diffstat (limited to 'wasserstein/include/auction_oracle_kdtree_restricted.hpp')
-rw-r--r-- | wasserstein/include/auction_oracle_kdtree_restricted.hpp | 80 |
1 files changed, 10 insertions, 70 deletions
diff --git a/wasserstein/include/auction_oracle_kdtree_restricted.hpp b/wasserstein/include/auction_oracle_kdtree_restricted.hpp index 8613ee1..f0e7ac6 100644 --- a/wasserstein/include/auction_oracle_kdtree_restricted.hpp +++ b/wasserstein/include/auction_oracle_kdtree_restricted.hpp @@ -54,30 +54,16 @@ template <class Real_, class PointContainer_> std::ostream& operator<<(std::ostream& output, const AuctionOracleKDTreeRestricted<Real_, PointContainer_>& oracle) { output << "Oracle " << &oracle << std::endl; - output << fmt::format(" max_val_ = {0}, best_diagonal_items_computed_ = {1}, best_diagonal_item_value_ = {2}, second_best_diagonal_item_idx_ = {3}, second_best_diagonal_item_value_ = {4}\n", - oracle.max_val_, - oracle.best_diagonal_items_computed_, - oracle.best_diagonal_item_value_, - oracle.second_best_diagonal_item_idx_, - oracle.second_best_diagonal_item_value_); - - output << fmt::format(" prices = {0}\n", - format_container_to_log(oracle.prices)); - - output << fmt::format(" diag_items_heap_ = {0}\n", - losses_heap_to_string(oracle.diag_items_heap_)); - - - output << fmt::format(" top_diag_indices_ = {0}\n", - format_container_to_log(oracle.top_diag_indices_)); - - output << fmt::format(" top_diag_counter_ = {0}\n", - oracle.top_diag_counter_); - - output << fmt::format(" top_diag_lookup_ = {0}\n", - format_container_to_log(oracle.top_diag_lookup_)); - - + output << "max_val_ = " << oracle.max_val_ << ", "; + output << "best_diagonal_items_computed_ = " << oracle.best_diagonal_items_computed_ << ", "; + output << "best_diagonal_item_value_ = " << oracle.best_diagonal_item_value_ << ", "; + output << "second_best_diagonal_item_idx_ = " << oracle.second_best_diagonal_item_idx_ << ", "; + output << "second_best_diagonal_item_value_ = " << oracle.second_best_diagonal_item_value_ << ", "; + output << "prices = " << format_container_to_log(oracle.prices) << "\n"; + output << "diag_items_heap_ = " << losses_heap_to_string(oracle.diag_items_heap_) << "\n"; + output << "top_diag_indices_ = " << format_container_to_log(oracle.top_diag_indices_) << "\n"; + output << "top_diag_counter_ = " << oracle.top_diag_counter_ << "\n"; + output << "top_diag_lookup_ = " << format_container_to_log(oracle.top_diag_lookup_) << "\n"; output << "end of oracle " << &oracle << std::endl; return output; } @@ -129,13 +115,6 @@ AuctionOracleKDTreeRestricted<Real_, PointContainer_>::AuctionOracleKDTreeRestri max_val_ = 3*getFurthestDistance3Approx<>(_bidders, _items, params.internal_p); max_val_ = std::pow(max_val_, params.wasserstein_power); weight_adj_const_ = max_val_; - - console_logger = spdlog::get("console"); - if (not console_logger) { - console_logger = spdlog::stdout_logger_st("console"); - } - console_logger->set_pattern("[%H:%M:%S.%e] %v"); - console_logger->debug("KDTree Restricted oracle ctor done"); } @@ -201,7 +180,6 @@ void AuctionOracleKDTreeRestricted<Real_, PointContainer_>::reset_top_diag_count template<class Real_, class PointContainer_> void AuctionOracleKDTreeRestricted<Real_, PointContainer_>::recompute_top_diag_items(bool hard) { - console_logger->debug("Enter recompute_top_diag_items, hard = {0}", hard); assert(hard or top_diag_indices_.empty()); if (hard) { @@ -229,7 +207,6 @@ void AuctionOracleKDTreeRestricted<Real_, PointContainer_>::recompute_top_diag_i best_diagonal_items_computed_ = true; reset_top_diag_counter(); - console_logger->debug("Exit recompute_top_diag_items, hard = {0}", hard); } template<class Real_, class PointContainer_> @@ -371,14 +348,6 @@ IdxValPair<Real_> AuctionOracleKDTreeRestricted<Real_, PointContainer_>::get_opt #ifdef DEBUG_KDTREE_RESTR_ORACLE auto db = get_optimal_bid_debug(bidder_idx); assert(fabs(db.best_item_value - best_item_value) < 0.000001); - if (fabs(db.second_best_item_value - second_best_item_value) >= 0.000001) { - console_logger->debug("Bidder_idx = {0}, best_item_idx = {1}, true_best_item_idx = {2}", bidder_idx, best_item_idx, db.best_item_idx); - console_logger->debug("second_best_item_idx = {0}, true second_best_item_idx = {1}", second_best_item_idx, db.second_best_item_idx); - console_logger->debug("second_best_value = {0}, true second_best_item_value = {1}", second_best_item_value, db.second_best_item_value); - console_logger->debug("prices = {0}", format_container_to_log(this->prices)); - console_logger->debug("top_diag_indices_ = {0}", format_container_to_log(top_diag_indices_)); - console_logger->debug("second_best_diagonal_item_value_ = {0}", second_best_diagonal_item_value_); - } assert(fabs(db.second_best_item_value - second_best_item_value) < 0.000001); //std::cout << "bid OK" << std::endl; #endif @@ -392,9 +361,6 @@ value_{ij} = a_{ij} + price_j template<class Real_, class PointContainer_> void AuctionOracleKDTreeRestricted<Real_, PointContainer_>::recompute_second_best_diag() { - - console_logger->debug("Enter recompute_second_best_diag"); - if (top_diag_indices_.size() > 1) { second_best_diagonal_item_value_ = best_diagonal_item_value_; second_best_diagonal_item_idx_ = top_diag_indices_[0]; @@ -409,8 +375,6 @@ void AuctionOracleKDTreeRestricted<Real_, PointContainer_>::recompute_second_bes second_best_diagonal_item_idx_ = diag_iter->first; } } - - console_logger->debug("Exit recompute_second_best_diag, second_best_diagonal_item_value_ = {0}, second_best_diagonal_item_idx_ = {1}", second_best_diagonal_item_value_, second_best_diagonal_item_idx_); } @@ -419,9 +383,6 @@ void AuctionOracleKDTreeRestricted<Real_, PointContainer_>::set_price(IdxType it Real new_price, const bool update_diag) { - - console_logger->debug("Enter set_price, item_idx = {0}, new_price = {1}, old price = {2}, update_diag = {3}", item_idx, new_price, this->prices[item_idx], update_diag); - assert(this->prices.size() == this->items.size()); assert( 0 < diag_heap_handles_.size() and diag_heap_handles_.size() <= this->items.size()); // adjust_prices decreases prices, @@ -454,17 +415,12 @@ void AuctionOracleKDTreeRestricted<Real_, PointContainer_>::set_price(IdxType it } } } - - console_logger->debug("Exit set_price, item_idx = {0}, new_price = {1}", item_idx, new_price); } template<class Real_, class PointContainer_> void AuctionOracleKDTreeRestricted<Real_, PointContainer_>::adjust_prices(Real delta) { - //console_logger->debug("Enter adjust_prices, delta = {0}", delta); - //std::cerr << *this << std::endl; - if (delta == 0.0) return; @@ -488,9 +444,6 @@ void AuctionOracleKDTreeRestricted<Real_, PointContainer_>::adjust_prices(Real d } best_diagonal_item_value_ -= delta; second_best_diagonal_item_value_ -= delta; - - //std::cerr << *this << std::endl; - //console_logger->debug("Exit adjust_prices, delta = {0}", delta); } template<class Real_, class PointContainer_> @@ -571,21 +524,8 @@ void AuctionOracleKDTreeRestricted<Real_, PointContainer_>::sanity_check() } } - if (true_best_diag_value != best_diagonal_item_value_) { - console_logger->debug("best_diagonal_item_value_ = {0}, true value = {1}", best_diagonal_item_value_, true_best_diag_value); - std::cerr << *this; - //console_logger->debug("{0}", *this); - } - assert(true_best_diag_value == best_diagonal_item_value_); - assert(true_second_best_diag_idx != k_invalid_index); - - if (true_second_best_diag_value != second_best_diagonal_item_value_) { - console_logger->debug("second_best_diagonal_item_value_ = {0}, true value = {1}", second_best_diagonal_item_value_, true_second_best_diag_value); - //console_logger->debug("{0}", *this); - } - assert(true_second_best_diag_value == second_best_diagonal_item_value_); } #endif |