Skip to content

Add a placement fitness report - #400

Merged
SammyOina merged 1 commit into
absmach:mainfrom
nyagamunene:experiment/place-metrics
Nov 2, 2026
Merged

SammyOina merged 1 commit into
absmach:mainfrom
nyagamunene:experiment/place-metrics

Conversation

@nyagamunene

Copy link
Copy Markdown
Contributor

What this changes

This PR adds an electrical placement report to the placement engine. It
does not move parts, change the placer, rank candidates, gate the export, or
touch routing. It makes placement quality measurable.

The report has four dimensions:

  • support distance — pad-to-pad distance from each bound decoupling, rail
    or load capacitor to the anchor pin that claimed it. Limits are 3 mm for
    decoupling and 5 mm for rail/load/orphan; a part's max_distance_mm
    overrides the default.
  • rail band — share of two-pin passives parked in the top connector lane,
    excluding passives within 2 mm of a connector.
  • mating inset — connector body to the edge it faces. The declared
    MatingFace rotates with the placement; an undeclared part uses the nearest
    edge; a body outside the outline reports a negative inset and fails.
  • area efficiency — placed courtyard envelope against the outline,
    saturating at 55 % occupancy and never gating.

Each metric is normalized to [0, 1]; the 0–100 composite is the equal-weight
mean over the metrics that could be measured. Missing metrics are renormalized
and named in assumptions. gate_failures is reported separately and is not
folded into the score.

The MCP synth_describe_placement response merges the report, so an agent
sees it. describe_placement itself and the placer's refine loop are
unchanged.

What this improves

The current placement review answers "does this board look structurally
believable?" and returns visual_score: 100, requires_revision: false on
boards that are electrically poorly placed. This PR replaces that blind spot
with a number and a breakdown.

Concretely, on upstream/main:

board visual review mean support rail worst mating gate failures
sensor_logger 100, no revision 16.94 mm 18 % 8.33 mm 10
env_logger 100, no revision 14.98 mm 0 % 5.23 mm 9
secure_tracker 100, no revision 8.71 mm 0 % 3.80 mm 4
feather_m4_express — 42.53 mm 0 % 5.14 mm 24

That changes what the system can do:

  • See which dimension is wrong and how badly, instead of a single green
    check.
  • Diagnose different boards differently: sensor_logger is support and
    mating; env_logger is mostly support; feather_m4_express is support by a
    wide margin.
  • Give an agent a signal: synth_describe_placement now carries the
    block, so an agent can make a targeted move and re-measure. Previously it
    had no electrical measurement at all.
  • Prioritise: the corpus shows the real work — 7 of 62 placeable designs
    carry almost all of the 77 gate failures (feather_m4_express 24,
    sensor_logger 10, env_logger 9, iot_sensor_board 8, the
    sensor_logger fixture 8, edge_jst_connectors 6, secure_tracker 4).
  • Detect regressions: a placement change that strands a capacitor can be
    measured against a fixed baseline instead of passing because the visual
    review is green.
  • Prove a fix: the separate repair experiment could only claim
    8 / 6 / 5 → 0 / 0 / 3 gate failures on the reference boards because this
    report existed. It could also see the trade-off: routing went 1 / 1 / 2 → 1 / 5 / 3, which is why that repair is not part of this PR.

What this does not improve

  • It does not move a part. The default boards are exactly as good or bad as
    before.
  • It does not make routing better.
  • It does not fix feather_m4_express, sensor_logger or env_logger.
  • It does not change the placer, candidate ranking, export gate or router.

This is a measurement PR. It makes the next placement PR provable rather than
a matter of opinion.

Qualification

  • cargo test -p synth-place — 114 tests pass.
  • cargo test -p synth-mcp --lib describe_placement — the MCP response
    carries the block.
  • Corpus report (cargo test -p synth-place --test fitness corpus_report -- --ignored --nocapture): 62 example/fixture designs placed, 0 placement
    failures, 47 with zero gate failures and 15 with at least one. Metric
    coverage is corpus-limited: 8 support, 8 mating, 15 rail, 29 area; most
    fixtures are parser or error cases.

Normal tests cover the report contract, deterministic JSON, support distance
changing when a capacitor is stranded, a body outside the outline failing
mating with a negative inset, the rail ratio rising when a passive enters the
top strip, missing metrics in assumptions, the MCP response, and an empty
board scoring zero.

Notes

  • Design note: docs/placement-fitness.md.
  • Provenance: independent implementation. The idea of a multi-metric
    placement report came from reviewing the Copperhead tool; no Copperhead
    source, identifier, comment or constant is reproduced.
  • No issue: this started as a local experiment. Happy to open one if the
    project requires it.

@nyagamunene nyagamunene mentioned this pull request Nov 1, 2026
@SammyOina
SammyOina merged commit c5dc0bc into absmach:main Nov 2, 2026
5 checks passed
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.

2 participants