@mark1russell7/highways 0.9.4 → 0.9.5
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/README.md +38 -7
- package/build/index.d.ts +549 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4965 -2175
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/bench/screen/exercise.ts +2 -1
- package/src/highways/balance/index.ts +93 -0
- package/src/highways/index.ts +3 -0
- package/src/highways/manifolds/index.ts +157 -0
- package/src/highways/slots/index.ts +178 -0
- package/src/index.ts +6 -0
- package/src/levels/detail/index.ts +140 -0
- package/src/plugs/leaders/index.ts +42 -0
- package/src/plugs/spread/index.ts +39 -5
- package/src/routers/adam/index.ts +294 -0
- package/src/routers/canals/index.ts +191 -0
- package/src/routers/index.ts +3 -0
- package/src/routers/reroute/index.ts +164 -0
- package/src/routers/shared.ts +3 -0
- package/src/strategies/builtins.ts +102 -1
- package/src/strategies/schemas.ts +89 -0
- package/src/whole/curriculum/index.ts +243 -0
- package/src/whole/fireflies/index.ts +177 -0
- package/src/whole/preferences/index.ts +247 -0
- package/src/whole/tracing/index.ts +144 -0
package/build/index.d.ts
CHANGED
|
@@ -1914,6 +1914,8 @@ interface SharedSearch {
|
|
|
1914
1914
|
seq: Point[];
|
|
1915
1915
|
ids: number[];
|
|
1916
1916
|
} | undefined;
|
|
1917
|
+
/** This function gives the free space across the link from corner `i` to corner `j` (`channelWidth`). The router keeps each width that it finds. */
|
|
1918
|
+
width(i: number, j: number): number;
|
|
1917
1919
|
}
|
|
1918
1920
|
/**
|
|
1919
1921
|
* The hooks of a router that `shared` runs (WILD-023, RULE-021). The router `shared` itself has no hooks.
|
|
@@ -1983,6 +1985,147 @@ export declare function annealingRouter(options: Partial<AnnealingOptions> & {
|
|
|
1983
1985
|
* A screen module or a consumer adds it to a registry.
|
|
1984
1986
|
*/
|
|
1985
1987
|
export declare const annealingStrategy: Strategy<"router", AnnealingOptions>;
|
|
1988
|
+
/** The options of the router `canals` (NAT-004: canalization feeder trees to hubs). */
|
|
1989
|
+
interface CanalOptions {
|
|
1990
|
+
/** The exponent `mu` of the flux in the growth of a conductance, from 1 to 3 in steps of 0.5. A value above 1 gives a tree. The default is 2. */
|
|
1991
|
+
readonly mu: number;
|
|
1992
|
+
/** The largest number of updates of the conductances, from 30 to 150. The updates stop when the ways do not change for 3 updates. The default is 60. */
|
|
1993
|
+
readonly steps: number;
|
|
1994
|
+
/** The decay `r` of a conductance, from 0.5 to 2. The default is 1. */
|
|
1995
|
+
readonly decay: number;
|
|
1996
|
+
/** A hub has this number of edges of one key or more, from 2 to 8. The default is 3. */
|
|
1997
|
+
readonly minMembers: number;
|
|
1998
|
+
}
|
|
1999
|
+
/** The default options of the router `canals`. */
|
|
2000
|
+
export declare const CANAL_DEFAULTS: Readonly<CanalOptions>;
|
|
2001
|
+
/** The declarations of the options of the router `canals` (NAT-004). */
|
|
2002
|
+
export declare const CANAL_SCHEMA: OptionSchema<CanalOptions>;
|
|
2003
|
+
/**
|
|
2004
|
+
* This function gives `x^mu` for `x` from 0 to 1 and `mu` in steps of 0.5, with only `*` and `Math.sqrt`.
|
|
2005
|
+
* These operations are exact to the last bit on each platform, so a decision does not depend on the engine.
|
|
2006
|
+
*/
|
|
2007
|
+
export declare function halfPower(x: number, mu: number): number;
|
|
2008
|
+
/** A hub: a node, the key of its edges, and the ways of those edges. */
|
|
2009
|
+
interface CanalHub {
|
|
2010
|
+
readonly node: string;
|
|
2011
|
+
readonly key: string;
|
|
2012
|
+
readonly ways: readonly Way[];
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* This function gives the hubs of the ways. In each key, the node with the most ends is a hub when it has `minMembers` edges or more.
|
|
2016
|
+
* Its edges leave the key, and the next hub of the key comes from the edges that stay. A tie goes to the smaller node id.
|
|
2017
|
+
* An edge with no key is in no hub.
|
|
2018
|
+
*/
|
|
2019
|
+
export declare function canalHubs(ways: readonly Way[], minMembers: number): CanalHub[];
|
|
2020
|
+
/**
|
|
2021
|
+
* This function grows a feeder tree to each hub (NAT-004, after the canalization of Sachs 1981 and Mitchison 1980).
|
|
2022
|
+
* Each member edge is a source of one unit of flux, and the hub is the sink. The flux of a link is the share of the members whose ways use it.
|
|
2023
|
+
* At each update, each conductance changes by `DT × (flux^mu - decay × D)`, and each member finds its way again with the cost `d / (1 + GAIN × D)`.
|
|
2024
|
+
* A link that another way of the key uses costs half, as in `shared`.
|
|
2025
|
+
* With `mu` above 1, a link with more flux grows faster, so the ways gather into one tree. The updates stop after `steps`, or when no way changes for 3 updates.
|
|
2026
|
+
*/
|
|
2027
|
+
export declare function canalWays(ways: readonly Way[], search: SharedSearch, options?: Partial<CanalOptions>): void;
|
|
2028
|
+
/**
|
|
2029
|
+
* This function makes the router `canals` (NAT-004). It is the router `shared`, then the feeder trees of `canalWays` to the hubs of each key.
|
|
2030
|
+
* The runs and the bundles come from the ways after the trees.
|
|
2031
|
+
*/
|
|
2032
|
+
export declare function canalRouter(options: Partial<CanalOptions> & {
|
|
2033
|
+
readonly name: string;
|
|
2034
|
+
readonly rule?: GroupRule;
|
|
2035
|
+
readonly maxNodes?: number;
|
|
2036
|
+
}): Router;
|
|
2037
|
+
/**
|
|
2038
|
+
* The router strategy `canals` (NAT-004), with the rule `byCollection` of `shared`. It is not a built-in router, so the benchmark and the hashes of `ROUTERS` do not change.
|
|
2039
|
+
* A screen module or a consumer adds it to a registry.
|
|
2040
|
+
*/
|
|
2041
|
+
export declare const canalStrategy: Strategy<"router", CanalOptions>;
|
|
2042
|
+
/** The options of the router `adam` (RULE-020: Adam with a seeded sample of pairs). */
|
|
2043
|
+
interface AdamOptions {
|
|
2044
|
+
/** The first step size `eta0`, in units of `clearance`, from 0.01 to 1. The step size falls to a tenth of it at the last step. The default is 0.1. */
|
|
2045
|
+
readonly eta: number;
|
|
2046
|
+
/** The number of other legs that each leg samples at each step, from 4 to 32. The default is 8. */
|
|
2047
|
+
readonly samples: number;
|
|
2048
|
+
/** The number of steps: the budget of the search, from 100 to 2000. The default is 200. */
|
|
2049
|
+
readonly steps: number;
|
|
2050
|
+
/** The seed of the samples, a whole number from 0. The same seed gives the same routes. The default is 1. */
|
|
2051
|
+
readonly seed: number;
|
|
2052
|
+
/** A leg nearer than this distance to another leg or to a box gets a push, from 4 to 32. The default is 8. */
|
|
2053
|
+
readonly clearance: number;
|
|
2054
|
+
}
|
|
2055
|
+
/** The default options of the router `adam`. */
|
|
2056
|
+
export declare const ADAM_DEFAULTS: Readonly<AdamOptions>;
|
|
2057
|
+
/** The declarations of the options of the router `adam` (RULE-020). */
|
|
2058
|
+
export declare const ADAM_SCHEMA: OptionSchema<AdamOptions>;
|
|
2059
|
+
/**
|
|
2060
|
+
* This function moves the free legs of the routes of `result` with Adam (RULE-020, after Kingma and Ba 2015, and the SGD layouts of Zheng, Pawar and Goodman 2019).
|
|
2061
|
+
* A leg is free when its two points are inside its route, and no other route, run or trunk holds them. The variable of a leg is a shift along its normal.
|
|
2062
|
+
* The energy of a leg is `Σ (1 - d / c)²` over a seeded sample of `samples` other legs nearer than `c`. The near boxes add the same term times 4.
|
|
2063
|
+
* A term `0.05 × (t / c)²` holds each leg near its first place. The step size falls from `eta` to a tenth of it, with only `+`, `*` and `/`.
|
|
2064
|
+
* A moved route goes back to its first points when it has more crossings than before, or a break of a hard rule.
|
|
2065
|
+
* When the output still has more crossings than the routes of `shared`, it is the routes of `shared`.
|
|
2066
|
+
*/
|
|
2067
|
+
export declare function adamRoutes(input: Graph, result: Result, options?: Partial<AdamOptions>): Result;
|
|
2068
|
+
/**
|
|
2069
|
+
* This function makes the router `adam` (RULE-020). It is the router `shared`, then the steps of Adam of `adamRoutes`.
|
|
2070
|
+
* The runs and the bundles of `shared` stay, because no point of a run or of a trunk moves.
|
|
2071
|
+
*/
|
|
2072
|
+
export declare function adamRouter(options: Partial<AdamOptions> & {
|
|
2073
|
+
readonly name: string;
|
|
2074
|
+
readonly rule?: GroupRule;
|
|
2075
|
+
readonly maxNodes?: number;
|
|
2076
|
+
}): Router;
|
|
2077
|
+
/**
|
|
2078
|
+
* The router strategy `adam` (RULE-020), with the rule `byCollection` of `shared`. It is not a built-in router, so the benchmark and the hashes of `ROUTERS` do not change.
|
|
2079
|
+
* A screen module or a consumer adds it to a registry.
|
|
2080
|
+
*/
|
|
2081
|
+
export declare const adamStrategy: Strategy<"router", AdamOptions>;
|
|
2082
|
+
/** The options of the router `reroute` (RULE-044: a corner graph with the prices of the rules, and rounds of rip-up and reroute). */
|
|
2083
|
+
interface RerouteOptions {
|
|
2084
|
+
/** The price of a link in a narrow channel, from 0 to 2. The default is 1. */
|
|
2085
|
+
readonly alpha: number;
|
|
2086
|
+
/** The price of each edge of another key on a link, from 0 to 2. The default is 0.5. */
|
|
2087
|
+
readonly beta: number;
|
|
2088
|
+
/** The discount of a link that an edge of the same key uses, from 0 to 2. The default is 0.5. */
|
|
2089
|
+
readonly gamma: number;
|
|
2090
|
+
/** The price of a turn, in units of `clearance`, from 0 to 2. The default is 0.25. */
|
|
2091
|
+
readonly tau: number;
|
|
2092
|
+
/** The number of rounds of rip-up and reroute, from 1 to 5. The default is 2. */
|
|
2093
|
+
readonly rounds: number;
|
|
2094
|
+
/** The share of the edges that each round rips up: the edges with the largest price over their direct length, from 0.05 to 0.3. The default is 0.15. */
|
|
2095
|
+
readonly q: number;
|
|
2096
|
+
/** A channel narrower than this width gets the price `alpha`, from 4 to 64. The default is 16. */
|
|
2097
|
+
readonly clearance: number;
|
|
2098
|
+
}
|
|
2099
|
+
/** The default options of the router `reroute`. */
|
|
2100
|
+
export declare const REROUTE_DEFAULTS: Readonly<RerouteOptions>;
|
|
2101
|
+
/** The declarations of the options of the router `reroute` (RULE-044). */
|
|
2102
|
+
export declare const REROUTE_SCHEMA: OptionSchema<RerouteOptions>;
|
|
2103
|
+
/** This function gives the number of turns of a way: the points where the direction changes by more than 1 degree. */
|
|
2104
|
+
export declare function turnsOf(seq: readonly Point[]): number;
|
|
2105
|
+
/**
|
|
2106
|
+
* This function rips up and reroutes the ways of `shared` (RULE-044, after the rip-up and reroute of PathFinder, McMurchie 1995).
|
|
2107
|
+
* The price factor of a link is `max(0.05, 1 + alpha × narrow + beta × others - gamma × same)`.
|
|
2108
|
+
* `narrow` is `max(0, 1 - width / clearance)`. `others` counts the edges of the other keys on the link.
|
|
2109
|
+
* `same` is 1 when an edge of the same key uses the link.
|
|
2110
|
+
* The price of a way is the sum of the price factor times the length of each link, plus `tau × clearance` for each turn.
|
|
2111
|
+
* Each round takes the share `q` of the ways with the largest price over their direct length. Each one gets a new search with the prices of the links.
|
|
2112
|
+
* The new way stays only when its price is lower. The search has no state for the turns, so only the comparison reads `tau`.
|
|
2113
|
+
*/
|
|
2114
|
+
export declare function rerouteWays(ways: readonly Way[], search: SharedSearch, options?: Partial<RerouteOptions>): void;
|
|
2115
|
+
/**
|
|
2116
|
+
* This function makes the router `reroute` (RULE-044). It is the router `shared`, then the rounds of rip-up and reroute of `rerouteWays`.
|
|
2117
|
+
* The runs and the bundles come from the ways after the rounds.
|
|
2118
|
+
*/
|
|
2119
|
+
export declare function rerouteRouter(options: Partial<RerouteOptions> & {
|
|
2120
|
+
readonly name: string;
|
|
2121
|
+
readonly rule?: GroupRule;
|
|
2122
|
+
readonly maxNodes?: number;
|
|
2123
|
+
}): Router;
|
|
2124
|
+
/**
|
|
2125
|
+
* The router strategy `reroute` (RULE-044), with the rule `byCollection` of `shared`. It is not a built-in router, so the benchmark and the hashes of `ROUTERS` do not change.
|
|
2126
|
+
* A screen module or a consumer adds it to a registry.
|
|
2127
|
+
*/
|
|
2128
|
+
export declare const rerouteStrategy: Strategy<"router", RerouteOptions>;
|
|
1986
2129
|
/** The edges that go first: the edges with few good ways (`tight`), or the edges with many good ways (`loose`). */
|
|
1987
2130
|
type TightFirst = "tight" | "loose";
|
|
1988
2131
|
/** The values of `TightFirst`. */
|
|
@@ -2275,6 +2418,44 @@ export declare const SPREAD_DEFAULTS: Required<SpreadOptions>;
|
|
|
2275
2418
|
* The output has one entry for each edge with two known nodes, in the order of the edges.
|
|
2276
2419
|
*/
|
|
2277
2420
|
export declare function spreadEnds(input: PlugInput, options?: SpreadOptions): PlugPair[];
|
|
2421
|
+
/**
|
|
2422
|
+
* The order and the places of the plugs of one wall in the strategy `leaders` (EDA-041).
|
|
2423
|
+
* With `po`, the sort key of a far end in front of the wall is its place on the axis along the wall.
|
|
2424
|
+
* With `opo`, the plugs of a wall go at even places in the order of the keys of `spread`.
|
|
2425
|
+
*/
|
|
2426
|
+
export type WallLeader = "po" | "opo";
|
|
2427
|
+
/**
|
|
2428
|
+
* This function does the work of `spreadEnds`, and of the strategy `leaders` with the argument `leader`.
|
|
2429
|
+
* Without `leader`, it gives the plugs of `spread`.
|
|
2430
|
+
*/
|
|
2431
|
+
export declare function spreadWith(input: PlugInput, options?: SpreadOptions, leader?: WallLeader): PlugPair[];
|
|
2432
|
+
/**
|
|
2433
|
+
* The type of leader of a plug. With `s`, the order of a wall is the order of the angles of the far ends, as in `spread`.
|
|
2434
|
+
* With `po`, the stub leaves along the normal and turns once, so the order is the order of the far ends along the wall.
|
|
2435
|
+
* With `opo`, the plugs of a wall go at even places, in the order of the angles.
|
|
2436
|
+
*/
|
|
2437
|
+
export type LeaderType = "s" | "po" | "opo";
|
|
2438
|
+
/** The values of `LeaderType`. */
|
|
2439
|
+
export declare const LEADER_TYPES: readonly LeaderType[];
|
|
2440
|
+
/** The options of the plug strategy `leaders`. */
|
|
2441
|
+
export interface LeaderOptions {
|
|
2442
|
+
/** The type of leader. The default is `po`. */
|
|
2443
|
+
readonly leader: LeaderType;
|
|
2444
|
+
/** The least gap between two plugs of one wall, from 2 to 8. The default is 8. */
|
|
2445
|
+
readonly slotSpacing: number;
|
|
2446
|
+
/** 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. */
|
|
2447
|
+
readonly inset: number;
|
|
2448
|
+
/** The number of passes that sort each wall again by the new places of the far ends, from 0 to 4. The default is 2. */
|
|
2449
|
+
readonly rounds: number;
|
|
2450
|
+
}
|
|
2451
|
+
/** The defaults of the plug strategy `leaders`. */
|
|
2452
|
+
export declare const LEADER_DEFAULTS: Readonly<LeaderOptions>;
|
|
2453
|
+
/**
|
|
2454
|
+
* This function gives the plugs of the plug strategy `leaders` (EDA-041, after Bekos 2007). A fixed plug stays at its point, and a plug with a side stays on that side.
|
|
2455
|
+
* Each free plug goes on the side that faces the other end. The plugs of each wall keep at least `slotSpacing` between two of them.
|
|
2456
|
+
* The type of leader sets their order and their places. The output has one entry for each edge with two known nodes, in the order of the edges.
|
|
2457
|
+
*/
|
|
2458
|
+
export declare function leaderEnds(input: PlugInput, options?: Partial<LeaderOptions>): PlugPair[];
|
|
2278
2459
|
/** The options of `fixPorts`. */
|
|
2279
2460
|
export interface FixPortsOptions {
|
|
2280
2461
|
/** The options of the plug rule. The rule gets its `defaults` for each option that this object does not give. */
|
|
@@ -2398,6 +2579,40 @@ export declare function venationLinks(items: readonly LevelItem[], direct: reado
|
|
|
2398
2579
|
* In each level with groups, the links take their ways along a closed venation backbone (`venationLinks`). The last level stays as in `depths`.
|
|
2399
2580
|
*/
|
|
2400
2581
|
export declare function venationLevels(input: LevelInput, options: Readonly<VenationOptions>): Level[];
|
|
2582
|
+
/** The growth of the width of a stroke with the number of its edges. */
|
|
2583
|
+
export type WidthScale = "linear" | "sqrt" | "log";
|
|
2584
|
+
/** The values of `WidthScale`. */
|
|
2585
|
+
export declare const WIDTH_SCALES: readonly WidthScale[];
|
|
2586
|
+
/** The options of the level strategy `detail`: the options of `depths`, and the limits of the collapse. */
|
|
2587
|
+
export interface DetailOptions extends DepthLevelOptions {
|
|
2588
|
+
/** Two parallel legs closer than this number of pixels on the screen become one stroke, from 0.5 to 4. The default is 3. */
|
|
2589
|
+
readonly pxMin: number;
|
|
2590
|
+
/** A stroke holds this number of edges or more, from 2 to 5. The default is 2. */
|
|
2591
|
+
readonly minCount: number;
|
|
2592
|
+
/** The width of a stroke of one edge, in pixels, from 1 to 4. The default is 1.5. A renderer reads it with `detailWidth`. */
|
|
2593
|
+
readonly w0: number;
|
|
2594
|
+
/** The growth of the width of a stroke with its count. The default is `log`. */
|
|
2595
|
+
readonly widthScale: WidthScale;
|
|
2596
|
+
}
|
|
2597
|
+
/** The default options of the level strategy `detail`. */
|
|
2598
|
+
export declare const DETAIL_DEFAULTS: Readonly<DetailOptions>;
|
|
2599
|
+
/**
|
|
2600
|
+
* This function gives the width of a stroke of `count` edges, in pixels (WILD-016). With `log`, it is `w0 × (1 + log2(count))`.
|
|
2601
|
+
* With `sqrt`, it is `w0 × sqrt(count)`. With `linear`, it is `w0 × count`.
|
|
2602
|
+
*/
|
|
2603
|
+
export declare function detailWidth(count: number, o?: Pick<DetailOptions, "w0" | "widthScale">): number;
|
|
2604
|
+
/**
|
|
2605
|
+
* This function collapses the legs of the links of one level that are closer than `tol` (WILD-016, EDA-038).
|
|
2606
|
+
* The legs of each axis go in clusters along the axis across it. The leg with the largest count of a cluster is its stroke, and each other leg moves onto it.
|
|
2607
|
+
* A cluster needs two legs whose projections overlap, and a count of `minCount` or more. A move that puts a leg through the box of an item does not happen.
|
|
2608
|
+
*/
|
|
2609
|
+
export declare function collapseLinks(items: readonly LevelItem[], links: readonly LevelLink[], tol: number, minCount: number): LevelLink[];
|
|
2610
|
+
/**
|
|
2611
|
+
* This function gives the zoom levels of the level strategy `detail` (WILD-016 with EDA-038). The levels and their items are the levels of `depths`.
|
|
2612
|
+
* A level with groups first shows at the scale `itemAt / size`, with `size` its median item (`pickLevel`). At that scale, `pxMin` pixels are `pxMin × size / itemAt` units.
|
|
2613
|
+
* The links of the level collapse their legs that are closer than that length (`collapseLinks`). The last level stays as in `depths`.
|
|
2614
|
+
*/
|
|
2615
|
+
export declare function detailLevels(input: LevelInput, options: Readonly<DetailOptions>): Level[];
|
|
2401
2616
|
/** One setting of the portfolio: a name and the options of the pipeline. */
|
|
2402
2617
|
export interface PortfolioSetting {
|
|
2403
2618
|
readonly name: string;
|
|
@@ -2444,6 +2659,226 @@ export declare function rankShares(values: readonly number[], lowerIsBetter: boo
|
|
|
2444
2659
|
* 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
2660
|
*/
|
|
2446
2661
|
export declare function boardPortfolio(graph: Graph, list: readonly PortfolioSetting[], o: Readonly<BoardPortfolioOptions>, now?: () => number): BoardPortfolioRun;
|
|
2662
|
+
/** One rule of the curriculum: the crossings (R1), the lane separation (R12) or the crossing angle (R2). */
|
|
2663
|
+
export type CurriculumRule = "R1" | "R12" | "R2";
|
|
2664
|
+
/** The order in which the curriculum adds its rules. */
|
|
2665
|
+
export type CurriculumOrder = "R1-R12-R2" | "R12-R1-R2" | "R1-R2-R12";
|
|
2666
|
+
/** The values of `CurriculumOrder`. */
|
|
2667
|
+
export declare const CURRICULUM_ORDERS: readonly CurriculumOrder[];
|
|
2668
|
+
/** The options of the whole strategy `curriculum` (RULE-048). */
|
|
2669
|
+
export interface CurriculumOptions {
|
|
2670
|
+
/** The order in which the stages add the rules. The default is `R1-R12-R2`. */
|
|
2671
|
+
readonly order: CurriculumOrder;
|
|
2672
|
+
/** The number of passes over the edges in each stage, from 1 to 3. The default is 1. */
|
|
2673
|
+
readonly passes: number;
|
|
2674
|
+
/** The number of settings in the pool of routes, from the start of its list, from 2 to 3. The default is 3. */
|
|
2675
|
+
readonly settings: number;
|
|
2676
|
+
/** A new route has a detour of at most this value, or of its old route, from 1.5 to 4. The default is 2. */
|
|
2677
|
+
readonly detour: number;
|
|
2678
|
+
}
|
|
2679
|
+
/** The default options of the strategy `curriculum`. */
|
|
2680
|
+
export declare const CURRICULUM_DEFAULTS: Readonly<CurriculumOptions>;
|
|
2681
|
+
/**
|
|
2682
|
+
* This function gives the arc sine of `x` in radians, from -1 to 1. It is the algorithm of fdlibm, with only `+`, `*`, `/` and `Math.sqrt`.
|
|
2683
|
+
* These operations are exact to the last bit on each platform, so the result does not depend on the engine.
|
|
2684
|
+
*/
|
|
2685
|
+
export declare function arcsin(x: number): number;
|
|
2686
|
+
/**
|
|
2687
|
+
* This function gives the costs of the rules between two routes. R1 is the number of crossings.
|
|
2688
|
+
* R2 is the sum of `1 - θ / 90` over the crossings. θ is the crossing angle in degrees.
|
|
2689
|
+
* R12 is the overlap of the legs of `a` and `b` that are within 5 degrees of parallel. The two legs are nearer than 4 units.
|
|
2690
|
+
*/
|
|
2691
|
+
export declare function pairCosts(a: readonly Point[], b: readonly Point[]): Record<CurriculumRule, number>;
|
|
2692
|
+
/**
|
|
2693
|
+
* This function runs the whole strategy `curriculum` (RULE-048, after curriculum learning, Bengio 2009). The record has no energy solver yet (RULE-019).
|
|
2694
|
+
* Thus a pool of routes of fixed settings takes its place. Each edge can take its route from any setting of the pool.
|
|
2695
|
+
* The first answer is the first setting. Each stage adds one rule, in the order `order`. A pass of a stage visits the edges, the worst first.
|
|
2696
|
+
* An edge takes the route of the pool with the least cost of the new rule. That cost is lower, and the earlier rules do not get worse.
|
|
2697
|
+
* A route with a break of a hard rule is not in the pool. The output has the routes alone, with no runs, bundles or levels.
|
|
2698
|
+
*/
|
|
2699
|
+
export declare function curriculum(graph: Graph, list: readonly PortfolioSetting[], options?: Partial<CurriculumOptions>): WholeOutput;
|
|
2700
|
+
/** The features of one route, in order: crossings (R1), angle cost (R2), lane overlap (R12) over 20, detour minus 1 (R5), and bends over 2. */
|
|
2701
|
+
export declare const PREFERENCE_FEATURES: readonly string[];
|
|
2702
|
+
/**
|
|
2703
|
+
* The weights of the made-up panel that labels the made-up pairs, in the order of `PREFERENCE_FEATURES`.
|
|
2704
|
+
* The order comes from the studies of the readers of graphs: the crossings count most, then the bends and the length, then the angle (Purchase 1997, Ware, Purchase, Colpoys and McGill 2002).
|
|
2705
|
+
* The numbers are made up. They do not come from the screen or from a board.
|
|
2706
|
+
*/
|
|
2707
|
+
export declare const PREFERENCE_PANEL: readonly number[];
|
|
2708
|
+
/** The options of the fit of the preferences. */
|
|
2709
|
+
export interface PreferenceFit {
|
|
2710
|
+
/** The weight of the L2 term of the fit, from 0 to 1. The default is 0.01. */
|
|
2711
|
+
readonly l2: number;
|
|
2712
|
+
/** The seed of the made-up pairs. The default is 1. */
|
|
2713
|
+
readonly seed: number;
|
|
2714
|
+
/** The number of made-up pairs, from 50 to 1000. The default is 200. */
|
|
2715
|
+
readonly pairs: number;
|
|
2716
|
+
}
|
|
2717
|
+
/** The options of the whole strategy `preferences` (RULE-038). */
|
|
2718
|
+
export interface PreferenceOptions {
|
|
2719
|
+
/** The weight of the L2 term of the fit, from 0 to 1. The default is 0.01. */
|
|
2720
|
+
readonly l2: number;
|
|
2721
|
+
/** The number of passes over the edges, from 1 to 3. The default is 1. */
|
|
2722
|
+
readonly passes: number;
|
|
2723
|
+
/** The number of settings in the pool of routes, from the start of its list, from 2 to 3. The default is 3. */
|
|
2724
|
+
readonly settings: number;
|
|
2725
|
+
/** A new route has a detour of at most this value, or of its old route, from 1.5 to 4. The default is 2. */
|
|
2726
|
+
readonly detour: number;
|
|
2727
|
+
}
|
|
2728
|
+
/** The default options of the strategy `preferences`. */
|
|
2729
|
+
export declare const PREFERENCE_DEFAULTS: Readonly<PreferenceOptions>;
|
|
2730
|
+
/** One made-up pair: the features of two routes, and 1 when the panel prefers the first one. */
|
|
2731
|
+
export interface PreferencePair {
|
|
2732
|
+
readonly a: readonly number[];
|
|
2733
|
+
readonly b: readonly number[];
|
|
2734
|
+
readonly first: 0 | 1;
|
|
2735
|
+
}
|
|
2736
|
+
/** The result of the fit: the weights, the agreement with held-out pairs, and the source of the pairs. */
|
|
2737
|
+
export interface PreferenceModel {
|
|
2738
|
+
readonly weights: readonly number[];
|
|
2739
|
+
/** The share of 50 held-out made-up pairs where the weights agree with the panel. */
|
|
2740
|
+
readonly agreement: number;
|
|
2741
|
+
readonly source: string;
|
|
2742
|
+
}
|
|
2743
|
+
/**
|
|
2744
|
+
* This function gives a smooth step from 0 to 1, a stand-in for the logistic function with only `+`, `*`, `/` and `Math.abs`.
|
|
2745
|
+
* It is `0.5 + 0.5 z / (1 + |z|)`. These operations are exact to the last bit on each platform.
|
|
2746
|
+
*/
|
|
2747
|
+
export declare function softStep(z: number): number;
|
|
2748
|
+
/**
|
|
2749
|
+
* This function gives `count` made-up pairs, with the labels of the made-up panel `PREFERENCE_PANEL` and a noise.
|
|
2750
|
+
* The pairs come from the seed alone. They do not come from a board.
|
|
2751
|
+
*/
|
|
2752
|
+
export declare function madeUpPairs(count: number, seed: number): PreferencePair[];
|
|
2753
|
+
/** This function gives the share of the pairs where the weights `w` prefer the same route as the panel. */
|
|
2754
|
+
export declare function agreementOf(w: readonly number[], pairs: readonly PreferencePair[]): number;
|
|
2755
|
+
/**
|
|
2756
|
+
* This function fits the weights of the rules to made-up pairs (RULE-038, a Bradley-Terry model, after Bradley and Terry 1952).
|
|
2757
|
+
* The probability that a reader prefers `a` to `b` is `softStep(u(a) - u(b))`, with `u(x) = -w · f(x)`. The fit takes 400 steps of the gradient of the score.
|
|
2758
|
+
* An L2 term `l2 × |w|²` keeps the weights small. A weight below 0 becomes 0. The weights are scaled so that their sum is the number of features.
|
|
2759
|
+
* The held-out pairs come from the seed plus 7919. The pairs do not come from the screen or from a board.
|
|
2760
|
+
*/
|
|
2761
|
+
export declare function fitPreferences(options?: Partial<PreferenceFit>): PreferenceModel;
|
|
2762
|
+
/**
|
|
2763
|
+
* This function runs the whole strategy `preferences` (RULE-038). It fits the weights of the rules to made-up pairs (`fitPreferences`).
|
|
2764
|
+
* Each edge can take its route from any setting of the pool. The first answer is the first setting.
|
|
2765
|
+
* A pass visits the edges in order. An edge takes the route of the pool with the least weighted cost, when that cost is lower than the cost of its route.
|
|
2766
|
+
* The cost is the weighted sum of the features of the route against the routes of the other edges. A route with a break of a hard rule is not in the pool.
|
|
2767
|
+
* The output has the routes alone, with no runs, bundles or levels.
|
|
2768
|
+
*/
|
|
2769
|
+
export declare function preferences(graph: Graph, list: readonly PortfolioSetting[], options?: Partial<PreferenceOptions>): WholeOutput;
|
|
2770
|
+
/** The search of the whole strategy `fireflies`: the firefly algorithm, or the artificial bee colony. */
|
|
2771
|
+
export type SwarmSearch = "firefly" | "bees";
|
|
2772
|
+
/** The values of `SwarmSearch`. */
|
|
2773
|
+
export declare const SWARM_SEARCHES: readonly SwarmSearch[];
|
|
2774
|
+
/** The options of the whole strategy `fireflies` (NAT-047). */
|
|
2775
|
+
export interface FireflyOptions {
|
|
2776
|
+
/** The search. The default is `firefly`. */
|
|
2777
|
+
readonly search: SwarmSearch;
|
|
2778
|
+
/** The budget: the largest number of different settings that the search routes, from 4 to 40. The default is 12. */
|
|
2779
|
+
readonly budget: number;
|
|
2780
|
+
/** The number of fireflies or food sources, from 4 to 20. The default is 6. */
|
|
2781
|
+
readonly colony: number;
|
|
2782
|
+
/** The absorption `gamma` of the light of a firefly, from 0.01 to 10. The default is 1. */
|
|
2783
|
+
readonly gamma: number;
|
|
2784
|
+
/** The size `alpha` of the random step of a firefly, as a share of the range, from 0.01 to 0.5. The default is 0.2. */
|
|
2785
|
+
readonly alpha: number;
|
|
2786
|
+
/** The number of tries with no gain, after which a scout bee leaves a food source, from 10 to 100. The default is 10. */
|
|
2787
|
+
readonly limit: number;
|
|
2788
|
+
/** The seed of the search, a whole number from 0. The same seed gives the same routes. The default is 1. */
|
|
2789
|
+
readonly seed: number;
|
|
2790
|
+
}
|
|
2791
|
+
/** The default options of the strategy `fireflies`. */
|
|
2792
|
+
export declare const FIREFLY_DEFAULTS: Readonly<FireflyOptions>;
|
|
2793
|
+
/**
|
|
2794
|
+
* This function gives the attraction of a firefly at the distance `r`: `BETA0 / (1 + u + u² / 2)` with `u = gamma × r²`.
|
|
2795
|
+
* It is a rational stand-in for `BETA0 × exp(-u)`, with only `+`, `*` and `/`, so it is exact to the last bit on each platform.
|
|
2796
|
+
*/
|
|
2797
|
+
export declare function attraction(gamma: number, r2: number): number;
|
|
2798
|
+
/** One setting of the router `shared`: the option `discount` and the option `margin`. */
|
|
2799
|
+
export interface SwarmSetting {
|
|
2800
|
+
readonly discount: number;
|
|
2801
|
+
readonly margin: number;
|
|
2802
|
+
}
|
|
2803
|
+
/** This function gives the setting of a point of the unit square, on the grid of the search. */
|
|
2804
|
+
export declare function settingAt(x: number, y: number): SwarmSetting;
|
|
2805
|
+
/** One setting that the search routed: its score and its output. A setting with a break of a hard rule has the score `Infinity`. */
|
|
2806
|
+
export interface SwarmEntry {
|
|
2807
|
+
readonly setting: SwarmSetting;
|
|
2808
|
+
readonly score: number;
|
|
2809
|
+
readonly output: WholeOutput;
|
|
2810
|
+
}
|
|
2811
|
+
/** The result of `fireflies`: the output, the best setting and each setting that the search routed, in order. */
|
|
2812
|
+
export interface SwarmRun {
|
|
2813
|
+
readonly output: WholeOutput;
|
|
2814
|
+
readonly best: SwarmSetting;
|
|
2815
|
+
readonly entries: readonly SwarmEntry[];
|
|
2816
|
+
}
|
|
2817
|
+
/**
|
|
2818
|
+
* This function gives the score of an output on its board. A lower score is better.
|
|
2819
|
+
* The score is `crossings / edges + (median detour - 1) - ink saved`. A break of a hard rule gives `Infinity`.
|
|
2820
|
+
*/
|
|
2821
|
+
export declare function swarmScore(output: WholeOutput): number;
|
|
2822
|
+
/**
|
|
2823
|
+
* This function runs the whole strategy `fireflies` (NAT-047, after the firefly algorithm of Yang 2008 and the bee colony of Karaboga 2005).
|
|
2824
|
+
* It searches the options `discount` and `margin` of the router `router` on the board, on a grid of 20 × 8 settings.
|
|
2825
|
+
* The first firefly or food source is the default setting, so the score of the output is not worse than the score of the default.
|
|
2826
|
+
* A firefly moves toward each brighter one by `attraction(gamma, r²)` of the distance, plus a seeded step of size `alpha`.
|
|
2827
|
+
* A bee tries `v = x + phi (x - x_k)` in one dimension, and a scout takes a new seeded place after `limit` tries with no gain.
|
|
2828
|
+
* The search stops after `budget` different settings, or after 60 rounds. It reads only the board and the outputs of its own settings.
|
|
2829
|
+
*/
|
|
2830
|
+
export declare function fireflies(graph: Graph, router: Strategy<"router">, options?: Partial<FireflyOptions>): SwarmRun;
|
|
2831
|
+
/** The value of the loads of the edges of a board that the pick reads: the median, the quantile 0.95 or the mean. */
|
|
2832
|
+
export type TracingQuantile = "q50" | "q95" | "mean";
|
|
2833
|
+
/** The values of `TracingQuantile`. */
|
|
2834
|
+
export declare const TRACING_QUANTILES: readonly TracingQuantile[];
|
|
2835
|
+
/** The weights of the places to choose on the way of one edge (WILD-057). */
|
|
2836
|
+
export interface TracingWeights {
|
|
2837
|
+
/** The weight of a crossing, from 0 to 4. The default is 1. */
|
|
2838
|
+
readonly crossing: number;
|
|
2839
|
+
/** The weight of a merge or a split where the edge is not an outer lane, from 0 to 4. The default is 2. */
|
|
2840
|
+
readonly merge: number;
|
|
2841
|
+
/** The weight of a bend, from 0 to 4. The default is 0.5. */
|
|
2842
|
+
readonly bend: number;
|
|
2843
|
+
}
|
|
2844
|
+
/** The default weights of the tracing load, as the record gives them. */
|
|
2845
|
+
export declare const TRACING_WEIGHTS: Readonly<TracingWeights>;
|
|
2846
|
+
/** The options of the whole strategy `tracing` (WILD-057). */
|
|
2847
|
+
export interface TracingOptions extends TracingWeights {
|
|
2848
|
+
/** The number of settings that the strategy tries, from the start of its list, from 1 to 12. The default is 4. */
|
|
2849
|
+
readonly settings: number;
|
|
2850
|
+
/** The value of the loads that the pick reads. The default is `q95`. */
|
|
2851
|
+
readonly quantile: TracingQuantile;
|
|
2852
|
+
}
|
|
2853
|
+
/** The default options of the strategy `tracing`. */
|
|
2854
|
+
export declare const TRACING_DEFAULTS: Readonly<TracingOptions>;
|
|
2855
|
+
/**
|
|
2856
|
+
* This function gives the tracing load of each edge of a result (WILD-057, after the tracing tasks of Ware, Purchase, Colpoys and McGill 2002).
|
|
2857
|
+
* The load is `T(e) = crossing × crossings + merge × (merges and splits where e is not an outer lane) + bend × bends`.
|
|
2858
|
+
* A shared run where the edge is not an outer lane gives one merge and one split. Such a bundle gives one split.
|
|
2859
|
+
* A bend is a turn of more than 1 degree. The measure is W4 of MEAS3.
|
|
2860
|
+
*/
|
|
2861
|
+
export declare function tracingLoads(result: Result, weights?: Partial<TracingWeights>): Map<string, number>;
|
|
2862
|
+
/** This function gives a value of a list of loads: the median, the quantile 0.95 by the nearest rank, or the mean. An empty list gives 0. */
|
|
2863
|
+
export declare function tracingValue(loads: Iterable<number>, quantile: TracingQuantile): number;
|
|
2864
|
+
/** The tracing loads of one setting on the board: the value that the pick reads, and the median for a tie. */
|
|
2865
|
+
export interface TracingEntry {
|
|
2866
|
+
readonly name: string;
|
|
2867
|
+
readonly value: number;
|
|
2868
|
+
readonly median: number;
|
|
2869
|
+
}
|
|
2870
|
+
/** The result of `tracing`: the output, the name of the pick and the loads of each setting with no break of a hard rule. */
|
|
2871
|
+
export interface TracingRun {
|
|
2872
|
+
readonly output: WholeOutput;
|
|
2873
|
+
readonly pick: string;
|
|
2874
|
+
readonly entries: readonly TracingEntry[];
|
|
2875
|
+
}
|
|
2876
|
+
/**
|
|
2877
|
+
* This function runs the whole strategy `tracing` (WILD-057). It runs the first `settings` settings of `list` on the board.
|
|
2878
|
+
* A setting with a break of a hard rule, or above its node limit, does not count. The setting with the least tracing load wins.
|
|
2879
|
+
* A tie goes to the least median load, then to the earlier setting. It reads only the board and the outputs of its own settings.
|
|
2880
|
+
*/
|
|
2881
|
+
export declare function tracing(graph: Graph, list: readonly PortfolioSetting[], options?: Partial<TracingOptions>): TracingRun;
|
|
2447
2882
|
/** A broken hard rule. A correct router has none. */
|
|
2448
2883
|
export interface Violation {
|
|
2449
2884
|
readonly rule: "complete" | "ends-at-plugs" | "fixed-plugs" | "no-pass-through" | "counts-sum" | "link-ends" | "bundle-trunk" | "run-shared";
|
|
@@ -5517,6 +5952,58 @@ export declare function kneeOf(trees: readonly Pick<KneeTree, "ink" | "paths">[]
|
|
|
5517
5952
|
* The stretches of the tree that two edges or more share become highways.
|
|
5518
5953
|
*/
|
|
5519
5954
|
export declare function kneePlan(input: HighwayInput, o: Readonly<KneeOptions>): HighwayPlan;
|
|
5955
|
+
/** The end of a ride that the price moves: the exit, the entry, or both by half. */
|
|
5956
|
+
type BalanceEnd = "exit" | "entry" | "both";
|
|
5957
|
+
/** The values of `BalanceEnd`. */
|
|
5958
|
+
export declare const BALANCE_ENDS: readonly BalanceEnd[];
|
|
5959
|
+
/** The options of the highway strategy `balance` (EDA-017). */
|
|
5960
|
+
interface BalanceOptions {
|
|
5961
|
+
/** The target of the stretch of an edge: its route on the plan over its route alone, from 1.1 to 2. The default is 1.2. */
|
|
5962
|
+
readonly tau: number;
|
|
5963
|
+
/** The number of updates of the prices, from 5 to 30. The default is 5. */
|
|
5964
|
+
readonly iterations: number;
|
|
5965
|
+
/** The end of a ride that the price moves. The default is `exit`. */
|
|
5966
|
+
readonly end: BalanceEnd;
|
|
5967
|
+
/** The plan that the strategy balances. The default is `shared-ways`. */
|
|
5968
|
+
readonly from: HighwayBase;
|
|
5969
|
+
}
|
|
5970
|
+
/** The default options of the strategy `balance`. */
|
|
5971
|
+
export declare const BALANCE_DEFAULTS: Readonly<BalanceOptions>;
|
|
5972
|
+
/**
|
|
5973
|
+
* This function gives the plan of the highway strategy `balance` (EDA-017, after the Lagrange relaxation of the stretch).
|
|
5974
|
+
* The stretch of an edge is its route on the plan over its route alone, as the gate `stretch` measures it.
|
|
5975
|
+
* At each update, an edge with a stretch above `tau` adds `stretch - tau` to its price. Each of its rides keeps the share `1 - price` of its first length.
|
|
5976
|
+
* A ride shorter than the margin leaves the plan. The updates stop when no edge is above `tau`.
|
|
5977
|
+
*/
|
|
5978
|
+
export declare function balancePlan(input: HighwayInput, options?: Partial<BalanceOptions>): HighwayPlan;
|
|
5979
|
+
/** This function balances the plan `first` of the graph, as `balancePlan` does. It reads all the options except `from`. */
|
|
5980
|
+
export declare function balanceOf(graph: Graph, first: HighwayPlan, options?: Partial<BalanceOptions>): HighwayPlan;
|
|
5981
|
+
/** The place of the header in the gap before the row: near the row, or near the feed node. */
|
|
5982
|
+
type ManifoldSide = "near" | "far";
|
|
5983
|
+
/** The values of `ManifoldSide`. */
|
|
5984
|
+
export declare const MANIFOLD_SIDES: readonly ManifoldSide[];
|
|
5985
|
+
/** The options of the highway strategy `manifolds` (WILD-036). */
|
|
5986
|
+
interface ManifoldOptions {
|
|
5987
|
+
/** A manifold has this number of taps or more, from 3 to 8. The default is 3. */
|
|
5988
|
+
readonly kMin: number;
|
|
5989
|
+
/** The nodes of one row have centers in a band of this many median box heights, from 0.5 to 2. The default is 1. */
|
|
5990
|
+
readonly band: number;
|
|
5991
|
+
/** The place of the header in the gap before the row. The default is `near`. */
|
|
5992
|
+
readonly side: ManifoldSide;
|
|
5993
|
+
/** A tap stays on the manifold only when its way is this many times the direct line or less, from 1 to 3. The default is 1.5. */
|
|
5994
|
+
readonly detour: number;
|
|
5995
|
+
/** The plan of the edges that are not on a manifold. The default is `shared-ways`. */
|
|
5996
|
+
readonly from: HighwayBase;
|
|
5997
|
+
}
|
|
5998
|
+
/** The default options of the strategy `manifolds`. */
|
|
5999
|
+
export declare const MANIFOLD_DEFAULTS: Readonly<ManifoldOptions>;
|
|
6000
|
+
/**
|
|
6001
|
+
* This function gives the plan of the highway strategy `manifolds` (WILD-036, after the headers of pipes and of bus bars).
|
|
6002
|
+
* A fan of `kMin` edges or more from one node to a row of nodes gets a straight header in the gap before the row.
|
|
6003
|
+
* Each edge of the fan joins the header at the feed point, in line with the center of the node. It leaves the header at its tap, in line with the center of its far node.
|
|
6004
|
+
* A tap whose way is more than `detour` times the direct line leaves the manifold. Each edge is on one manifold at most. The other edges keep the plan `from`.
|
|
6005
|
+
*/
|
|
6006
|
+
export declare function manifoldPlan(input: HighwayInput, options?: Partial<ManifoldOptions>): HighwayPlan;
|
|
5520
6007
|
/** The rule that splits the targets of a tip in two: by count, by weight, or at the widest gap of the angles. */
|
|
5521
6008
|
type BronchialSplit = "count" | "weight" | "gap";
|
|
5522
6009
|
/** The values of `BronchialSplit`. */
|
|
@@ -6310,6 +6797,53 @@ interface SidePlugOptions {
|
|
|
6310
6797
|
/** The largest number of places that the search tries on each side. The default is 16. */
|
|
6311
6798
|
readonly most?: number;
|
|
6312
6799
|
}
|
|
6800
|
+
/** The edges that can join a trunk: only the edges with the key of the trunk, or each edge. */
|
|
6801
|
+
type SlotKeys = "same" | "any";
|
|
6802
|
+
/** The values of `SlotKeys`. */
|
|
6803
|
+
export declare const SLOT_KEYS: readonly SlotKeys[];
|
|
6804
|
+
/** The options of the highway strategy `slots` (RULE-047). */
|
|
6805
|
+
interface SlotOptions {
|
|
6806
|
+
/** The weight `k` of the pull, from 0.25 to 8. The default is 2. The name is not `k`, because `follow` reads `k` as an option of its ways. */
|
|
6807
|
+
readonly pull: number;
|
|
6808
|
+
/** The reach `r` of the pull, in units, from 8 to 64. A route point farther than this distance from a trunk gets no pull. The default is 24. */
|
|
6809
|
+
readonly reach: number;
|
|
6810
|
+
/** The distance between two lanes of a trunk, in units, from 2 to 8. The default is 4. */
|
|
6811
|
+
readonly laneSpacing: number;
|
|
6812
|
+
/** The largest stretch of a route after it joins a trunk: its new length over its first length, from 1.05 to 2. The default is 1.25. */
|
|
6813
|
+
readonly maxStretch: number;
|
|
6814
|
+
/** The edges that can join a trunk. The default is `same`. */
|
|
6815
|
+
readonly keys: SlotKeys;
|
|
6816
|
+
/** The plan that gives the trunks. The default is `shared-ways`. */
|
|
6817
|
+
readonly from: HighwayBase;
|
|
6818
|
+
}
|
|
6819
|
+
/** The default options of the strategy `slots`. */
|
|
6820
|
+
export declare const SLOT_DEFAULTS: Readonly<SlotOptions>;
|
|
6821
|
+
/** One possible join of an edge to a trunk: the trunk, the places on its spine, the pull and the detour. */
|
|
6822
|
+
interface SlotJoin {
|
|
6823
|
+
readonly highway: number;
|
|
6824
|
+
readonly on: number;
|
|
6825
|
+
readonly off: number;
|
|
6826
|
+
/** The pull energy that the join removes: `k × Σ w(d) × (d - slot)² × step / r²`, in units of length. */
|
|
6827
|
+
readonly pull: number;
|
|
6828
|
+
/** The length that the join adds to the route, as an estimate. */
|
|
6829
|
+
readonly detour: number;
|
|
6830
|
+
}
|
|
6831
|
+
/**
|
|
6832
|
+
* This function gives the best join of one route to the trunk `h`, or `undefined`.
|
|
6833
|
+
* The longest row of samples nearer than `reach` to the spine is the part of the route that the trunk pulls.
|
|
6834
|
+
* The slot of the new lane is at `laneSpacing × (lanes + 1) / 2` from the spine. The weight is `w(d) = max(0, 1 - d / r)`.
|
|
6835
|
+
*/
|
|
6836
|
+
export declare function slotJoin(route: readonly Point[], h: Highway, index: number, o: Readonly<SlotOptions>): SlotJoin | undefined;
|
|
6837
|
+
/**
|
|
6838
|
+
* This function gives the plan of the highway strategy `slots` (RULE-047, after the pull of force-directed edge bundling, Holten and van Wijk 2009).
|
|
6839
|
+
* The trunks are the highways of the plan `from`. Each edge outside the plan gets a pull toward the slot of a new lane of a trunk near its first route.
|
|
6840
|
+
* The energy of the pull is `E = k Σ w(d_i) ‖x_i - slot_i‖²` over the samples of the route, with `w(d) = max(0, 1 - d / r)`.
|
|
6841
|
+
* The edge joins the trunk when the pull is larger than the length that the join adds, and the stretch stays under `maxStretch`.
|
|
6842
|
+
* The edge takes the trunk with the largest gain, on the outer lane. An edge that does not fit stays off the trunks.
|
|
6843
|
+
*/
|
|
6844
|
+
export declare function slotPlan(input: HighwayInput, options?: Partial<SlotOptions>): HighwayPlan;
|
|
6845
|
+
/** This function adds the joins of `slotPlan` to the plan `first` of the graph. It reads all the options except `from`. A join that breaks a hard rule after `follow` leaves the plan. */
|
|
6846
|
+
export declare function slotsOf(graph: Graph, first: HighwayPlan, routes: ReadonlyMap<string, readonly Point[]>, options?: Partial<SlotOptions>): HighwayPlan;
|
|
6313
6847
|
/** The options of a router strategy: the options of its router, without the name and the limit of the benchmark. */
|
|
6314
6848
|
export type RouterPreset<O> = Omit<O, "name" | "maxNodes">;
|
|
6315
6849
|
/** The built-in router strategies, in the order of the benchmark. They route as the routers of `ROUTERS`. */
|
|
@@ -6456,6 +6990,9 @@ export declare const highwayStrategies: {
|
|
|
6456
6990
|
readonly interchanges: Strategy<"highway", InterchangeOptions>;
|
|
6457
6991
|
readonly knee: Strategy<"highway", KneeOptions>;
|
|
6458
6992
|
readonly bronchial: Strategy<"highway", BronchialOptions>;
|
|
6993
|
+
readonly balance: Strategy<"highway", BalanceOptions>;
|
|
6994
|
+
readonly manifolds: Strategy<"highway", ManifoldOptions>;
|
|
6995
|
+
readonly slots: Strategy<"highway", SlotOptions>;
|
|
6459
6996
|
readonly "corridors+breakeven": Strategy<"highway", CorridorOptions & BreakEvenOptions>;
|
|
6460
6997
|
readonly "corridors+stretch": Strategy<"highway", CorridorOptions & StretchOptions>;
|
|
6461
6998
|
readonly "corridors+ambiguity": Strategy<"highway", CorridorOptions & AmbiguityGuardOptions>;
|
|
@@ -6468,17 +7005,24 @@ export declare const plugStrategies: {
|
|
|
6468
7005
|
readonly side: Strategy<"plugs", SidePlugOptions>;
|
|
6469
7006
|
readonly justify: Strategy<"plugs", JustifyOptions>;
|
|
6470
7007
|
readonly spread: Strategy<"plugs", SpreadOptions>;
|
|
7008
|
+
readonly leaders: Strategy<"plugs", LeaderOptions>;
|
|
6471
7009
|
};
|
|
6472
7010
|
/** The built-in level rules: the strategies of the step `levels`. The router `sections` makes its zoom levels with its option `level`. */
|
|
6473
7011
|
export declare const levelStrategies: {
|
|
6474
7012
|
readonly depths: Strategy<"levels", DepthLevelOptions>;
|
|
6475
7013
|
readonly venation: Strategy<"levels", VenationOptions>;
|
|
7014
|
+
readonly detail: Strategy<"levels", DetailOptions>;
|
|
6476
7015
|
};
|
|
6477
7016
|
/**
|
|
6478
7017
|
* The fixed list of settings of the whole strategy `board-portfolio` (WILD-045), in order. The option `settings` takes the first ones.
|
|
6479
7018
|
* 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
7019
|
*/
|
|
6481
7020
|
export declare const BOARD_PORTFOLIO_SETTINGS: readonly PortfolioSetting[];
|
|
7021
|
+
/**
|
|
7022
|
+
* The pool of routes of the whole strategy `curriculum` (RULE-048), in order: the routers of the base of the screen. The first one gives the first answer.
|
|
7023
|
+
* The option `settings` takes the first ones.
|
|
7024
|
+
*/
|
|
7025
|
+
export declare const CURRICULUM_POOL: readonly PortfolioSetting[];
|
|
6482
7026
|
/**
|
|
6483
7027
|
* 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.
|
|
6484
7028
|
* Without options, it routes the graph with the router `corners`.
|
|
@@ -6486,6 +7030,10 @@ export declare const BOARD_PORTFOLIO_SETTINGS: readonly PortfolioSetting[];
|
|
|
6486
7030
|
export declare const wholeStrategies: {
|
|
6487
7031
|
readonly pipeline: Strategy<"whole", PipelineOptions>;
|
|
6488
7032
|
readonly "board-portfolio": Strategy<"whole", BoardPortfolioOptions>;
|
|
7033
|
+
readonly curriculum: Strategy<"whole", CurriculumOptions>;
|
|
7034
|
+
readonly preferences: Strategy<"whole", PreferenceOptions>;
|
|
7035
|
+
readonly fireflies: Strategy<"whole", FireflyOptions>;
|
|
7036
|
+
readonly tracing: Strategy<"whole", TracingOptions>;
|
|
6489
7037
|
};
|
|
6490
7038
|
/** The built-in strategies of each step, in order. A consumer adds its own: `createRegistry([...BUILT_IN_STRATEGIES, mine])`. */
|
|
6491
7039
|
export declare const BUILT_IN_STRATEGIES: readonly AnyStrategy[];
|
|
@@ -8053,5 +8601,5 @@ export declare const PORTFOLIO_SETS: Readonly<Record<`${PortfolioRule}|${Portfol
|
|
|
8053
8601
|
* The default stretch order is `sifting`, the best order of the screen. The option `stretchOrder` selects `consensus` or `periphery`.
|
|
8054
8602
|
*/
|
|
8055
8603
|
export declare const sharedStretchStrategy: Strategy<"router", RouterPreset<SharedOptions>>;
|
|
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 };
|
|
8604
|
+
export { type AdamOptions, type AdvectionSettings, type AmbiguityGuardOptions, type AnnealingOptions, type ArcOptions, type ArcSource, type AreaOptions, type AreaWidth, type AttractionOptions, type BalanceEnd, type BalanceOptions, type Biclique, type BreakEvenOptions, type BronchialOptions, type BronchialSplit, type BundleLine, type BundleOrder, type CanalHub, type CanalOptions, 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 ManifoldOptions, type ManifoldSide, 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 RerouteOptions, 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 SlotJoin, type SlotKeys, type SlotOptions, 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 };
|
|
8057
8605
|
//# sourceMappingURL=index.d.ts.map
|