Skip to content

Preserve hard constraints in greedy final routing - #140

Draft
ShiboSoftwareDev wants to merge 4 commits into
agent/repro-greedy-final-route-hard-constraintsfrom
agent/fix-greedy-final-route-hard-constraints
Draft

Preserve hard constraints in greedy final routing#140
ShiboSoftwareDev wants to merge 4 commits into
agent/repro-greedy-final-route-hard-constraintsfrom
agent/fix-greedy-final-route-hard-constraints

Conversation

@ShiboSoftwareDev

@ShiboSoftwareDev ShiboSoftwareDev commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Stack

Stacked on reproduction PR #139.

Problem

Normal path search uses Infinity to reject hard-invalid moves such as crossing another net in a single-layer region.

Two shortcuts combined:

  1. the timeout-only greedy solver returned the current path cost directly, which removed both soft costs and hard rejections;
  2. the base path loop accepted the final hop into an endpoint before calling the cost/legality calculation.

Fix

The fix has two matching steps:

  1. every final hop now uses the same legality calculation as every intermediate hop;
  2. greedy routing keeps a non-finite hard rejection, but still discards finite soft costs.

The shared final-hop check also replaces the duplicate implementation that previously existed only in the distance-aware subclass. This does not add a new stage, topology type, or downstream geometry patch.

Reproduction and visualization

The unchanged #139 fixture has a vertical net already routed through one single-layer region. Greedy completion tries to add a horizontal net whose only path crosses it.

Before: reproduction PR #139 After: this fix
Before: both crossing routes were committed After: the illegal route remains unrouted

The SVG is tiny-hypergraph’s native solver visualization:

  • a solid line is a route accepted into solver state;
  • a dashed line is an uncommitted route request.

Before the fix, both crossing lines are solid and the center region reports one same-layer crossing. After the fix, only the legal vertical route is solid; the horizontal request stays dashed and the center reports zero crossings.

Validation

@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tiny-hypergraph Ready Ready Preview Aug 2, 2026 10:51am

Request Review

@tscircuitbot

Copy link
Copy Markdown

Benchmark This PR

Run benchmarks by commenting on this PR:

/benchmark [benchmark.sh args...]
/benchmark --dataset <hg07|srj18> --limit <n> --solver <core|poly> --families <default|default+deep|all> --concurrency <n|auto>

Everything after /benchmark is forwarded directly to ./benchmark.sh.
The result comment shows the matching dataset from the latest stored main-branch benchmark artifact beside the PR run; main is not rerun for each PR benchmark request.

Examples:

  • /benchmark -> hg07, all samples, core solver
  • /benchmark --dataset srj18 --limit 20 -> first 20 srj18 samples
  • /benchmark --dataset srj18 --concurrency auto -> srj18 samples with runner CPU-count concurrency
  • /benchmark --sample sample002 -> one hg07 sample
  • /benchmark --limit 20 --solver poly -> first 20 hg07 samples with the poly solver
  • /benchmark --limit 40 --families default+deep -> first 40 hg07 samples with deeper candidate families

Any PR whose title contains [BENCHMARK TEST] will automatically run the benchmark workflow on PR updates.

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