Skip to content

Commit

Permalink
reshuffle code, add more test hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
fhenneke committed Nov 2, 2023
1 parent 34625d6 commit b10c702
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/monitoring_tests/combinatorial_auction_surplus_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def get_token_pairs_surplus(
large costs.
"""
trades_dict = self.get_uid_trades(solution)
objective = solution["objective"]["total"]
surplus_dict: dict[tuple[str, str], Fraction] = {}
for uid in trades_dict:
trade = trades_dict[uid]
Expand All @@ -161,7 +160,10 @@ def get_token_pairs_surplus(
# use the minimum of surplus and objective in case there is only one token pair
if len(surplus_dict) == 1:
for token_pair in surplus_dict:
surplus_dict[token_pair] = min(surplus_dict[token_pair], objective)
surplus_dict[token_pair] = min(
surplus_dict[token_pair], solution["objective"]["total"]
)
# surplus_dict[token_pair] = solution["objective"]["total"]

return surplus_dict

Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/combinatorial_auction_surplus_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def test_surplus(self) -> None:
# # combinatorial auction better than current auction
# tx_hash = "0x46639ae0e516bcad7b052fb6bfb6227d0aa2707e9882dd8d86bab2ab6aeee155"
# tx_hash = "0xe28b92ba73632d6b167fdb9bbfec10744ce208536901dd43379a6778c4408536"
tx_hash = "0xad0ede9fd68481b8ef4722d069598898e01d61427ccb378ca4c82c772c6644e0"
# tx_hash = "0xad0ede9fd68481b8ef4722d069598898e01d61427ccb378ca4c82c772c6644e0"
# tx_hash = "0xead8f01e8e24fdc306fca8fcac5146edc22c27e49a7aad6134adc2ad50ba8581"
tx_hash = "0x6200e744e5d6f9990271be53840c01044cc19f3a8526190e1eaac0bc5fefed85"
self.assertTrue(surplus_test.run(tx_hash))


Expand Down

0 comments on commit b10c702

Please sign in to comment.