@tscircuit/matchpack 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { GraphicsObject } from 'graphics-debug';
2
2
  import { Point, Bounds } from '@tscircuit/math-utils';
3
- import { PhasedPackSolver } from 'calculate-packing';
3
+ import { PackSolver2 } from 'calculate-packing';
4
4
 
5
5
  declare class BaseSolver {
6
6
  MAX_ITERATIONS: number;
@@ -120,7 +120,7 @@ type OutputLayout = {
120
120
  declare class SingleInnerPartitionPackingSolver extends BaseSolver {
121
121
  inputProblem: InputProblem;
122
122
  layout: OutputLayout | null;
123
- phasedPackSolver: PhasedPackSolver | null;
123
+ activeSubSolver: PackSolver2 | null;
124
124
  constructor(inputProblem: InputProblem);
125
125
  _step(): void;
126
126
  private createPackInput;
@@ -164,7 +164,7 @@ declare class PartitionPackingSolver extends BaseSolver {
164
164
  packedPartitions: PackedPartition[];
165
165
  inputProblem: InputProblem;
166
166
  finalLayout: OutputLayout | null;
167
- phasedPackSolver: PhasedPackSolver | null;
167
+ packSolver2: PackSolver2 | null;
168
168
  constructor(input: PartitionPackingSolverInput);
169
169
  _step(): void;
170
170
  private organizePackedPartitions;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // lib/solvers/BaseSolver.ts
2
2
  var BaseSolver = class {
3
- MAX_ITERATIONS = 1e3;
3
+ MAX_ITERATIONS = 1e5;
4
4
  solved = false;
5
5
  failed = false;
6
6
  iterations = 0;
@@ -453,7 +453,7 @@ var ChipPartitionsSolver = class extends BaseSolver {
453
453
  };
454
454
 
455
455
  // lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts
456
- import { PhasedPackSolver } from "calculate-packing";
456
+ import { PackSolver2 } from "calculate-packing";
457
457
 
458
458
  // lib/utils/networkFiltering.ts
459
459
  function createFilteredNetworkMapping(inputProblem) {
@@ -554,27 +554,26 @@ function createFilteredNetworkMapping(inputProblem) {
554
554
  var SingleInnerPartitionPackingSolver = class extends BaseSolver {
555
555
  inputProblem;
556
556
  layout = null;
557
- phasedPackSolver = null;
558
557
  constructor(inputProblem) {
559
558
  super();
560
559
  this.inputProblem = inputProblem;
561
560
  }
562
561
  _step() {
563
562
  try {
564
- if (!this.phasedPackSolver) {
563
+ if (!this.activeSubSolver) {
565
564
  const packInput = this.createPackInput();
566
- this.phasedPackSolver = new PhasedPackSolver(packInput);
567
- this.activeSubSolver = this.phasedPackSolver;
565
+ this.activeSubSolver = new PackSolver2(packInput);
566
+ this.activeSubSolver = this.activeSubSolver;
568
567
  }
569
- this.phasedPackSolver.step();
570
- if (this.phasedPackSolver.failed) {
568
+ this.activeSubSolver.step();
569
+ if (this.activeSubSolver.failed) {
571
570
  this.failed = true;
572
- this.error = `PhasedPackSolver failed: ${this.phasedPackSolver.error}`;
571
+ this.error = `PackSolver2 failed: ${this.activeSubSolver.error}`;
573
572
  return;
574
573
  }
575
- if (this.phasedPackSolver.solved) {
574
+ if (this.activeSubSolver.solved) {
576
575
  this.layout = this.createLayoutFromPackingResult(
577
- this.phasedPackSolver.getResult()
576
+ this.activeSubSolver.packedComponents
578
577
  );
579
578
  this.solved = true;
580
579
  this.activeSubSolver = null;
@@ -644,8 +643,8 @@ var SingleInnerPartitionPackingSolver = class extends BaseSolver {
644
643
  };
645
644
  }
646
645
  visualize() {
647
- if (this.phasedPackSolver && !this.solved) {
648
- return this.phasedPackSolver.visualize();
646
+ if (this.activeSubSolver && !this.solved) {
647
+ return this.activeSubSolver.visualize();
649
648
  }
650
649
  if (!this.layout) {
651
650
  return super.visualize();
@@ -725,12 +724,12 @@ var PackInnerPartitionsSolver = class extends BaseSolver {
725
724
  };
726
725
 
727
726
  // lib/solvers/PartitionPackingSolver/PartitionPackingSolver.ts
728
- import { PhasedPackSolver as PhasedPackSolver2 } from "calculate-packing";
727
+ import { PackSolver2 as PackSolver22 } from "calculate-packing";
729
728
  var PartitionPackingSolver = class extends BaseSolver {
730
729
  packedPartitions;
731
730
  inputProblem;
732
731
  finalLayout = null;
733
- phasedPackSolver = null;
732
+ packSolver2 = null;
734
733
  constructor(input) {
735
734
  super();
736
735
  this.packedPartitions = input.packedPartitions;
@@ -752,20 +751,20 @@ var PartitionPackingSolver = class extends BaseSolver {
752
751
  return;
753
752
  }
754
753
  const partitionGroups = this.organizePackedPartitions();
755
- if (!this.phasedPackSolver) {
754
+ if (!this.packSolver2) {
756
755
  const packInput = this.createPackInput(partitionGroups);
757
- this.phasedPackSolver = new PhasedPackSolver2(packInput);
758
- this.activeSubSolver = this.phasedPackSolver;
756
+ this.packSolver2 = new PackSolver22(packInput);
757
+ this.activeSubSolver = this.packSolver2;
759
758
  }
760
- this.phasedPackSolver.step();
761
- if (this.phasedPackSolver.failed) {
759
+ this.packSolver2.step();
760
+ if (this.packSolver2.failed) {
762
761
  this.failed = true;
763
- this.error = `PhasedPackSolver failed: ${this.phasedPackSolver.error}`;
762
+ this.error = `PackSolver2 failed: ${this.packSolver2.error}`;
764
763
  return;
765
764
  }
766
- if (this.phasedPackSolver.solved) {
765
+ if (this.packSolver2.solved) {
767
766
  const packedLayout = this.applyPackingResult(
768
- this.phasedPackSolver.getResult(),
767
+ this.packSolver2.packedComponents,
769
768
  partitionGroups
770
769
  );
771
770
  this.finalLayout = packedLayout;
@@ -948,8 +947,8 @@ var PartitionPackingSolver = class extends BaseSolver {
948
947
  };
949
948
  }
950
949
  visualize() {
951
- if (this.phasedPackSolver && !this.solved) {
952
- return this.phasedPackSolver.visualize();
950
+ if (this.packSolver2 && !this.solved) {
951
+ return this.packSolver2.visualize();
953
952
  }
954
953
  if (!this.finalLayout) {
955
954
  return super.visualize();
@@ -1051,7 +1050,7 @@ var LayoutPipelineSolver = class extends BaseSolver {
1051
1050
  constructor(inputProblem) {
1052
1051
  super();
1053
1052
  this.inputProblem = inputProblem;
1054
- this.MAX_ITERATIONS = 1e3;
1053
+ this.MAX_ITERATIONS = 1e6;
1055
1054
  this.startTimeOfPhase = {};
1056
1055
  this.endTimeOfPhase = {};
1057
1056
  this.timeSpentOnPhase = {};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tscircuit/matchpack",
3
3
  "main": "dist/index.js",
4
4
  "type": "module",
5
- "version": "0.0.7",
5
+ "version": "0.0.8",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
@@ -21,7 +21,7 @@
21
21
  "@tscircuit/schematic-viewer": "^2.0.26",
22
22
  "@types/bun": "latest",
23
23
  "bpc-graph": "^0.0.66",
24
- "calculate-packing": "^0.0.19",
24
+ "calculate-packing": "^0.0.27",
25
25
  "circuit-json": "^0.0.226",
26
26
  "graphics-debug": "^0.0.62",
27
27
  "react-cosmos": "^7.0.0",