Enable constrained Delaunay triangulation for convex via regions#78
Enable constrained Delaunay triangulation for convex via regions#78zalo wants to merge 2 commits intotscircuit:mainfrom
Conversation
|
@zalo is attempting to deploy a commit to the tscircuit Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR improves A* route search performance by adding a weighted Euclidean edge-length component to the g-cost, and auto-disabling it for through-jumper topologies where it can cause rip cascades.
Changes:
- Add
distanceCostWeight, auto-detection (computeDistanceCostWeight()), and edge-length cost (computeDistanceCost()) toHyperGraphSolverand integrate intocomputeG(). - Initialize
distanceCostWeightinViaGraphSolverandJumperGraphSolverconstructors; minor cleanup in BFS hop-distance maps. - Add a benchmark-style test and update SVG snapshots to reflect the new scoring/ordering; remove an unused skipped-test snapshot.
Reviewed changes
Copilot reviewed 4 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
lib/HyperGraphSolver.ts |
Adds Euclidean distance g-cost and auto-detected weight selection. |
lib/ViaGraphSolver/ViaGraphSolver.ts |
Computes distance-cost weight during solver construction; minor cleanup. |
lib/JumperGraphSolver/JumperGraphSolver.ts |
Computes distance-cost weight during solver construction; removes unused import; minor cleanup. |
tests/benchmark-heuristic.test.ts |
Adds benchmark assertion comparing iterations with/without distance g-cost. |
tests/via-graph-solver/__snapshots__/via-graph-solver01.snap.svg |
Snapshot updated for new candidate ordering/scoring. |
tests/via-graph-solver/__snapshots__/via-graph-solver02.snap.svg |
Snapshot updated for new candidate ordering/scoring. |
tests/via-graph-solver/__snapshots__/via-graph-solver03.snap.svg |
Snapshot updated for new candidate ordering/scoring. |
tests/via-graph-solver/__snapshots__/via-graph-solver04.snap.svg |
Snapshot updated for new candidate ordering/scoring. |
tests/jumper-graph-solver/__snapshots__/jumper-graph-solver07.snap.svg |
Snapshot removed (associated test is skipped). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
seveibar
left a comment
There was a problem hiding this comment.
there's a couple changes bundled into this PR (constrained delauney + a change to distance cost), and a proper benchmark script result isn't run afaik (there are full benchmark suites that can be used, looking at individual tests isn't a good idea since there's a dataset of 1000 samples)
I could be wrong, but we should never modify the distance cost because it is the "grounded value", you can change scale other parameters but never distance, otherwise all other units lose their semantic meaning (i.e. a hyperparameter that specifies a penalty is 0.75 no longer means 0.75mm, it now refers to a "arbitrary cost", keeping one grounded value is desirable)
|
/benchmark |
Benchmark FailedBenchmark run failed. View workflow run |
|
yea so i guess the benchmark will fail until main is merged into this branch 🤷 it also takes a while to run which is not great (i think it takes an hour or two) |
Bump @tscircuit/find-convex-regions to 0.0.9 and enable useConstrainedDelaunay in generateConvexViaTopologyRegions. CDT produces better triangulations that improve solve rate on the 1000-sample convex via benchmark (48% -> 49%). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c9d6ed3 to
88cb9a9
Compare
# Conflicts: # package.json
|
From just the fuller via test, the benefit from ambiguous to bad... |
|
/benchmark |
Benchmark ResultsPR resultsMain branch results (baseline) |
|
Duplicate of #91 it seems 😅 The polyanya graph merging should help a lot with speed coming down the pipeline... Though, I think I might have to make its usage of cdtjs handle self-intersecting obstacles better. |
Summary
Bump
@tscircuit/find-convex-regionsto 0.0.9 and enableuseConstrainedDelaunay: trueingenerateConvexViaTopologyRegions. CDT produces better triangulations that improve solve rate on the 1000-sample convex via benchmark (48% -> 49%).Changes
package.json@tscircuit/find-convex-regions^0.0.7 -> ^0.0.9generateConvexViaTopologyRegions.tsuseConstrainedDelaunay: trueto ConvexRegionsSolver inputBenchmark (100-sample subset)
Test plan
bun test— 48 pass, 2 skip (pre-existing), 0 failvia-graph-convex-dataset02snapshot changes (expected — different triangulation)🤖 Generated with Claude Code