Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion lib/compat/loadSerializedHyperGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,49 @@ const isFullObstacleRegion = (
return netId === undefined || netId === -1
}

const getParentObstacleIds = (
region: SerializedHyperGraph["regions"][number],
): string[] => {
const parentObstacleIds = region.d?._parentObstacleIds
if (Array.isArray(parentObstacleIds)) {
return parentObstacleIds.filter(
(parentObstacleId): parentObstacleId is string =>
typeof parentObstacleId === "string" && parentObstacleId.length > 0,
)
}

const parentObstacleId = region.d?.parentObstacleId
if (typeof parentObstacleId === "string" && parentObstacleId.length > 0) {
return [parentObstacleId]
}

return []
}

const filterObstacleRegions = (serializedHyperGraph: SerializedHyperGraph) => {
const connectedRegionIds = new Set<string>()
for (const connection of serializedHyperGraph.connections ?? []) {
connectedRegionIds.add(connection.startRegionId)
connectedRegionIds.add(connection.endRegionId)
}

const preservedParentObstacleIds = new Set<string>()
for (const region of serializedHyperGraph.regions) {
if (!connectedRegionIds.has(region.regionId)) continue
for (const parentObstacleId of getParentObstacleIds(region)) {
preservedParentObstacleIds.add(parentObstacleId)
}
}

const removedRegionIds = new Set(
serializedHyperGraph.regions
.filter(
(region) =>
isFullObstacleRegion(region) &&
!connectedRegionIds.has(region.regionId),
!connectedRegionIds.has(region.regionId) &&
!getParentObstacleIds(region).some((parentObstacleId) =>
preservedParentObstacleIds.has(parentObstacleId),
),
)
.map((region) => region.regionId),
)
Expand Down
25 changes: 25 additions & 0 deletions results/run001/sample014/logs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
sample=sample014
circuitId=018
status=failed
duration=0.001s

error=
Error: Connection "source_trace_69" could not be mapped to route endpoints
at <anonymous> (/home/ohmx/Documents/tiny-hypergraph/lib/compat/loadSerializedHyperGraph.ts:454:17)
at forEach (native:1:11)
at loadSerializedHyperGraph (/home/ohmx/Documents/tiny-hypergraph/lib/compat/loadSerializedHyperGraph.ts:429:23)
at getConstructorParams (/home/ohmx/Documents/tiny-hypergraph/lib/section-solver/TinyHyperGraphSectionPipelineSolver.ts:495:39)
at _step (/home/ohmx/Documents/tiny-hypergraph/node_modules/@tscircuit/solver-utils/dist/index.js:151:48)
at step (/home/ohmx/Documents/tiny-hypergraph/node_modules/@tscircuit/solver-utils/dist/index.js:34:12)
at solve (/home/ohmx/Documents/tiny-hypergraph/node_modules/@tscircuit/solver-utils/dist/index.js:68:12)
at <anonymous> (/home/ohmx/Documents/tiny-hypergraph/scripts/benchmarking/benchmark.ts:295:22)

snapshotError=
Error: Connection "source_trace_69" could not be mapped to route endpoints
at <anonymous> (/home/ohmx/Documents/tiny-hypergraph/lib/compat/loadSerializedHyperGraph.ts:454:17)
at forEach (native:1:11)
at loadSerializedHyperGraph (/home/ohmx/Documents/tiny-hypergraph/lib/compat/loadSerializedHyperGraph.ts:429:23)
at getInitialVisualizationSolver (/home/ohmx/Documents/tiny-hypergraph/lib/section-solver/TinyHyperGraphSectionPipelineSolver.ts:629:37)
at initialVisualize (/home/ohmx/Documents/tiny-hypergraph/lib/section-solver/TinyHyperGraphSectionPipelineSolver.ts:642:17)
at getSnapshotPng (/home/ohmx/Documents/tiny-hypergraph/scripts/benchmarking/benchmark.ts:256:22)
at <anonymous> (/home/ohmx/Documents/tiny-hypergraph/scripts/benchmarking/benchmark.ts:379:27)
15 changes: 15 additions & 0 deletions results/run001/sample076/logs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
sample=sample076
circuitId=162
status=failed
duration=0.009s

error=
Error: Route 18 is not a single ordered path from 1660 to 823
at getOrderedRoutePath (/home/ohmx/Documents/tiny-hypergraph/lib/compat/convertToSerializedHyperGraph.ts:230:17)
at getSerializedSolvedRoute (/home/ohmx/Documents/tiny-hypergraph/lib/compat/convertToSerializedHyperGraph.ts:300:48)
at map (native:1:11)
at convertToSerializedHyperGraph (/home/ohmx/Documents/tiny-hypergraph/lib/compat/convertToSerializedHyperGraph.ts:408:49)
at _step (/home/ohmx/Documents/tiny-hypergraph/node_modules/@tscircuit/solver-utils/dist/index.js:137:45)
at step (/home/ohmx/Documents/tiny-hypergraph/node_modules/@tscircuit/solver-utils/dist/index.js:34:12)
at solve (/home/ohmx/Documents/tiny-hypergraph/node_modules/@tscircuit/solver-utils/dist/index.js:68:12)
at <anonymous> (/home/ohmx/Documents/tiny-hypergraph/scripts/benchmarking/benchmark.ts:295:22)
Binary file added results/run001/sample076/snapshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading