Skip to content

feat(moves): multi-objective enumeration ranking (Track E commit 5/8)#174

Open
avrabe wants to merge 1 commit intomainfrom
feat/v0.8.0-track-e-commit5-objectives
Open

feat(moves): multi-objective enumeration ranking (Track E commit 5/8)#174
avrabe wants to merge 1 commit intomainfrom
feat/v0.8.0-track-e-commit5-objectives

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 27, 2026

Summary

  • Adds spar-solver::enumerate::rank_candidate — overlay-aware multi-objective ranker that consumes the same RTA + property-accessor machinery the verify-pipeline already uses, so verify/enumerate outputs stay in lock-step.
  • Wires the new ranker into spar moves enumerate: the commit-4 slack_ns field is replaced by a richer rank: CandidateRank carrying max-response, total-load, total-power, total-weight, and an aggregate score (lower = better).
  • Adds the Spar_Power::Power_Budget standard property (numeric milliwatts) so models without SEI / Physical_Properties in scope can still annotate per-component power for ranking.
  • Adds CLI option --objective {max-response | total-load | total-power | total-weight | balanced}. Default is max-response, which preserves commit-4 slack semantics on single-CPU models. balanced weights all four axes equally (each at 1/4).
  • New requirement: REQ-MIGRATION-007. New verification entry: TEST-MOVES-ENUMERATE-OBJECTIVES linked to REQ-MIGRATION-{004,005,006,007}.

What stayed the same

  • The set of admissible (ok=true) candidates is unchanged across all five objective modes — only ordering changes.
  • spar moves enumerate still does not mutate the underlying model; the existing non-mutation regression test stays green.
  • Exit codes, JSON top-level shape (component / total / valid / candidates), and CLI plumbing for --root / --component / --target-filter / --format are unchanged.

What changed in JSON shape

  • Per-candidate slack_ns is removed; replaced by a rank object with five keys:
    max_response_ns (i64 or null), total_load (f64), total_power_mw (u64 or null), total_weight_g (u64 or null), score (f64).
  • The text-format header column slack is replaced by score. Deadline-miss candidates render as <missed> (matching the commit-4 idiom).

Test plan

  • cargo test --workspace — 0 failures (10 new integration tests in moves_enumerate_objectives.rs, 11 unit tests in spar-solver::enumerate, 2 unit tests in spar-cli::moves::enumerate_tests; all 10 commit-4 enumerate tests still pass).
  • cargo clippy --workspace --all-targets -- -D warnings — clean.
  • cargo fmt --all -- --check — clean.
  • rivet validate — PASS.

Files changed

  • artifacts/requirements.yaml — append REQ-MIGRATION-007.
  • artifacts/verification.yaml — append TEST-MOVES-ENUMERATE-OBJECTIVES.
  • crates/spar-cli/src/moves.rs — replace slack with rank; add --objective parser; new MovesError::UnknownObjective; updated text/JSON renderers.
  • crates/spar-cli/tests/moves_enumerate_objectives.rs — new (10 integration tests).
  • crates/spar-hir-def/src/standard_properties.rs — register Spar_Power::Power_Budget; bump set count.
  • crates/spar-solver/src/enumerate.rs — new (rank_candidate, EnumerationObjective, CandidateRank, power/weight readers, RTA-message parsers, 11 unit tests).
  • crates/spar-solver/src/lib.rs — export the new module.

🤖 Generated with Claude Code

Replaces the slack-only ranking from commit 4 with a configurable
multi-objective score. Five modes: max-response (default), total-load,
total-power, total-weight, balanced. The score uses the same RTA +
property-accessor machinery the verify-pipeline uses, so verify/enumerate
output stays consistent.

Adds Spar_Power::Power_Budget property (numeric milliwatts).

CLI: spar moves enumerate --objective {max-response | total-load |
     total-power | total-weight | balanced}

Default objective: max-response (matches commit-4 slack semantics in
single-CPU cases).

New requirement: REQ-MIGRATION-007.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 95.63700% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-solver/src/enumerate.rs 96.60% 17 Missing ⚠️
crates/spar-cli/src/moves.rs 88.23% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

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