Skip to content

refactor(search): split the payoff arithmetic into shared modules - #72

Merged
nichinichisou0609 merged 6 commits into
mainfrom
refactor/payoff-modules
Oct 19, 2026
Merged

nichinichisou0609 merged 6 commits into
mainfrom
refactor/payoff-modules

Conversation

@nichinichisou0609

Copy link
Copy Markdown
Contributor

Summary

The payoff bounds and the terminal payoff now share small leaf modules, so deck_payoff, team_power and the joint point bound depend on common building blocks instead of on each other:

  • search::bonus: event-bonus table arithmetic (point_product, challenge_product, card_bonus, largest_team_bonus, sum_rows).
  • search::slots: the physical slot order.
  • search::caps: the largest payoff each term of a metric can pay.
  • search::curve: how an order's payoff steps with its score (Step, ScoreSteps, TermSteps).
  • search::reward: the payoff of one terminal outcome (payoff_of), plus score_payoff and points_payoff, which the payoff bounds use for the same integer forms.

Each commit moves code without changing its arithmetic; tests move with the functions they cover. Results, proofs and node counts are unchanged.

Tests

  • Every commit builds on its own (cargo check -p ournotes-search --all-targets).
  • cargo clippy --workspace --all-targets -- -D warnings and cargo test -p ournotes-search pass on the final commit.

🤖 Generated with Claude Code

nichinichisou0609 and others added 6 commits October 19, 2026 11:56
Move the audited native products (point_product, challenge_product), the card-bonus sum (card_bonus) and the two team-bonus maxima (largest_team_bonus, sum_rows) into search::bonus, together with their unit tests. The payoff bounds of the joint traversal and of the deck payoff now read the same functions instead of one reaching into the other. Each function keeps its body, error messages and visibility.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The joint traversal and the power bound each declared their own SLOTS table. Keep one constant in search::slots and re-export it from both modules, so every path that names SLOTS keeps working and the slot order has a single source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the largest term payoff of a metric (term_cap), the largest reward row of an event table and the negative-score check into search::caps. The combined-level folding, the deck payoff and the joint compilation read them without depending on the point bound, which keeps only the per-order bound it computes. Values, error text and visibility are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Step, ScoreSteps and the TermSteps alias describe how an order's payoff steps with its score, which the joint traversal and the deck payoff both consume. They move to search::curve unchanged, apart from a largest_step accessor that replaces the deck payoff's direct read of the private step list. The payoff arithmetic of each step is the same text as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
payoff_of and the arithmetic error it reports describe one terminal outcome, not the evaluation driver. Move them to search::reward, keep the re-export from the physical module so every caller resolves as before, and add narrow score and points entry points for the payoff bounds that read those forms without a deck.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The score-step bound, the point bound and the certified native steps each re-derived the payoff of one order. They now call search::reward: the step's Points value and the point bound's products go through points_payoff, and the certified steps read payoff_of at each cut instead of reproducing the event preview. The ordering weight of a certified rank stays in the certified search, which is a ranking lattice rather than a payoff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nichinichisou0609
nichinichisou0609 merged commit 86e81be into main Oct 19, 2026
6 checks passed
@nichinichisou0609
nichinichisou0609 deleted the refactor/payoff-modules branch October 19, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant