Skip to main content

Module graft

Module graft 

Source
Expand description

The graft phase’s decisions: whether it runs, what it is told, and whether its result is small enough to keep.

Between the tally and the review loop a fixer round ports the strengths the judges attributed to the losing candidates onto the winner (graph::Runner::graft). Everything that can be decided without I/O lives here so the skip conditions and the size valve are unit-tested directly.

Structs§

Plan
What a graft round is asked to port, by label only.

Enums§

Skip
Why the graft phase did nothing. The wording is the run event.

Constants§

INTERRUPTED
The reason a record in a non-final state is rolled back on resume.
MAX_LIMIT
Largest line budget a graft gets, however large the winner is.
MIN_LIMIT
Smallest line budget a graft gets, however small the winner is.
RATIO
The graft may change at most one RATIOth of the winner’s own diff.

Functions§

limit
The most changed lines a graft may add to a winner whose own diff against the base is winner_lines: a quarter of it, never under MIN_LIMIT and never over MAX_LIMIT. A quarter keeps the graft a supplement; half would let it turn the winner into something else.
plan
Decide whether the graft runs and with what input. Pure.
requested
The strengths of a plan with the ids the prompt shows (A1, A2, …).
within_budget
Is a graft that changed lines (None: not measurable, or binary) within limit? An unmeasurable change is rejected.