@mark1russell7/highways 0.9.2 → 0.9.4

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/build/index.d.ts CHANGED
@@ -1619,12 +1619,21 @@ export declare function routersOf(registry: Registry): Router[];
1619
1619
  * With `clamp`, the router cuts the box to the bounds of the frame.
1620
1620
  */
1621
1621
  type Outside = "throw" | "skip" | "clamp";
1622
- /** The options of the inner routes: the options of the way finder, the rule `outside` and the inset `frameInset`. */
1622
+ /**
1623
+ * The mode of the inner routes. With `corners`, the corner graph gives each route, in the box of the frame smaller by `frameInset`.
1624
+ * With `gutter`, each route is orthogonal in the free room of the frame box: the gaps between the nodes and the strips at the walls.
1625
+ */
1626
+ type InnerMode = "corners" | "gutter";
1627
+ /** The options of the inner routes: the options of the way finder, the rule `outside`, the inset `frameInset`, the mode `inner` and `bendCost`. */
1623
1628
  interface FrameOptions extends WayOptions {
1624
1629
  /** The rule for a node box outside the box of its frame. The default is `throw`. */
1625
1630
  readonly outside?: Outside;
1626
- /** The distance from the walls of a frame to the bounds of its inner routes. The default is the margin of the router. */
1631
+ /** The distance from the walls of a frame to the bounds of its inner routes. The default is the margin of the router. The mode `gutter` does not use it. */
1627
1632
  readonly frameInset?: number;
1633
+ /** The mode of the inner routes. The default is `corners`. */
1634
+ readonly inner?: InnerMode;
1635
+ /** The cost of one bend of an inner route of the mode `gutter`, in units of length. The default is 16. */
1636
+ readonly bendCost?: number;
1628
1637
  }
1629
1638
  /**
1630
1639
  * This function gives the inner routes of the inner edges (`splitFrames`). Each route stays in the bounds of its frame:
@@ -1665,6 +1674,34 @@ interface CornersOptions extends FrameOptions {
1665
1674
  * An inner edge (`splitFrames`) gets an inner route in the bounds of its frame (`frameRoutes`), after the outer routes.
1666
1675
  */
1667
1676
  export declare function cornersRouter(options: CornersOptions): Router;
1677
+ /**
1678
+ * One inner edge of a frame for the gutter mode. `plug` is the plug of the wall, with the outward normal of the wall.
1679
+ * `end` is the node at the other end. `port` is the fixed plug of that node, if it has one. `side` limits the entry to one side of the node.
1680
+ */
1681
+ interface GutterEdge {
1682
+ readonly plug: Plug;
1683
+ readonly end: Node;
1684
+ readonly port?: Plug;
1685
+ readonly side?: Side;
1686
+ }
1687
+ /** The options of the gutter mode. */
1688
+ interface GutterOptions {
1689
+ /** The cost of one bend, in units of length. The default is 16. */
1690
+ readonly bendCost?: number;
1691
+ /** The largest space between two lanes of one gap. A narrow gap gets a smaller, even space. The default is 5. */
1692
+ readonly laneGap?: number;
1693
+ }
1694
+ /** The default cost of one bend of the gutter mode. */
1695
+ export declare const GUTTER_BEND_COST = 16;
1696
+ /**
1697
+ * This function gives the orthogonal route of each edge in the free room of a frame: the box `frame` minus the boxes of `nodes`.
1698
+ * Each route starts at the plug of the wall, and goes along the normal of the wall into the frame. It ends on a side of its end node.
1699
+ *
1700
+ * The route goes on a grid of lines. A line goes through the middle of each free band between the box edges, each plug and each entry.
1701
+ * A shortest path with a cost for each bend (`bendCost`) gives the route. Then the routes that share one gap get a lane each.
1702
+ * An edge without a path through the free room gets `undefined`.
1703
+ */
1704
+ export declare function gutterRoutes(frame: Box, nodes: readonly Node[], edges: readonly GutterEdge[], options?: GutterOptions): (Point[] | undefined)[];
1668
1705
  /**
1669
1706
  * The lane order of the stretches (LANE-STRETCH).
1670
1707
  *
@@ -1858,13 +1895,139 @@ interface SharedNegotiation {
1858
1895
  /** The width of one lane. The capacity of a link is its free width divided by this width, and 1 or more. */
1859
1896
  readonly laneWidth: number;
1860
1897
  }
1898
+ /**
1899
+ * The search of the corner graph of one route of `shared`, for the hooks of `SharedHooks`.
1900
+ * An index below `corners` is a corner of the graph. Each end of a way gets an index from `corners`, one for each place.
1901
+ */
1902
+ interface SharedSearch {
1903
+ /** The graph of the route, without the inner edges of a frame. */
1904
+ readonly graph: Graph;
1905
+ /** The number of corners of the corner graph. */
1906
+ readonly corners: number;
1907
+ /** This function gives the key of the link between the indices `i` and `j`, for each order of the two. */
1908
+ link(i: number, j: number): number;
1909
+ /**
1910
+ * This function gives a shortest way of `w` through the corner graph, with its points and their indices, or `undefined`.
1911
+ * The function `cost` can change the cost of the link from corner `i` to corner `j`, of length `d`. It must give at least `floor` × `d`.
1912
+ */
1913
+ find(w: Way, cost?: (i: number, j: number, d: number) => number, floor?: number): {
1914
+ seq: Point[];
1915
+ ids: number[];
1916
+ } | undefined;
1917
+ }
1918
+ /**
1919
+ * The hooks of a router that `shared` runs (WILD-023, RULE-021). The router `shared` itself has no hooks.
1920
+ * `order` gives the order of the ways before the first pass. `refine` changes the ways after the passes, before the runs.
1921
+ */
1922
+ interface SharedHooks {
1923
+ readonly order?: (ways: readonly Way[], search: SharedSearch) => Way[];
1924
+ readonly refine?: (ways: readonly Way[], search: SharedSearch) => void;
1925
+ }
1926
+ /** A way of one edge through the corner graph. */
1927
+ interface Way {
1928
+ readonly edge: Edge;
1929
+ readonly key: string;
1930
+ readonly ps: Plug;
1931
+ readonly pt: Plug;
1932
+ /** The way through the corner graph, from the point out of the source plug to the point out of the target plug. */
1933
+ seq: Point[];
1934
+ /** The index of each point of `seq` in the corner graph. The two ends get an index after the corners, one for each place. */
1935
+ ids: number[];
1936
+ found: boolean;
1937
+ }
1861
1938
  /**
1862
1939
  * This function makes a router where edges share their ways (after Pupyrev, Nachmanson, Bereg and Holroyd, "Edge routing with ordered bundles").
1863
1940
  * The edges go one by one through the corner graph. A link that an edge with the same key uses already costs less.
1864
1941
  * Thus the edges of a key come together on common ways. Each stretch that several edges share has the same points in each route.
1865
1942
  * The result gives each stretch as a run, with the order of its lanes.
1866
1943
  */
1867
- export declare function sharedRouter(options: SharedOptions, negotiation?: SharedNegotiation): Router;
1944
+ export declare function sharedRouter(options: SharedOptions, negotiation?: SharedNegotiation, hooks?: SharedHooks): Router;
1945
+ /** The options of the router `annealing` (RULE-021: simulated annealing over candidate routes, with its rider WILD-028). */
1946
+ interface AnnealingOptions {
1947
+ /** The number of candidate ways of each edge, from 3 to 8. The default is 4. */
1948
+ readonly candidates: number;
1949
+ /** The cost of one crossing, in units of the median box side, from 0 to 20. The default is 4. */
1950
+ readonly crossing: number;
1951
+ /** The start temperature, in units of the median box side, from 0.1 to 10. The default is 1. */
1952
+ readonly temperature: number;
1953
+ /** The factor of the temperature after each sweep of the edges, from 0.9 to 0.99. The default is 0.95. */
1954
+ readonly cooling: number;
1955
+ /** The budget: the number of changes for each edge, from 20 to 200. The default is 50. */
1956
+ readonly budget: number;
1957
+ /** The seed of the random choices, a whole number from 0. The same seed gives the same routes. The default is 1. */
1958
+ readonly seed: number;
1959
+ }
1960
+ /** The default options of the router `annealing`. */
1961
+ export declare const ANNEALING_DEFAULTS: Readonly<AnnealingOptions>;
1962
+ /** The declarations of the options of the router `annealing` (RULE-021). */
1963
+ export declare const ANNEALING_SCHEMA: OptionSchema<AnnealingOptions>;
1964
+ /**
1965
+ * This function anneals the choice of one candidate way for each edge (RULE-021, after Davidson and Harel, 1996).
1966
+ * The candidates of an edge are its way in `shared` and its shortest way. Other candidates are the shortest ways when the links of earlier candidates cost 3 times more.
1967
+ * The energy is `(1 - 0.5) ink + 0.5 Σ L + crossing u X`: the cost of `shared` plus a cost for each crossing `X` between the ways of two edges.
1968
+ * A change takes one edge to another candidate. A worse change stays with the rational chance `1 / (1 + y + y^2 / 2)`, with `y = ΔE / T`.
1969
+ * The temperature falls by `cooling` after each sweep. The ways at the end are the ways of the lowest energy of the run.
1970
+ */
1971
+ export declare function annealWays(ways: readonly Way[], search: SharedSearch, o: Readonly<AnnealingOptions>): void;
1972
+ /**
1973
+ * This function makes the router `annealing` (RULE-021 with its rider WILD-028). It is the router `shared`, then the annealing of `annealWays`.
1974
+ * Each candidate is a way through the corner graph, as in `shared`, so each one keeps the hard rules.
1975
+ */
1976
+ export declare function annealingRouter(options: Partial<AnnealingOptions> & {
1977
+ readonly name: string;
1978
+ readonly rule?: GroupRule;
1979
+ readonly maxNodes?: number;
1980
+ }): Router;
1981
+ /**
1982
+ * The router strategy `annealing` (RULE-021), with the rule `byCollection` of `shared`. It is not a built-in router, so the benchmark and the hashes of `ROUTERS` do not change.
1983
+ * A screen module or a consumer adds it to a registry.
1984
+ */
1985
+ export declare const annealingStrategy: Strategy<"router", AnnealingOptions>;
1986
+ /** The edges that go first: the edges with few good ways (`tight`), or the edges with many good ways (`loose`). */
1987
+ type TightFirst = "tight" | "loose";
1988
+ /** The values of `TightFirst`. */
1989
+ export declare const TIGHT_FIRSTS: readonly TightFirst[];
1990
+ /** The order of two edges with the same slack: by the edge id, or the longer edge first. */
1991
+ type TightTies = "id" | "length";
1992
+ /** The values of `TightTies`. */
1993
+ export declare const TIGHT_TIES: readonly TightTies[];
1994
+ /** The options of the router `tight` (WILD-023: tight edges first, after list scheduling by slack). */
1995
+ interface TightOptions {
1996
+ /** The cost factor of the links of the first way in the search of the second way, from 2 to 10. The default is 3. */
1997
+ readonly penalty: number;
1998
+ /**
1999
+ * The edges that go first. With `tight`, the default, an edge whose second way costs much more than its first way goes first.
2000
+ * With `loose`, the order turns around: the formula of the record, with the rising slack.
2001
+ */
2002
+ readonly first: TightFirst;
2003
+ /** The order of two edges with the same slack. The default is `length`: the longer edge first, as in `shared`. */
2004
+ readonly ties: TightTies;
2005
+ }
2006
+ /** The default options of the router `tight`. */
2007
+ export declare const TIGHT_DEFAULTS: Readonly<TightOptions>;
2008
+ /** The declarations of the options of the router `tight` (WILD-023). */
2009
+ export declare const TIGHT_SCHEMA: OptionSchema<TightOptions>;
2010
+ /**
2011
+ * This function gives the slack of each way (WILD-023): `L2 / L1 - 1`. `L1` is the length of the shortest way.
2012
+ * `L2` is the cost of the shortest way when each link of the first way costs `penalty` times its length.
2013
+ * A way with no second way has the slack `penalty - 1`. A way with a second way of near-equal length has a slack near 0.
2014
+ */
2015
+ export declare function waySlacks(ways: readonly Way[], search: SharedSearch, penalty: number): Map<Way, number>;
2016
+ /**
2017
+ * This function makes the router `tight` (WILD-023). It is the router `shared` with another order of the edges of each key.
2018
+ * With `first: tight`, the edges with the largest slack value go first: their second way costs much more, so they have few good ways.
2019
+ * The edges with many ways of near-equal cost go last. The keys keep the order of `shared`.
2020
+ */
2021
+ export declare function tightRouter(options: Partial<TightOptions> & {
2022
+ readonly name: string;
2023
+ readonly rule?: GroupRule;
2024
+ readonly maxNodes?: number;
2025
+ }): Router;
2026
+ /**
2027
+ * The router strategy `tight` (WILD-023), with the rule `byCollection` of `shared`. It is not a built-in router, so the benchmark and the hashes of `ROUTERS` do not change.
2028
+ * A screen module or a consumer adds it to a registry.
2029
+ */
2030
+ export declare const tightStrategy: Strategy<"router", TightOptions>;
1868
2031
  /** The options of the router `attraction` (HWY-044 of the note on highways: negotiated attraction, PathFinder turned around). */
1869
2032
  interface AttractionOptions {
1870
2033
  /** The number of passes, from 1 to 10. Each pass after the first routes each edge again from no ways. The default is 3. */
@@ -2093,6 +2256,49 @@ export declare function levelRoom<T extends Boxed>(nodes: readonly T[], links: r
2093
2256
  * The output has one entry for each edge with two known nodes, in the order of the edges.
2094
2257
  */
2095
2258
  export declare function facingEnds(input: PlugInput): PlugPair[];
2259
+ /** The options of the plug strategy `spread`. */
2260
+ export interface SpreadOptions {
2261
+ /** The least gap between two plugs of one wall. When the room of the wall is too small, the gap shrinks evenly. The default is 8. */
2262
+ readonly plugGap?: number;
2263
+ /** The distance from a plug to a corner of its box, or a quarter of the wall when the wall is short. The default is 6. */
2264
+ readonly inset?: number;
2265
+ /** The number of passes that sort each wall again by the new places of the far ends. The default is 2. */
2266
+ readonly rounds?: number;
2267
+ }
2268
+ /** The defaults of the plug strategy `spread`. */
2269
+ export declare const SPREAD_DEFAULTS: Required<SpreadOptions>;
2270
+ /**
2271
+ * This function gives the plugs of the plug strategy `spread`. A fixed plug stays at its point, and a plug with a side stays on that side.
2272
+ * Each free plug goes on the side that faces the other end (`sideToward`). Then the free plugs of each wall share its room with at least `plugGap` between two of them.
2273
+ * They keep the order of their far ends. The ends of one port share one plug.
2274
+ *
2275
+ * The output has one entry for each edge with two known nodes, in the order of the edges.
2276
+ */
2277
+ export declare function spreadEnds(input: PlugInput, options?: SpreadOptions): PlugPair[];
2278
+ /** The options of `fixPorts`. */
2279
+ export interface FixPortsOptions {
2280
+ /** The options of the plug rule. The rule gets its `defaults` for each option that this object does not give. */
2281
+ readonly plugOptions?: object;
2282
+ /** The registry that gives the rule by its name. The default is `STRATEGIES`. */
2283
+ readonly registry?: Registry;
2284
+ /** The options of the way finder that a rule reads, for example `side`. The defaults are the defaults of the router `corners`. */
2285
+ readonly ways?: WayOptions;
2286
+ /**
2287
+ * With `true`, an end without a port gets a new fixed port, with the id `<edge id>:source` or `<edge id>:target`.
2288
+ * The default is `false`: such an end stays free.
2289
+ */
2290
+ readonly newPorts?: boolean;
2291
+ }
2292
+ /**
2293
+ * This function runs the plug rule. It gives each free port a fixed `at` and a `side` from the plugs of the rule.
2294
+ * A free port has no `at` and no `along`. A port of several ends takes the plug of its first end, in the order of the edges.
2295
+ * A fixed port keeps its values, and a port of no edge stays free.
2296
+ *
2297
+ * The rule sees the graph of `corners`: the plugs of `resolvePorts`, without the inner edges of the frames.
2298
+ * The rule is a strategy of the step `plugs`, or the name of one in the registry.
2299
+ * The output is a new graph. The function does not change the input.
2300
+ */
2301
+ export declare function fixPorts(graph: Graph, rule: Strategy<"plugs"> | string, options?: FixPortsOptions): Graph;
2096
2302
  /** The options of the level strategy `depths`: the limits of the level links, and the depths that get a level with groups. */
2097
2303
  export interface DepthLevelOptions extends Omit<LevelLinkOptions, "smooth"> {
2098
2304
  /**
@@ -2152,6 +2358,92 @@ export declare function strategyKey(router: Strategy<"router">, step: Step): str
2152
2358
  * The output has the board and the routes. The function does not examine the `maxNodes` of the router.
2153
2359
  */
2154
2360
  export declare function runPipeline(graph: Graph, options: PipelineOptions): WholeOutput;
2361
+ /** The graph of the backbone of a level: the relative neighbourhood graph, or the Gabriel graph of the centers of the items. */
2362
+ export type VenationBackbone = "rng" | "gabriel";
2363
+ /** The values of `VenationBackbone`. */
2364
+ export declare const VENATION_BACKBONES: readonly VenationBackbone[];
2365
+ /** The options of the level strategy `venation` (NAT-016 of the nature notes): the options of `depths`, and the options of the backbone. */
2366
+ export interface VenationOptions extends DepthLevelOptions {
2367
+ /** The graph of the backbone. The relative neighbourhood graph has fewer links than the Gabriel graph. The default is `rng`. */
2368
+ readonly backbone: VenationBackbone;
2369
+ /** A later level link saves this share of the cost of a backbone link that an earlier level link uses, from 0 to 0.8. The default is 0.4. */
2370
+ readonly discount: number;
2371
+ /** A level link takes its way on the backbone only when that way is this many times its direct link or less. The default is 1.5. */
2372
+ readonly detour: number;
2373
+ /** A level with more items than this number keeps the links of `depths`. The default is 400. */
2374
+ readonly maxItems: number;
2375
+ }
2376
+ /** The default options of the level strategy `venation`. */
2377
+ export declare const VENATION_DEFAULTS: Readonly<VenationOptions>;
2378
+ /**
2379
+ * This function gives the links of the backbone of the points, as pairs of indices `i < j` (NAT-016).
2380
+ * With `rng`, the link `p q` exists when no third point `r` has `max(d(p, r), d(q, r)) < d(p, q)`.
2381
+ * With `gabriel`, the link exists when no third point is inside the circle with the diameter `p q`.
2382
+ */
2383
+ export declare function backboneLinks(points: readonly Point[], backbone: VenationBackbone): [number, number][];
2384
+ /**
2385
+ * This function gives a way around the box `b`, inflated by `m`, from the point `a` to the point `c` of its boundary.
2386
+ * The way goes along the shorter side of the inflated box. It holds the two points at `m` out from `a` and `c`, and the corners between them.
2387
+ */
2388
+ export declare function aroundBox(b: Box, m: number, a: Point, c: Point): Point[];
2389
+ /**
2390
+ * This function gives the links of one level along a closed venation backbone (NAT-016, after Runions and others, 2005).
2391
+ * The backbone links the items by their relative neighbourhood graph or their Gabriel graph. Each backbone link goes around the other items.
2392
+ * The level links go in the order of their counts, the largest first. Each one takes the cheapest way on the backbone, with the cost `L (1 - discount)` for a used backbone link.
2393
+ * The way goes around each item between its two ends. A way longer than `detour` times the direct link, or a direct backbone link, keeps the direct link.
2394
+ */
2395
+ export declare function venationLinks(items: readonly LevelItem[], direct: readonly LevelLink[], o: Readonly<VenationOptions>): LevelLink[];
2396
+ /**
2397
+ * This function gives the zoom levels of the level strategy `venation` (NAT-016). The levels and their items are the levels of `depths`.
2398
+ * In each level with groups, the links take their ways along a closed venation backbone (`venationLinks`). The last level stays as in `depths`.
2399
+ */
2400
+ export declare function venationLevels(input: LevelInput, options: Readonly<VenationOptions>): Level[];
2401
+ /** One setting of the portfolio: a name and the options of the pipeline. */
2402
+ export interface PortfolioSetting {
2403
+ readonly name: string;
2404
+ readonly pipeline: PipelineOptions;
2405
+ }
2406
+ /** The options of the whole strategy `board-portfolio` (WILD-045). */
2407
+ export interface BoardPortfolioOptions {
2408
+ /** The number of settings that the portfolio tries, from the start of its list, from 3 to 12. The default is 4. */
2409
+ readonly settings: number;
2410
+ /** The weight of the crossings (R1) in the score, from 0 to 4. The default is 1. */
2411
+ readonly crossings: number;
2412
+ /** The weight of the median detour (R5) in the score, from 0 to 4. The default is 1. */
2413
+ readonly detour: number;
2414
+ /** The weight of the ink saved (B1) in the score, from 0 to 4. The default is 1. */
2415
+ readonly ink: number;
2416
+ /**
2417
+ * The time budget in seconds, from 0 to 10. After the budget, no new setting starts. The first setting always runs.
2418
+ * The value 0, the default, sets no budget, so the output does not depend on the speed of the machine.
2419
+ */
2420
+ readonly budget: number;
2421
+ }
2422
+ /** The default options of the strategy `board-portfolio`. */
2423
+ export declare const BOARD_PORTFOLIO_DEFAULTS: Readonly<BoardPortfolioOptions>;
2424
+ /** The measures of one setting on the board, and its output. */
2425
+ export interface PortfolioEntry {
2426
+ readonly name: string;
2427
+ readonly output: WholeOutput;
2428
+ readonly crossings: number;
2429
+ readonly detour: number;
2430
+ readonly ink: number;
2431
+ }
2432
+ /** The result of `boardPortfolio`: the output and the name of the pick. It also holds the measures of each setting with no break of a hard rule. */
2433
+ export interface BoardPortfolioRun {
2434
+ readonly output: WholeOutput;
2435
+ readonly pick: string;
2436
+ readonly entries: readonly PortfolioEntry[];
2437
+ }
2438
+ /** This function gives the rank of each value from 0 (the best) to 1 (the worst). Equal values get the mean of their ranks. One value gets 0. */
2439
+ export declare function rankShares(values: readonly number[], lowerIsBetter: boolean): number[];
2440
+ /**
2441
+ * This function runs the portfolio for one board (WILD-045, after Rice, 1976). It reads only the board and the outputs of its own settings.
2442
+ * A setting whose router or highway strategy has a node limit below the size of the board does not run.
2443
+ * A setting with a break of a hard rule does not count. The score of a setting is `Σ w_i × the rank share of measure_i` over the settings.
2444
+ * The measures are the crossings (R1), the median detour (R5) and the ink saved (B1). The least score wins, and a tie goes to the earlier setting.
2445
+ */
2446
+ export declare function boardPortfolio(graph: Graph, list: readonly PortfolioSetting[], o: Readonly<BoardPortfolioOptions>, now?: () => number): BoardPortfolioRun;
2155
2447
  /** A broken hard rule. A correct router has none. */
2156
2448
  export interface Violation {
2157
2449
  readonly rule: "complete" | "ends-at-plugs" | "fixed-plugs" | "no-pass-through" | "counts-sum" | "link-ends" | "bundle-trunk" | "run-shared";
@@ -5170,6 +5462,101 @@ export declare function interchangeCandidates(spines: readonly (readonly Point[]
5170
5462
  * A change costs `changeCost` units. The interchanges that the most edges use stay, up to `interchanges`.
5171
5463
  */
5172
5464
  export declare function interchangePlan(input: HighwayInput, o: Readonly<InterchangeOptions>): HighwayPlan;
5465
+ /** One point of a balancing-factor tree. */
5466
+ interface FanPoint {
5467
+ readonly point: Point;
5468
+ /** The index of the point before, toward the root. The root has -1. */
5469
+ parent: number;
5470
+ /** The length of the tree from the root to this point. */
5471
+ pl: number;
5472
+ /** A new branch can join the tree at this point, and on the link from its parent. A plug of a target is not open. */
5473
+ readonly open: boolean;
5474
+ }
5475
+ /** The result of `balancedFan`: the points of the tree, and the index of the last point of the route of each target. */
5476
+ interface Fan {
5477
+ readonly points: readonly FanPoint[];
5478
+ readonly leaf: readonly number[];
5479
+ }
5480
+ /** The rule that picks one tree on the front: the knee of the chord, or the least weighted sum. */
5481
+ type KneeRule = "chord" | "weights";
5482
+ /** The values of `KneeRule`. */
5483
+ export declare const KNEE_RULES: readonly KneeRule[];
5484
+ /** The options of the highway strategy `knee` (NAT-018 of the nature notes, on the trees of NAT-017). */
5485
+ interface KneeOptions {
5486
+ /** The number of points of the sweep of the balancing factor, from 5 to 21. The default is 11. */
5487
+ readonly sweep: number;
5488
+ /** The rule that picks one tree on the front. The default is `chord`. */
5489
+ readonly rule: KneeRule;
5490
+ /** The weight of the ink in the rule `weights`, from 0 to 1. The rest of the weight goes to the path length. The default is 0.5. */
5491
+ readonly ink: number;
5492
+ /** An edge rides the tree only when its path in the tree is this many times its first route or less. The default is 1.5. */
5493
+ readonly detour: number;
5494
+ /** A stretch of a tree with fewer edges than this number is not a highway. The default is 2. */
5495
+ readonly minSize: number;
5496
+ }
5497
+ /** The default options of the strategy `knee`. */
5498
+ export declare const KNEE_DEFAULTS: Readonly<KneeOptions>;
5499
+ /** One tree of the sweep: its balancing factor, its ink `L`, the sum of its path lengths `S`, and the tree. */
5500
+ interface KneeTree {
5501
+ readonly bf: number;
5502
+ readonly ink: number;
5503
+ readonly paths: number;
5504
+ readonly fan: Fan;
5505
+ }
5506
+ /**
5507
+ * This function gives the index of the tree that the rule picks on the front of the trees (NAT-018).
5508
+ * The front holds the trees that no other tree beats on the ink and on the path lengths. The two values go to the range from 0 to 1.
5509
+ * With `chord`, the pick is the tree of the front farthest from the line between the two ends of the front.
5510
+ * With `weights`, the pick is the tree with the least `ink × L + (1 - ink) × S`. A tie goes to the earlier tree.
5511
+ */
5512
+ export declare function kneeOf(trees: readonly Pick<KneeTree, "ink" | "paths">[], rule: KneeRule, ink: number): number;
5513
+ /**
5514
+ * This function gives the highways of the knee trees (NAT-018). The edges from one source node get one tree. Its root is the out point of the plug nearest the center of the targets.
5515
+ * A sweep of the balancing factor of NAT-017 gives trees from the least ink to the most direct paths.
5516
+ * The tree at the knee of the front of ink and path lengths is the pick. Each edge takes its path in the tree, when that path is short enough.
5517
+ * The stretches of the tree that two edges or more share become highways.
5518
+ */
5519
+ export declare function kneePlan(input: HighwayInput, o: Readonly<KneeOptions>): HighwayPlan;
5520
+ /** The rule that splits the targets of a tip in two: by count, by weight, or at the widest gap of the angles. */
5521
+ type BronchialSplit = "count" | "weight" | "gap";
5522
+ /** The values of `BronchialSplit`. */
5523
+ export declare const BRONCHIAL_SPLITS: readonly BronchialSplit[];
5524
+ /** The options of the highway strategy `bronchial` (NAT-019 of the nature notes). */
5525
+ interface BronchialOptions {
5526
+ /**
5527
+ * The rule of the split. With `count`, each half gets half of the targets. With `weight`, the two halves get near-equal sums of the distances from the tip.
5528
+ * With `gap`, the cut goes at the widest gap between the angles of the targets. The default is `count`.
5529
+ */
5530
+ readonly split: BronchialSplit;
5531
+ /** The share of the distance to the center of the targets that a branch grows, from 0.3 to 0.7. The default is 0.5. */
5532
+ readonly share: number;
5533
+ /** A set with this number of targets or fewer stops the splits, from 1 to 3. Each of its targets gets its own way from the tip. The default is 1. */
5534
+ readonly smallest: number;
5535
+ /** An edge rides the tree only when its path in the tree is this many times its first route or less. The default is 1.5. */
5536
+ readonly detour: number;
5537
+ /** A stretch of a tree with fewer edges than this number is not a highway. The default is 2. */
5538
+ readonly minSize: number;
5539
+ }
5540
+ /** The default options of the strategy `bronchial`. */
5541
+ export declare const BRONCHIAL_DEFAULTS: Readonly<BronchialOptions>;
5542
+ /**
5543
+ * This function gives the diamond angle of the direction `(dx, dy)`: a value from 0 to 4 that grows with the angle, with no trigonometry.
5544
+ * The value 0 is the direction of the positive x axis.
5545
+ */
5546
+ export declare function diamondAngle(dx: number, dy: number): number;
5547
+ /**
5548
+ * This function splits the targets of a tip in two halves (NAT-019). The targets go in the order of their angles around the tip.
5549
+ * The order starts after the widest gap of the angles, so each half is a sector. The rule of `split` then cuts the order in two.
5550
+ */
5551
+ export declare function splitTargets(tip: Point, targets: readonly Point[], ids: readonly number[], split: BronchialSplit): [number[], number[]];
5552
+ /**
5553
+ * This function gives the highways of the bronchial trees (NAT-019, after Kitaoka and others, 1999). The edges from one source node get one tree.
5554
+ * The root of a tree is the out point of the plug nearest the center of the targets.
5555
+ * From the tip, the tree grows a share of the way to the center of its targets. Then it splits the targets in two and grows a branch for each half.
5556
+ * A branch that hits a box grows half as far, or not at all. A small set of targets gets its own ways from the tip, through the corner graph.
5557
+ * Each edge takes its path in the tree when that path is short enough, and the stretches that two edges or more share become highways.
5558
+ */
5559
+ export declare function bronchialPlan(input: HighwayInput, o: Readonly<BronchialOptions>): HighwayPlan;
5173
5560
  /** The options of the highway strategy `search` (HWY-059 of the note on highways). */
5174
5561
  interface SearchOptions {
5175
5562
  /** The plan where the search starts. The default is `corridors`. */
@@ -5909,6 +6296,20 @@ export declare function zipLegs(a0: Point, a1: Point, b0: Point, b1: Point, o: Z
5909
6296
  * Each zip is a new highway of two members. The `seq` of each member follows the place of its merge point along the route of the edge.
5910
6297
  */
5911
6298
  export declare function zipperPlan(input: HighwayInput, o: Readonly<ZipperOptions>): HighwayPlan;
6299
+ /** The options of the plug strategy `justify`. */
6300
+ interface JustifyOptions {
6301
+ /** The least gap between two free plugs of one side. The default is 8. 0 keeps each plug where it faces. */
6302
+ readonly plugGap?: number;
6303
+ }
6304
+ /** The options of `sidePlugs`. */
6305
+ interface SidePlugOptions {
6306
+ /** The cost of a slant first leg: the length of the leg grows by `bend` × its angle to the normal, in radians. The default is 1. */
6307
+ readonly bend?: number;
6308
+ /** The distance from a plug to a corner of its box. The default is 6, as in `pointOnSide`. */
6309
+ readonly inset?: number;
6310
+ /** The largest number of places that the search tries on each side. The default is 16. */
6311
+ readonly most?: number;
6312
+ }
5912
6313
  /** The options of a router strategy: the options of its router, without the name and the limit of the benchmark. */
5913
6314
  export type RouterPreset<O> = Omit<O, "name" | "maxNodes">;
5914
6315
  /** The built-in router strategies, in the order of the benchmark. They route as the routers of `ROUTERS`. */
@@ -6053,6 +6454,8 @@ export declare const highwayStrategies: {
6053
6454
  readonly streets: Strategy<"highway", StreetOptions>;
6054
6455
  readonly search: Strategy<"highway", SearchOptions>;
6055
6456
  readonly interchanges: Strategy<"highway", InterchangeOptions>;
6457
+ readonly knee: Strategy<"highway", KneeOptions>;
6458
+ readonly bronchial: Strategy<"highway", BronchialOptions>;
6056
6459
  readonly "corridors+breakeven": Strategy<"highway", CorridorOptions & BreakEvenOptions>;
6057
6460
  readonly "corridors+stretch": Strategy<"highway", CorridorOptions & StretchOptions>;
6058
6461
  readonly "corridors+ambiguity": Strategy<"highway", CorridorOptions & AmbiguityGuardOptions>;
@@ -6062,17 +6465,27 @@ export declare const highwayStrategies: {
6062
6465
  /** The built-in plug rules: the strategies of the step `plugs`. The router `corners` routes between their plugs with its option `plug`. */
6063
6466
  export declare const plugStrategies: {
6064
6467
  readonly facing: Strategy<"plugs", object>;
6468
+ readonly side: Strategy<"plugs", SidePlugOptions>;
6469
+ readonly justify: Strategy<"plugs", JustifyOptions>;
6470
+ readonly spread: Strategy<"plugs", SpreadOptions>;
6065
6471
  };
6066
6472
  /** The built-in level rules: the strategies of the step `levels`. The router `sections` makes its zoom levels with its option `level`. */
6067
6473
  export declare const levelStrategies: {
6068
6474
  readonly depths: Strategy<"levels", DepthLevelOptions>;
6475
+ readonly venation: Strategy<"levels", VenationOptions>;
6069
6476
  };
6477
+ /**
6478
+ * The fixed list of settings of the whole strategy `board-portfolio` (WILD-045), in order. The option `settings` takes the first ones.
6479
+ * The list holds routers and highway strategies with their defaults. It comes from the catalog of the strategies, not from a fit to the screen.
6480
+ */
6481
+ export declare const BOARD_PORTFOLIO_SETTINGS: readonly PortfolioSetting[];
6070
6482
  /**
6071
6483
  * The built-in whole strategies: the strategies of the step `whole`. The strategy `pipeline` runs one strategy of each step, as the demo of the site does.
6072
6484
  * Without options, it routes the graph with the router `corners`.
6073
6485
  */
6074
6486
  export declare const wholeStrategies: {
6075
6487
  readonly pipeline: Strategy<"whole", PipelineOptions>;
6488
+ readonly "board-portfolio": Strategy<"whole", BoardPortfolioOptions>;
6076
6489
  };
6077
6490
  /** The built-in strategies of each step, in order. A consumer adds its own: `createRegistry([...BUILT_IN_STRATEGIES, mine])`. */
6078
6491
  export declare const BUILT_IN_STRATEGIES: readonly AnyStrategy[];
@@ -6626,8 +7039,27 @@ export declare const SCREEN_V2_HELD_OUT: readonly number[];
6626
7039
  * This set does not change. The tests compare it with the files in `corpus/screen-v2`.
6627
7040
  */
6628
7041
  export declare const SCREEN_V2: ScreenSet;
7042
+ /** The member seeds of each family of `screen-v3` that the split `default` holds out. */
7043
+ export declare const SCREEN_V3_HELD_OUT: readonly number[];
7044
+ /**
7045
+ * The screen set `screen-v3` (CORPUS-FAMILIES): the 15 families of `HIGHWAYS_FAMILIES`, each with the 10 members 0 to 9, thus 150 boards.
7046
+ * The first 6 families are the families of `screen-v2` with their seeds. Thus their boards are the boards of `screen-v2`, under the ids of `screen-v3`.
7047
+ * The 9 new families cover frames with rows, a long chain, a wide fan-out and two hubs.
7048
+ * They also cover uneven sizes, thin bars, long edges, short edges and a complete bipartite part.
7049
+ *
7050
+ * The manifest declares 10 inputs for each family. The split `default` holds out the members 7 to 9 of each family.
7051
+ * This set does not change. A new family goes into a new set. The tests compare it with the files in `corpus/screen-v3`.
7052
+ */
7053
+ export declare const SCREEN_V3: ScreenSet;
7054
+ /**
7055
+ * This function gives the power of the sign test over `families` families at the level `level`.
7056
+ * The power is the least count of families on one side that passes.
7057
+ * A family set without ties and with that count or more on one side passes the two-sided exact sign test, with the p below `level`.
7058
+ * The function gives `undefined` when no count passes, for example for 5 families or fewer at the level 0.05.
7059
+ */
7060
+ export declare function signTestPower(families: number, level?: number): number | undefined;
6629
7061
  /**
6630
- * The screen sets by id. `screen-v1` and its larger version `screen-v2` (CORPUS-SEEDS) have the boards of the screen.
7062
+ * The screen sets by id. `screen-v1`, its larger version `screen-v2` (CORPUS-SEEDS) and `screen-v3` with 15 families (CORPUS-FAMILIES) have the boards of the screen.
6631
7063
  * `exact-v1` has small boards with a known optimum (MEAS2). `exact-v1-bounds` has larger boards with bounds (EXACT-BOUNDS).
6632
7064
  */
6633
7065
  export declare const SCREEN_SETS: Readonly<Record<string, ScreenSet>>;
@@ -7193,8 +7625,37 @@ export declare const MANY_GROUPS: HighwaysFamily;
7193
7625
  * Its generator record always has `cols`, `rows` and `long`, as the screen sets of today. It has `reach` only away from its default.
7194
7626
  */
7195
7627
  export declare const PACKED_GRID: HighwaysFamily;
7628
+ /**
7629
+ * The family `frame-rows`: cards with full-width rows, as INTERIOR-ROUTE takes them. Each row has a fixed plug on the east wall and on the west wall of its card.
7630
+ * The links join a plug of a card to a plug of another card. An inner edge joins a row to a plug of its own card. The default has no inner edge.
7631
+ */
7632
+ export declare const FRAME_ROWS: HighwaysFamily;
7633
+ /** The family `pipeline`: a long chain of stages in rows that turn at each end, with some links that skip stages. */
7634
+ export declare const PIPELINE: HighwaysFamily;
7635
+ /** The family `fan-out`: one large hub in the middle, with a link to each leaf on the square rings around it. */
7636
+ export declare const FAN_OUT: HighwaysFamily;
7637
+ /** The family `two-hubs`: two tall hubs with many nodes between them. Each such node has a link from each hub. A few nodes of one hub are on its far side. */
7638
+ export declare const TWO_HUBS: HighwaysFamily;
7639
+ /** The family `uneven-sizes`: a few large boxes and many small boxes in shelves, in a random order. Many edges end on a large box. */
7640
+ export declare const UNEVEN_SIZES: HighwaysFamily;
7641
+ /** The family `thin-bars`: long thin bars in lanes, as a timeline or the rows of a table. The links join bars of lanes near each other. */
7642
+ export declare const THIN_BARS: HighwaysFamily;
7643
+ /** The family `sparse-long`: few nodes far apart on a large board, and edges that go to far targets. */
7644
+ export declare const SPARSE_LONG: HighwaysFamily;
7645
+ /** The family `local-mesh`: a grid of small nodes with many short edges, each to a node of the 8 nodes around it. */
7646
+ export declare const LOCAL_MESH: HighwaysFamily;
7647
+ /** The values of the dimension `layout` of `bipartite`. */
7648
+ export declare const BIPARTITE_LAYOUTS: readonly string[];
7649
+ /**
7650
+ * The family `bipartite`: a complete bipartite part, with dense crossings that no plan can remove, and other nodes with random links.
7651
+ * At 3 nodes or more on each side, the part has no drawing without crossings.
7652
+ */
7653
+ export declare const BIPARTITE: HighwaysFamily;
7654
+ /** The 9 families of CORPUS-FAMILIES, in the order of `screen-v3`. */
7655
+ export declare const COVERAGE_FAMILIES: readonly HighwaysFamily[];
7196
7656
  /**
7197
7657
  * The corpus families of highways, in the order of the screen sets. Each family at its defaults makes the board of its screen family.
7658
+ * The first 6 families are the families of `screen-v1` and `screen-v2`. The 9 families of `COVERAGE_FAMILIES` follow them (CORPUS-FAMILIES).
7198
7659
  * An import registers nothing. A host makes a registry with `createFamilyRegistry(HIGHWAYS_FAMILIES)`, or with the lists of other engines too.
7199
7660
  */
7200
7661
  export declare const HIGHWAYS_FAMILIES: readonly HighwaysFamily[];
@@ -7592,5 +8053,5 @@ export declare const PORTFOLIO_SETS: Readonly<Record<`${PortfolioRule}|${Portfol
7592
8053
  * The default stretch order is `sifting`, the best order of the screen. The option `stretchOrder` selects `consensus` or `periphery`.
7593
8054
  */
7594
8055
  export declare const sharedStretchStrategy: Strategy<"router", RouterPreset<SharedOptions>>;
7595
- export { type AdvectionSettings, type AmbiguityGuardOptions, type ArcOptions, type ArcSource, type AreaOptions, type AreaWidth, type AttractionOptions, type Biclique, type BreakEvenOptions, type BundleLine, type BundleOrder, type CandidateSource, type CellStep, type ClothoidOptions, type ConfluentOptions, type ConsensusLinkage, type ConsensusOptions, type CornersOptions, type CorpusDimension, type CorpusFamily, type CorridorOptions, type Crossbar, type CrossbarOptions, type CubuOptions, type CurveSpace, type CutObjective, type CutOptions, DEFAULT_RNG, type DensityGrid, type DensityImage, type DensityKernel, type DensitySource, type DiffusionOptions, type DimensionValues, type DividedOptions, type EdgeDistance, type EdgeEnds, type EdgeGroup, type EdgeLengths, type EdgePathOptions, type EdgePlugs, type ExerciseEvidence, type FamilyRegistry, type FdebOptions, type FieldEnd, type FlowClusterOptions, type FlowFieldOptions, type FollowOptions, type FrameOptions, type FrechetBundle, type FrechetOptions, type FreeLine, type GapOptions, type Gate, type GenerateContext, type GroupScope, type GroupSpine, type GroupedOptions, type GrowthOptions, type GrowthOrder, type HashOptions, type HdbscanOptions, type HierarchyGroups, type HierarchyOptions, type Highway, type HighwayBase, type HighwayInput, type HighwayMember, type HighwayOptions, type HighwayPlan, type HoughOptions, type HoughPeak, type HubAllocation, type HubArcOptions, type HubCandidates, type HysteresisOptions, type Interchange, type InterchangeBase, type InterchangeOptions, type JogStyle, type KdAxis, type KdLine, type KdOptions, type KdeebOptions, type KeyOptions, type KeyedWay, type KeysOptions, type LaneCurve, type LanesOptions, type LevelHighwayOptions, type LinkCommunityOptions, type LinkEdge, type Linkage, type MeetOptions, type Member, type MemberStatus, type MemberTrace, type MeshOptions, type MingleOptions, type MlsFit, type MlsebOptions, type ModuleRule, type NestedOptions, type NodeKey, type NodeLinks, type OdCellOptions, type OutputGroup, type Outside, type PHubOptions, type ParamValue, type PathStep, type PickSpec, type Portfolio, type PortfolioKey, type PortfolioLevel, type PortfolioOptions, type PortfolioPick, type PortfolioTrace, type PowerOptions, type QuickBundlesOptions, RECORD_EPS, type ResistanceOptions, type Ridge, type RidgeOptions, type RidgeSource, type RoadClassOptions, type RoomBends, type RoundedOptions, type RouteCrossing, type RouteSegment, type SbebOptions, type ScaleCluster, type ScaleSpaceOptions, type SearchMove, type SearchOptions, type SectionsOptions, type SelectCandidate, type SelectLevel, type SelectOptions, type Selection, type ShapeSkeleton, type ShareCost, type ShareMerge, type ShareOrder, type SharedNegotiation, type SharedOptions, type SharedStretchOptions, type SharedWaysOptions, type SkeletonGroups, type SkeletonTarget, type SmoothOptions, type SnapLine, type SnapMember, type SnapOptions, type SoftKeyOptions, type SpectralOptions, type SpiralNode, type SpiralOptions, type SplineOptions, type SplitCell, type StableIdOptions, type SteinerGroup, type SteinerMethod, type SteinerMetric, type SteinerOptions, type StreetEdge, type StreetOptions, type StreetRide, type StreetSource, type StretchOptions, type StubEnds, type StubOptions, type TerritoryOptions, type TerritoryPoints, type TraceOptions, type TraclusOptions, type TrafficRule, type TrunkFan, type TrunkSplit, type TrunksOptions, type WeiszfeldOptions, type WspdOptions, type Zip, type ZipLimits, type ZipperOptions, canonicalJson, compareMeasure, createFamilyRegistry, dimensionAt, dimensionUnit, exercised, familyKind, levelsOf, minEffectOf, outputGroups, outputHash, paramProblem, pickMoves, portfolio, randomInt, selectBest, sha256Hex };
8056
+ export { type AdvectionSettings, type AmbiguityGuardOptions, type AnnealingOptions, type ArcOptions, type ArcSource, type AreaOptions, type AreaWidth, type AttractionOptions, type Biclique, type BreakEvenOptions, type BronchialOptions, type BronchialSplit, type BundleLine, type BundleOrder, type CandidateSource, type CellStep, type ClothoidOptions, type ConfluentOptions, type ConsensusLinkage, type ConsensusOptions, type CornersOptions, type CorpusDimension, type CorpusFamily, type CorridorOptions, type Crossbar, type CrossbarOptions, type CubuOptions, type CurveSpace, type CutObjective, type CutOptions, DEFAULT_RNG, type DensityGrid, type DensityImage, type DensityKernel, type DensitySource, type DiffusionOptions, type DimensionValues, type DividedOptions, type EdgeDistance, type EdgeEnds, type EdgeGroup, type EdgeLengths, type EdgePathOptions, type EdgePlugs, type ExerciseEvidence, type FamilyRegistry, type FdebOptions, type FieldEnd, type FlowClusterOptions, type FlowFieldOptions, type FollowOptions, type FrameOptions, type FrechetBundle, type FrechetOptions, type FreeLine, type GapOptions, type Gate, type GenerateContext, type GroupScope, type GroupSpine, type GroupedOptions, type GrowthOptions, type GrowthOrder, type GutterEdge, type GutterOptions, type HashOptions, type HdbscanOptions, type HierarchyGroups, type HierarchyOptions, type Highway, type HighwayBase, type HighwayInput, type HighwayMember, type HighwayOptions, type HighwayPlan, type HoughOptions, type HoughPeak, type HubAllocation, type HubArcOptions, type HubCandidates, type HysteresisOptions, type InnerMode, type Interchange, type InterchangeBase, type InterchangeOptions, type JogStyle, type KdAxis, type KdLine, type KdOptions, type KdeebOptions, type KeyOptions, type KeyedWay, type KeysOptions, type KneeOptions, type KneeRule, type KneeTree, type LaneCurve, type LanesOptions, type LevelHighwayOptions, type LinkCommunityOptions, type LinkEdge, type Linkage, type MeetOptions, type Member, type MemberStatus, type MemberTrace, type MeshOptions, type MingleOptions, type MlsFit, type MlsebOptions, type ModuleRule, type NestedOptions, type NodeKey, type NodeLinks, type OdCellOptions, type OutputGroup, type Outside, type PHubOptions, type ParamValue, type PathStep, type PickSpec, type Portfolio, type PortfolioKey, type PortfolioLevel, type PortfolioOptions, type PortfolioPick, type PortfolioTrace, type PowerOptions, type QuickBundlesOptions, RECORD_EPS, type ResistanceOptions, type Ridge, type RidgeOptions, type RidgeSource, type RoadClassOptions, type RoomBends, type RoundedOptions, type RouteCrossing, type RouteSegment, type SbebOptions, type ScaleCluster, type ScaleSpaceOptions, type SearchMove, type SearchOptions, type SectionsOptions, type SelectCandidate, type SelectLevel, type SelectOptions, type Selection, type ShapeSkeleton, type ShareCost, type ShareMerge, type ShareOrder, type SharedHooks, type SharedNegotiation, type SharedOptions, type SharedSearch, type SharedStretchOptions, type SharedWaysOptions, type SkeletonGroups, type SkeletonTarget, type SmoothOptions, type SnapLine, type SnapMember, type SnapOptions, type SoftKeyOptions, type SpectralOptions, type SpiralNode, type SpiralOptions, type SplineOptions, type SplitCell, type StableIdOptions, type SteinerGroup, type SteinerMethod, type SteinerMetric, type SteinerOptions, type StreetEdge, type StreetOptions, type StreetRide, type StreetSource, type StretchOptions, type StubEnds, type StubOptions, type TerritoryOptions, type TerritoryPoints, type TightFirst, type TightOptions, type TightTies, type TraceOptions, type TraclusOptions, type TrafficRule, type TrunkFan, type TrunkSplit, type TrunksOptions, type WeiszfeldOptions, type WspdOptions, type Zip, type ZipLimits, type ZipperOptions, canonicalJson, compareMeasure, createFamilyRegistry, dimensionAt, dimensionUnit, exercised, familyKind, levelsOf, minEffectOf, outputGroups, outputHash, paramProblem, pickMoves, portfolio, randomInt, selectBest, sha256Hex };
7596
8057
  //# sourceMappingURL=index.d.ts.map