[Draft] Add three sli based metrics in test script#4
Open
fhenneke wants to merge 3 commits into
Open
Conversation
fhenneke
commented
Feb 24, 2026
Comment on lines
+58
to
+74
| def robust_surplus_metric(solutions, participation_rates): | ||
| robust_surplus = 0 | ||
| all_order_uids = {trade.id for solution in solutions for trade in solution.trades} | ||
| for order_uid in all_order_uids: | ||
| order_scores = [(solution.solver, trade.score) for solution in solutions for trade in solution.trades if trade.id == order_uid] | ||
| # sorting | ||
| order_scores = sorted(order_scores, key=lambda x: x[1], reverse=True) | ||
| # removing duplicates | ||
| solvers_seen = set() | ||
| order_scores = [x for x in order_scores if not (x[0] in solvers_seen or solvers_seen.add(x[0]))] | ||
| robust_surplus_order = 0.0 | ||
| remaining_probability = 1. | ||
| for solver, score in order_scores: | ||
| robust_surplus_order += remaining_probability * participation_rates[solver] * score / 1e18 | ||
| remaining_probability *= 1 - participation_rates[solver] | ||
| robust_surplus += robust_surplus_order | ||
| return robust_surplus |
Owner
Author
There was a problem hiding this comment.
Implementation of robust score.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Metrics checked:
These metrics are turned into a marginal and individual contribution.
Run
to generate a

chart.htmlfile with a figure of the form