@mark1russell7/highways 0.9.0 → 0.9.2

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.
Files changed (40) hide show
  1. package/README.md +69 -1
  2. package/build/index.d.ts +420 -9
  3. package/build/index.d.ts.map +1 -1
  4. package/build/index.js +4361 -2002
  5. package/build/index.js.map +1 -1
  6. package/package.json +2 -2
  7. package/src/bench/compare.ts +13 -1
  8. package/src/bench/measures/curves.ts +55 -1
  9. package/src/bench/measures/groups.ts +71 -0
  10. package/src/bench/measures/index.ts +1 -0
  11. package/src/bench/measures/levels.ts +24 -0
  12. package/src/bench/measures/room.ts +106 -1
  13. package/src/bench/measures/symmetry.ts +114 -0
  14. package/src/bench/screen/exercise.ts +5 -0
  15. package/src/bench/screen/forms.ts +14 -3
  16. package/src/bench/screen/measures.ts +40 -3
  17. package/src/bench/screen/screen.ts +40 -5
  18. package/src/bench/suite.ts +10 -2
  19. package/src/highways/fixtures.test-util.ts +13 -0
  20. package/src/highways/follow.ts +3 -2
  21. package/src/highways/free-lines.ts +141 -0
  22. package/src/highways/gaps/index.ts +85 -0
  23. package/src/highways/index.ts +6 -0
  24. package/src/highways/interchanges/index.ts +231 -0
  25. package/src/highways/search/index.ts +170 -0
  26. package/src/highways/snap.ts +4 -2
  27. package/src/highways/steiner/index.ts +215 -0
  28. package/src/highways/streets/index.ts +78 -0
  29. package/src/model.ts +127 -4
  30. package/src/routers/attraction/index.ts +61 -0
  31. package/src/routers/corners.ts +15 -8
  32. package/src/routers/frames.ts +136 -0
  33. package/src/routers/index.ts +3 -1
  34. package/src/routers/plugs.ts +3 -2
  35. package/src/routers/sections.ts +3 -2
  36. package/src/routers/shared.ts +70 -7
  37. package/src/routers/straight.ts +3 -2
  38. package/src/routers/trunks.ts +3 -2
  39. package/src/strategies/builtins.ts +56 -1
  40. package/src/strategies/schemas.ts +69 -0
@@ -39,6 +39,11 @@ import type { ResistanceOptions } from "../highways/resistance/index.ts";
39
39
  import type { RidgeOptions } from "../highways/ridges/index.ts";
40
40
  import type { RoadClassOptions } from "../highways/road-classes/index.ts";
41
41
  import type { ScaleSpaceOptions } from "../highways/scale-space/index.ts";
42
+ import type { GapOptions } from "../highways/gaps/index.ts";
43
+ import type { InterchangeOptions } from "../highways/interchanges/index.ts";
44
+ import type { SearchOptions } from "../highways/search/index.ts";
45
+ import type { SteinerOptions } from "../highways/steiner/index.ts";
46
+ import type { StreetOptions } from "../highways/streets/index.ts";
42
47
  import type { SelectOptions } from "../highways/select/index.ts";
43
48
  import type { SoftKeyOptions } from "../highways/soft-keys/index.ts";
44
49
  import type { SpectralOptions } from "../highways/spectral/index.ts";
@@ -120,6 +125,19 @@ export const CORNERS_SCHEMA: OptionSchema<RouterPreset<CornersOptions>> = {
120
125
  },
121
126
  plug: { type: "strategy", step: "plugs", describe: "The plug rule: a strategy of the step `plugs`. Without it, the option `plugs` places the plugs." },
122
127
  plugOptions: { type: "object", describe: "The options of the strategy `plug`." },
128
+ outside: {
129
+ type: "enum",
130
+ values: ["throw", "skip", "clamp"],
131
+ default: "throw",
132
+ describe: "The rule for a box outside the box of its frame: throw a `RangeError`, skip the box and its inner edges, or cut the box to the bounds.",
133
+ },
134
+ frameInset: {
135
+ type: "number",
136
+ min: 0,
137
+ max: 20,
138
+ step: 1,
139
+ describe: "The distance from the walls of a frame to the bounds of its inner routes. Without a value, the inset is the margin.",
140
+ },
123
141
  };
124
142
 
125
143
  /** The declarations of the options of the router `trunks`. */
@@ -925,3 +943,54 @@ export const PIPELINE_SCHEMA: OptionSchema<PipelineOptions> = {
925
943
  room: { type: "strategy", step: "room", describe: "The room strategy. With it, the gaps of the board open before the routes. Without it, the board stays." },
926
944
  roomOptions: { type: "object", describe: "The options of the room strategy." },
927
945
  };
946
+
947
+ /** The declarations of the options of the highway strategy `steiner` (HWY-036 with EDA-015). */
948
+ export const STEINER_SCHEMA: OptionSchema<SteinerOptions> = {
949
+ group: { type: "enum", values: ["source", "key"], default: "source", describe: "The groups of the trees: the edges from one source node, or the edges of one collection." },
950
+ method: { type: "enum", values: ["one-steiner", "spanning"], default: "one-steiner", describe: "The method of the tree: the iterated 1-Steiner method, or the spanning tree of the terminals." },
951
+ maxGroup: { type: "integer", min: 3, max: 32, step: 1, marks: [8, 12, 16], default: 12, describe: "A group with more terminals than this number gets the spanning tree alone." },
952
+ metric: { type: "enum", values: ["rectilinear", "octilinear"], default: "rectilinear", describe: "The metric of the tree: two directions or four directions." },
953
+ detour: { type: "number", min: 1, max: 3, step: 0.05, marks: [1.25, 1.5, 2], default: 1.5, describe: "An edge rides the tree only when its path in the tree is this many times its first route or less." },
954
+ minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A stretch of a tree with fewer edges than this number is not a highway." },
955
+ };
956
+
957
+ /** The declarations of the options of the highway strategy `gaps` (HWY-057). */
958
+ export const GAP_SCHEMA: OptionSchema<GapOptions> = {
959
+ minSize: { type: "integer", min: 2, max: 16, step: 1, marks: [2, 3, 6], default: 3, describe: "A street with fewer edges than this number (the demand) is not a highway." },
960
+ discount: { type: "number", min: 0.1, max: 0.8, step: 0.05, marks: [0.3, 0.5, 0.7], default: 0.5, describe: "The cost of a length on a street against a length off the streets." },
961
+ detour: { type: "number", min: 1, max: 2, step: 0.05, marks: [1.2, 1.3, 1.5], default: 1.3, describe: "An edge rides a street only when its way along the street is this many times its first route or less." },
962
+ source: { type: "enum", values: ["room", "corners"], default: "room", describe: "The source of the streets: the gaps of the room step, or the lines through the corners." },
963
+ };
964
+
965
+ /** The declarations of the options of the highway strategy `streets` (HWY-058). */
966
+ export const STREET_SCHEMA: OptionSchema<StreetOptions> = {
967
+ detour: { type: "number", min: 1, max: 1.5, step: 0.05, marks: [1.1, 1.2, 1.3], default: 1.2, describe: "A street covers an edge when the way of the edge along it is this many times its first route or less." },
968
+ minGain: { type: "number", min: 1, max: 8, step: 0.25, marks: [1.5, 2, 4], default: 2, describe: "The cover stops when the best street gives less gain: the length that its edges ride over its length." },
969
+ maxStreets: { type: "integer", min: 4, max: 64, step: 4, marks: [16, 32], default: 32, describe: "The largest number of streets." },
970
+ minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A street with fewer new edges than this number is not a highway." },
971
+ source: { type: "enum", values: ["room", "corners"], default: "corners", describe: "The source of the streets: the gaps of the room step, or the lines through the corners." },
972
+ };
973
+
974
+ /** The declarations of the options of the highway strategy `search` (HWY-059). */
975
+ export const SEARCH_SCHEMA: OptionSchema<SearchOptions> = {
976
+ from: { type: "enum", values: ["corridors", "quickbundles", "wspd", "road-classes", "flow-field", "od-cells", "shared-ways"], default: "corridors", describe: "The plan where the search starts." },
977
+ pool: { type: "list", default: ["quickbundles", "road-classes"], describe: "The generators of the highways that the move `add` takes." },
978
+ evaluations: { type: "integer", min: 0, max: 400, step: 4, marks: [0, 16, 64], default: 16, describe: "The number of plans that the search measures. The value 0 gives the start plan." },
979
+ temperature: { type: "number", min: 0, max: 0.2, step: 0.005, marks: [0, 0.02, 0.05], default: 0.02, describe: "The first temperature of the annealing, on the scale of the score." },
980
+ inkWeight: { type: "number", min: 0, max: 4, step: 0.25, marks: [1], default: 1, describe: "The weight of the ink that the routes save (B1)." },
981
+ stretchWeight: { type: "number", min: 0, max: 4, step: 0.25, marks: [0.5], default: 0.5, describe: "The weight of the 0.95 quantile of the stretch (B3)." },
982
+ ambiguityWeight: { type: "number", min: 0, max: 4, step: 0.25, marks: [0.5], default: 0.5, describe: "The weight of the ambiguity (B4)." },
983
+ angleWeight: { type: "number", min: 0, max: 4, step: 0.25, marks: [0.25], default: 0.25, describe: "The weight of the largest merge angle (B6), divided by 180 degrees." },
984
+ seed: { type: "integer", min: 0, max: 1000, step: 1, default: 1, describe: "The seed of the moves." },
985
+ };
986
+
987
+ /** The declarations of the options of the highway strategy `interchanges` (HWY-060). */
988
+ export const INTERCHANGE_SCHEMA: OptionSchema<InterchangeOptions> = {
989
+ from: { type: "enum", values: ["corridors", "shared-ways"], default: "corridors", describe: "The plan that gives the highways of the network." },
990
+ changeCost: { type: "number", min: 0, max: 8, step: 0.5, marks: [0, 2, 4], default: 2, describe: "The cost of a change between two highways, in units of the board." },
991
+ interchanges: { type: "integer", min: 1, max: 32, step: 1, marks: [4, 16], default: 16, describe: "The largest number of interchanges." },
992
+ perEdge: { type: "integer", min: 1, max: 3, step: 1, default: 2, describe: "The largest number of highways on the way of one edge." },
993
+ radius: { type: "number", min: 0.5, max: 8, step: 0.5, marks: [1, 2, 4], default: 2, describe: "Two highways get an interchange where they come this near, in units of the board." },
994
+ discount: { type: "number", min: 0.1, max: 1, step: 0.05, marks: [0.3, 0.5, 0.7], default: 0.5, describe: "The cost of a length on a highway against a length off the highways." },
995
+ detour: { type: "number", min: 1, max: 3, step: 0.05, marks: [1.25, 1.5, 2], default: 1.5, describe: "An edge rides the network only when its way is this many times its first route or less." },
996
+ };