Milestone 4 of 8
Evaluate the complete candidate grid
Evaluate every ordered slope and intercept pair exactly once and store each score at its documented grid position.
The grid is the investigation. Evaluate every candidate once and keep its position visible so the selected result can be reconstructed later.
Goal
Evaluate every Cartesian pair of supplied slopes and intercepts, store one score at the documented grid position, preserve candidate order, and prove the evaluation is complete.
Inputs
Use the validated candidate arrays, the generated input and observed arrays,
and the independent functions from src/line.py. If there are S slopes and
I intercepts, the score grid has shape (S, I) and contains exactly S * I
scores.
Use row-major order: the slope index is the first grid position and the intercept index is the second. Do not use random search, gradients, a fitting library, or an early stopping rule.
Deliverables
Implement the exhaustive search in src/search.py. Return the ordered
candidate arrays, the full two-dimensional score grid, and enough identity to
map each score back to one slope and intercept.
Save output/search_scores.csv or an equally explicit representation with one
row per candidate pair, including slope index, intercept index, slope,
intercept, and score. Preserve the candidate-grid shape and order in the
result record.
Checks
Check the grid shape, candidate order, finite score values, and exact evaluation count. For a small public fixture, compare every stored score with a direct call to the line and score functions. Confirm that each pair occurs once and that the input and candidate arrays are unchanged.
Use a fixture with at least one exact tie and verify that the grid stores both scores rather than collapsing them. Do not select the winner here; selection and tie handling belong to the next milestone.
Workspace
Keep exhaustive evaluation in src/search.py and use the generated data from
src/data.py. Write the full score evidence under output/; keep search
results separate from the later selected-result record.
Hints
HintCount the pairs before looping
HintStore indexes with values
Review
Read one row of search_scores.csv back into its grid position and recompute
the score. Explain why a complete grid is stronger evidence than only saving
the selected pair.
How to check your work
Checks compare the grid shape, order, and evaluation count with the supplied fixture. The supplied fixture uses the supplied exhaustive boundary; it does not choose a different search strategy.