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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ If there is crowding at the pin, we look for an available spot along the trace c
## Usage

```tsx
import { SchematicTracePipelineSolver } from "@tscircuit/schematic-trace-solver"
import { SchematicTracePipelineSolver } from "@tscircuit/schematic-trace-solver";

type ChipId = string
type PinId = string
type ChipId = string;
type PinId = string;

const solver = new SchematicTracePipelineSolver({
chips: {
Expand Down Expand Up @@ -77,9 +77,9 @@ const solver = new SchematicTracePipelineSolver({
VCC: ["y+", "y-"],
GND: ["y+", "y-"],
},
})
});

solver.solve()
solver.solve();
```

## Development
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Schematic Trace Solver</title>
<script>
const script = document.createElement("script")
script.src = "https://cdn.tailwindcss.com"
document.head.appendChild(script)
const script = document.createElement("script");
script.src = "https://cdn.tailwindcss.com";
document.head.appendChild(script);
</script>
</head>
<body>
Expand Down
4 changes: 1 addition & 3 deletions lib/solvers/GuidelinesSolver/GuidelinesSolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ export class GuidelinesSolver extends BaseSolver {
usedXGuidelines: Set<number>
usedYGuidelines: Set<number>

constructor(params: {
inputProblem: InputProblem
}) {
constructor(params: { inputProblem: InputProblem }) {
super()
this.inputProblem = params.inputProblem
const inputProblemBounds = getInputProblemBounds(this.inputProblem)
Expand Down
5 changes: 4 additions & 1 deletion lib/solvers/LongDistancePairSolver/LongDistancePairSolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ export class LongDistancePairSolver extends BaseSolver {
allTracesMerged: SolvedTracePath[]
} {
if (!this.solved) {
return { newTraces: [], allTracesMerged: this.params.alreadySolvedTraces }
return {
newTraces: [],
allTracesMerged: this.params.alreadySolvedTraces,
}
}
return {
newTraces: this.solvedLongDistanceTraces,
Expand Down
11 changes: 11 additions & 0 deletions lib/solvers/TraceCleanupSolver/TraceCleanupSolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ export class TraceCleanupSolver extends BaseSolver {
)
}

reset() {
this.outputTraces = [...this.input.allTraces]
this.tracesMap = new Map(this.outputTraces.map((t) => [t.mspPairId, t]))
this.traceIdQueue = Array.from(this.input.allTraces.map((e) => e.mspPairId))
this.pipelineStep = "untangling_traces"
this.activeTraceId = null
this.activeSubSolver = null
this.solved = false
this.failed = false
}

override _step() {
if (this.activeSubSolver) {
this.activeSubSolver.step()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots

exports[`POW: TraceCleanupSolver snapshot shows BEFORE and AFTER cleaned trace 1`] = `
{
"AFTER": [
{
"cleaned": [
{
"x": 0,
"y": 0,
},
{
"x": 20,
"y": 0,
},
{
"x": 20,
"y": 20,
},
],
"id": "pow-demo",
"original": [
{
"x": 0,
"y": 0,
},
{
"x": 10,
"y": 0,
},
{
"x": 20,
"y": 0,
},
{
"x": 20,
"y": 10,
},
{
"x": 20,
"y": 20,
},
],
},
],
"BEFORE": [
{
"id": "pow-demo",
"mspPairId": "pow-test",
"tracePath": [
{
"x": 0,
"y": 0,
},
{
"x": 10,
"y": 0,
},
{
"x": 20,
"y": 0,
},
{
"x": 20,
"y": 10,
},
{
"x": 20,
"y": 20,
},
],
},
],
}
`;
Loading
Loading