@mark1russell7/layout-contract 0.2.11 → 0.2.13
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 +6 -4
- package/build/index.d.ts +270 -147
- package/build/index.d.ts.map +1 -1
- package/build/index.js +285 -29
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/input.ts +8 -0
- package/src/measures.ts +21 -10
- package/src/record.ts +11 -2
- package/src/rules.ts +15 -0
- package/src/shapes.ts +119 -0
- package/src/strategy-space.ts +94 -16
- package/src/verdict.ts +47 -1
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ The package has no runtime dependencies.
|
|
|
9
9
|
| Part | Exports |
|
|
10
10
|
|---|---|
|
|
11
11
|
| Geometry | `Point`, `Rect`, `Region`, `Side`, `Sides`, `Margin`, `marginSides`, `grow`, `boundsOf`, `translate`, `overlapOf` |
|
|
12
|
+
| The shape kinds | `ShapeKind`, `SHAPE_KINDS`, `SHAPE_KIND_IDS`, `ShapeKindSpec`, `ShapeGeometry`, `DEFAULT_SHAPES`, `ShapeSupport`, `isShapeKind`, `shapeKindOf`, `shapeKindsOf`, `itemShapeOf`, `shapeKindProblem`, `shapesOf`, `checkShapes` |
|
|
12
13
|
| The input `layout-input/1` | `LayoutInput`, `LayoutBox` (`Item` for the packer), `Port`, `LayoutEdge`, `LayoutContainer`, `Obstacle`, `LayoutCell`, `LayoutGenerator` |
|
|
13
14
|
| The packer | `PackInput`, `toPackInput`, `Placement`, `PackOutput`, `StageTrace`, `applyPack` |
|
|
14
15
|
| The record `layout-record/1` | `LayoutRecord`, `Stage`, `Supports`, `RunFacts`, `RunEnv`, `toLayoutRecord` |
|
|
@@ -22,13 +23,13 @@ The package has no runtime dependencies.
|
|
|
22
23
|
| The pick rule | `selectBest`, `SelectCandidate`, `SelectLevel`, `Selection`, `PickSpec` |
|
|
23
24
|
| The corpus checks | `ClaimBreak`, `checkDeclared`, `declaredCounts`, `declaredClaimOf`, `DeclaredClaim`, `Declares`, `corpusHashOf`, `CorpusEntry` |
|
|
24
25
|
| The families | `familyOf`, `FamilyBy`, `FamilyCell`, `FAMILY_ANY_KIND` |
|
|
25
|
-
| The verdict | `verdict`, `VerdictOptions`, `VerdictResult`, `VerdictRecord`, `VerdictSide`, `VerdictInterval`, `FamilyVerdict`, `VerdictPermutation`, `VerdictSignTest`, `VerdictLabel`, `VERDICT_EXACT_MAX`, `VERDICT_EXACT_CAP`, `VERDICT_RUNS`, `VERDICT_DRAWS`, `VERDICT_SEED` |
|
|
26
|
+
| The verdict | `verdict`, `VerdictOptions`, `VerdictResult`, `VerdictRecord`, `VerdictSide`, `VerdictInterval`, `FamilyVerdict`, `VerdictPermutation`, `VerdictSignTest`, `VerdictLabel`, `VerdictScope`, `VerdictBreadth`, `VERDICT_EXACT_MAX`, `VERDICT_EXACT_CAP`, `VERDICT_RUNS`, `VERDICT_DRAWS`, `VERDICT_SEED` |
|
|
26
27
|
| The split files | `checkSplit`, `splitFolds`, `leaveOneSeedOut`, `splitFileName`, `SPLIT_SCHEMA`, `CorpusSplit`, `SplitFold`, `SplitCorpus` |
|
|
27
|
-
| The strategy space | `StrategySpace`, `SpaceStage`, `StageOption`, `SpaceParam`, `ParamWhen`, `MemberRule`, `SpaceConstraint`, `OptionRef`, `StrategyConfig`, `StageChoice`, `ParamKind`, `ParamValue`, `STRATEGY_SPACE_SCHEMA` |
|
|
28
|
-
| The space functions | `checkSpace`, `checkConfig`, `canonicalConfig`, `configId`, `spaceSize`, `paramLevels`, `enumerateSpace`, `productSpace`, `joinConfigs`, `splitConfig`, `SpaceSize`, `SpaceSizeOptions`, `EnumerateOptions`, `GridOptions`, `SampleOptions` |
|
|
28
|
+
| The strategy space | `StrategySpace`, `SpaceStage`, `StageOption`, `OptionSupports`, `ShapeFilter`, `SpaceParam`, `ParamWhen`, `MemberRule`, `SpaceConstraint`, `OptionRef`, `StrategyConfig`, `StageChoice`, `ParamKind`, `ParamValue`, `STRATEGY_SPACE_SCHEMA` |
|
|
29
|
+
| The space functions | `checkSpace`, `checkConfig`, `canonicalConfig`, `configId`, `spaceSize`, `spaceShapeKinds`, `paramLevels`, `enumerateSpace`, `productSpace`, `joinConfigs`, `splitConfig`, `SpaceSize`, `SpaceSizeOptions`, `EnumerateOptions`, `GridOptions`, `SampleOptions` |
|
|
29
30
|
| The turn | `turnBox`, `turnPort`, `turnMargin`, `turnRegion`, `turnSide`, `turnPoint` |
|
|
30
31
|
| The tolerances | `EPS`, `RECORD_EPS`, `RECORD_SCALE`, `Tolerance`, `DEFAULT_TOLERANCE` |
|
|
31
|
-
| The hard rules | `countOverlaps`, `countObstacleHits`, `regionHitsRect`, `rectInRegion`, `countOutside`, `ContainerTest`, `countPortsOffBorder`, `packHard`, `PackHard`, `placedRect`, `checkInput` |
|
|
32
|
+
| The hard rules | `countOverlaps`, `countObstacleHits`, `regionHitsRect`, `rectInRegion`, `countOutside`, `ContainerTest`, `countPortsOffBorder`, `packHard`, `PackHard`, `PACK_HARD_RULES`, `placedRect`, `checkInput` |
|
|
32
33
|
|
|
33
34
|
## The rules
|
|
34
35
|
|
|
@@ -39,6 +40,7 @@ The package has no runtime dependencies.
|
|
|
39
40
|
- **The hard rules of a pack.** `no-overlap` counts the pairs of boxes and the pairs of a box and an obstacle. A locked box without a placement, or with a move of more than `RECORD_EPS`, breaks `locked-kept`. `checkInput` refuses a locked box without a position. Another box without a placement and not in `overflow` breaks `complete`.
|
|
40
41
|
- **The container rule.** `in-container` counts each box that goes out of the container made smaller by `inset`. The box counts with its margin. By default, a shaped container counts as its bounding box.
|
|
41
42
|
- **The exact container.** Give `{ exactContainer: true }` to `packHard` or `countOutside`. Then a box of a shaped container with the size `fixed` must stay inside the shape. A cut corner, a notch and a hole count. A container with a free side keeps the bounding test. The default changes to the exact test at the next breaking version.
|
|
43
|
+
- **The shape kinds.** An item is a `rect`, a `polygon`, a `circle` or a `free` shape. Each measure and rule declares its kinds. `checkShapes` refuses the other kinds. `docs/SHAPES.md` tells the rules.
|
|
42
44
|
- **The output hash.** `outputHash` gives the first 16 hex characters of the SHA-256 of the canonical JSON of an output. Each number goes to the grid of `RECORD_EPS` first.
|
|
43
45
|
- **The corpus checks.** `checkDeclared` and `checkSplit` give a list of `ClaimBreak`. An empty list tells that each claim is true. `corpusHashOf` gives the corpus hash of `packing`.
|
|
44
46
|
- **The verdict.** `verdict` compares two strategies on one measure, with the family as the unit. A verdict counts only when it holds for the mean of the family means and for the mean of the inputs.
|
package/build/index.d.ts
CHANGED
|
@@ -64,33 +64,128 @@ export declare function overlapOf(a: Rect, b: Rect): {
|
|
|
64
64
|
readonly x: number;
|
|
65
65
|
readonly y: number;
|
|
66
66
|
};
|
|
67
|
-
/**
|
|
68
|
-
export
|
|
67
|
+
/** One broken claim of a corpus, with the ids of the inputs that break it. */
|
|
68
|
+
export interface ClaimBreak {
|
|
69
|
+
/** The name of the claim, for example `declared`, `split` or `index`. */
|
|
70
|
+
readonly claim: string;
|
|
71
|
+
/** The text of the break. */
|
|
72
|
+
readonly detail: string;
|
|
73
|
+
/** The ids of the inputs that break the claim. The list is empty when the break has no input. */
|
|
74
|
+
readonly inputs: readonly string[];
|
|
75
|
+
}
|
|
76
|
+
/** The claim `claims.declared` of a manifest: the count of the inputs for each declared property. */
|
|
77
|
+
export interface DeclaredClaim {
|
|
78
|
+
/** A property with fewer inputs than this count is thin. */
|
|
79
|
+
readonly minCount: number;
|
|
80
|
+
/** The ids of the properties with a count below `minCount`. */
|
|
81
|
+
readonly thin: readonly string[];
|
|
82
|
+
/** The count of the inputs for each property id. */
|
|
83
|
+
readonly counts: Readonly<Record<string, number>>;
|
|
84
|
+
/** The key of the family of an input. `familyOf` gives the key of one cell. The family is the unit of a verdict. */
|
|
85
|
+
readonly familyBy?: FamilyBy;
|
|
86
|
+
/** The minimum count of the inputs of each family. Without it, `checkDeclared` does not count the families. */
|
|
87
|
+
readonly familyMin?: number;
|
|
88
|
+
}
|
|
69
89
|
/**
|
|
70
|
-
* The
|
|
71
|
-
*
|
|
90
|
+
* The key of the family of a cell (`docs/CORPUS-CHECKS.md`).
|
|
91
|
+
*
|
|
92
|
+
* - The flat form is a list of dimensions. The key is the values of these dimensions of the cell, in order, with `/` between them.
|
|
93
|
+
* - The map form chooses an entry by the field `kind` of the cell, or the entry `"*"`. The key is the kind, then the values of the dimensions of the entry.
|
|
72
94
|
*/
|
|
73
|
-
export
|
|
95
|
+
export type FamilyBy = readonly string[] | {
|
|
96
|
+
readonly [kind: string]: readonly string[];
|
|
97
|
+
};
|
|
98
|
+
/** A cell of an input: one value for each dimension. The map form of `FamilyBy` also reads the field `kind`. */
|
|
99
|
+
export type FamilyCell = Readonly<Record<string, unknown>>;
|
|
100
|
+
/** The entry of the map form of `FamilyBy` for each kind without its own entry. */
|
|
101
|
+
export declare const FAMILY_ANY_KIND = "*";
|
|
74
102
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
103
|
+
* This function gives the family key of a cell. It throws a `RangeError` when the cell does not have a dimension of the key.
|
|
104
|
+
* In the map form, it also throws for a cell without `kind`, and for a kind with no entry and no entry `"*"`.
|
|
105
|
+
* For example, `{ "rect-grid": ["obstacles"], "*": [] }` gives `rect-grid/wall` for a `rect-grid` cell and `gallery` for a `gallery` cell.
|
|
77
106
|
*/
|
|
78
|
-
export declare
|
|
107
|
+
export declare function familyOf(cell: FamilyCell, familyBy: FamilyBy): string;
|
|
108
|
+
/** The hook that gives the ids of the properties that one input declares. */
|
|
109
|
+
export type Declares<I> = (input: I) => readonly string[];
|
|
79
110
|
/**
|
|
80
|
-
*
|
|
81
|
-
* in
|
|
111
|
+
* This function gives the count of the inputs for each property id. Each id of `ids` has a count, also when the count is 0.
|
|
112
|
+
* An id from `declares` that is not in `ids` comes after the ids of `ids`, in the order of the first input that declares it.
|
|
82
113
|
*/
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
114
|
+
export declare function declaredCounts<I>(inputs: Iterable<I>, declares: Declares<I>, ids?: readonly string[]): Record<string, number>;
|
|
115
|
+
/**
|
|
116
|
+
* This function reads the field `claims.declared` of a manifest. A manifest without it gives `undefined`.
|
|
117
|
+
* It throws an `Error` for a claim without a whole `minCount`, a list `thin` of ids and a whole count for each id.
|
|
118
|
+
*/
|
|
119
|
+
export declare function declaredClaimOf(manifest: object): DeclaredClaim | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* This function checks the claim `claims.declared` against the inputs. It gives one break `declared` for each problem. An empty list tells that the claim is true.
|
|
122
|
+
*
|
|
123
|
+
* - `ids` are the property ids. The default is the ids of `claim.counts`.
|
|
124
|
+
* - Each id of `ids` has a count in `claim.counts`, and `claim.counts` has no other id. Each count is the count of the inputs.
|
|
125
|
+
* - An id with a count below `minCount` is in `thin`. Each id of `thin` is an id of `ids`.
|
|
126
|
+
* - Each id that `declares` gives is an id of `ids`.
|
|
127
|
+
*
|
|
128
|
+
* With `claim.familyBy`, the hook `cellOf` gives the cell of each input. The default reads the field `cell` of the input.
|
|
129
|
+
*
|
|
130
|
+
* - Each cell has each dimension of its key. In the map form, each cell has a `kind`, and the kind has an entry or the entry `"*"` is there.
|
|
131
|
+
* - Two cells with different dimension values do not give the same key.
|
|
132
|
+
* - With `claim.familyMin`, each family has `familyMin` inputs or more.
|
|
133
|
+
*/
|
|
134
|
+
export declare function checkDeclared<I>(inputs: Iterable<I>, declares: Declares<I>, claim: DeclaredClaim, ids?: readonly string[], cellOf?: (input: I) => FamilyCell | undefined): ClaimBreak[];
|
|
135
|
+
/** The id and the hash of one input of a corpus. */
|
|
136
|
+
export interface CorpusEntry {
|
|
137
|
+
readonly id: string;
|
|
138
|
+
readonly hash: string;
|
|
88
139
|
}
|
|
89
140
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
141
|
+
* This function gives the hash of a corpus: the first 16 hex characters of a SHA-256. The text of the SHA-256 is `canonicalJson`
|
|
142
|
+
* of the corpus id and the `[id, hash]` of each input, in the order of the manifest. A change of one input changes the hash.
|
|
92
143
|
*/
|
|
93
|
-
export declare
|
|
144
|
+
export declare function corpusHashOf(corpus: string, inputs: readonly CorpusEntry[]): string;
|
|
145
|
+
/** The schema of a split file. */
|
|
146
|
+
export declare const SPLIT_SCHEMA = "corpus-split/1";
|
|
147
|
+
/** One fold of a split: the seeds that fit a selector and the seeds that score it. */
|
|
148
|
+
export interface SplitFold {
|
|
149
|
+
readonly train: readonly number[];
|
|
150
|
+
readonly heldOut: readonly number[];
|
|
151
|
+
}
|
|
152
|
+
/** A split file `corpus-split/1`. Its name is `<corpus id>.<corpus hash>.json`. It is beside the corpus, so the corpus does not change. */
|
|
153
|
+
export interface CorpusSplit {
|
|
154
|
+
readonly schema: typeof SPLIT_SCHEMA;
|
|
155
|
+
readonly corpus: string;
|
|
156
|
+
/** The hash of the corpus: `corpusHashOf` of its manifest. */
|
|
157
|
+
readonly corpusHash: string;
|
|
158
|
+
/** The splits by name. Each split has one fold or more. */
|
|
159
|
+
readonly splits: Readonly<Record<string, {
|
|
160
|
+
readonly folds: readonly SplitFold[];
|
|
161
|
+
}>>;
|
|
162
|
+
}
|
|
163
|
+
/** The fields of a manifest that the split check reads. */
|
|
164
|
+
export interface SplitCorpus {
|
|
165
|
+
readonly corpus: string;
|
|
166
|
+
readonly specs: readonly {
|
|
167
|
+
readonly seeds: readonly number[];
|
|
168
|
+
}[];
|
|
169
|
+
readonly inputs: readonly CorpusEntry[];
|
|
170
|
+
}
|
|
171
|
+
/** This function gives the name of the split file of a corpus. */
|
|
172
|
+
export declare function splitFileName(corpus: string, hash: string): string;
|
|
173
|
+
/**
|
|
174
|
+
* This function checks a split file against a manifest. It gives one break `split` for each problem. An empty list tells that the file is good.
|
|
175
|
+
*
|
|
176
|
+
* - The schema is `corpus-split/1`, the corpus is the id of the manifest and `corpusHash` is `corpusHashOf` of the manifest.
|
|
177
|
+
* - Each split has one fold or more. In each fold, `train` and `heldOut` are lists of seeds, not empty and with no common seed.
|
|
178
|
+
* - Each seed is a seed of a spec of the manifest.
|
|
179
|
+
* - With `name`, the file has the split `name`.
|
|
180
|
+
*/
|
|
181
|
+
export declare function checkSplit(split: unknown, corpus: SplitCorpus, name?: string): ClaimBreak[];
|
|
182
|
+
/**
|
|
183
|
+
* This function gives a copy of the folds of the split `name` of a split file. `where` names the file in the text of an error.
|
|
184
|
+
* It throws an `Error` for each problem of `checkSplit`, and then for an unknown split name.
|
|
185
|
+
*/
|
|
186
|
+
export declare function splitFolds(split: unknown, corpus: SplitCorpus, name: string, where?: string): SplitFold[];
|
|
187
|
+
/** This function gives the folds that hold out one seed each, in the order of the seeds. Each fold trains on the other seeds. */
|
|
188
|
+
export declare function leaveOneSeedOut(seeds: readonly number[]): SplitFold[];
|
|
94
189
|
/**
|
|
95
190
|
* A port of a box: a place where edges go into the box.
|
|
96
191
|
* With `x` and `y`, the port is fixed on the border of the box, relative to its top-left corner.
|
|
@@ -118,6 +213,11 @@ export interface LayoutBox {
|
|
|
118
213
|
readonly group?: string;
|
|
119
214
|
/** A region relative to the origin of the box. Without it, the box is the rectangle `w` by `h`. */
|
|
120
215
|
readonly shape?: Region;
|
|
216
|
+
/**
|
|
217
|
+
* The shape kind of the box (`docs/SHAPES.md`). Without it, `shapeKindOf` gives the kind of `shape`, or `rect` without a shape.
|
|
218
|
+
* The kind `free` tells that the contract knows only the bounding box `w` by `h`.
|
|
219
|
+
*/
|
|
220
|
+
readonly shapeKind?: ShapeKind;
|
|
121
221
|
readonly ports?: readonly Port[];
|
|
122
222
|
/** A ring around the box. No other box enters it. Only a route from a port of the box enters it, at a right angle. */
|
|
123
223
|
readonly margin?: Margin;
|
|
@@ -178,6 +278,8 @@ export interface LayoutCell {
|
|
|
178
278
|
readonly edgeShape?: "random" | "clustered" | "hubChain" | "longRange" | "tree" | "bundled";
|
|
179
279
|
readonly groups?: "none" | "flat" | "nested";
|
|
180
280
|
readonly ports?: "free" | "sides" | "fixed";
|
|
281
|
+
/** The shape kinds of the boxes: one kind, or `mixed` for more kinds. Without it, each box is a `rect`. `itemShapeOf` gives the value. */
|
|
282
|
+
readonly itemShape?: ShapeKind | "mixed";
|
|
181
283
|
}
|
|
182
284
|
/** An input of the corpus: the format `layout-input/1`. */
|
|
183
285
|
export interface LayoutInput {
|
|
@@ -220,6 +322,89 @@ export interface PackInput {
|
|
|
220
322
|
}
|
|
221
323
|
/** This function gives the packer input of a file. An input without a container gets `{ fixed: "none" }`, so the packer picks the size. */
|
|
222
324
|
export declare function toPackInput(input: LayoutInput): PackInput;
|
|
325
|
+
/**
|
|
326
|
+
* The kind of the shape of an item. A box without `shape` and without `shapeKind` is a `rect`.
|
|
327
|
+
* The set is open: a later version can add a kind. A reader treats an unknown kind as a kind that it does not support.
|
|
328
|
+
*/
|
|
329
|
+
export type ShapeKind = "rect" | "polygon" | "circle" | "free";
|
|
330
|
+
/** The geometry of a shape kind that this package gives. A `false` value tells that the kind declares the operation, but this package does not supply it. */
|
|
331
|
+
export interface ShapeGeometry {
|
|
332
|
+
/** The bounding box: `boundsOf` and `placedRect`. */
|
|
333
|
+
readonly bounds: boolean;
|
|
334
|
+
/** The area of the shape. */
|
|
335
|
+
readonly area: boolean;
|
|
336
|
+
/** The test that the shape is inside a region: `rectInRegion` for a `rect`. */
|
|
337
|
+
readonly contains: boolean;
|
|
338
|
+
/** The test that two shapes overlap: `overlapOf` for two `rect` shapes. */
|
|
339
|
+
readonly overlap: boolean;
|
|
340
|
+
}
|
|
341
|
+
/** The facts of one shape kind: its fields, the kinds of `Region` that give it, and its geometry. */
|
|
342
|
+
export interface ShapeKindSpec {
|
|
343
|
+
readonly id: ShapeKind;
|
|
344
|
+
/** The fields of the outline, relative to the top-left corner of the box. A name with `?` is optional. */
|
|
345
|
+
readonly fields: readonly string[];
|
|
346
|
+
/** The kinds of `LayoutBox.shape` that agree with this kind. */
|
|
347
|
+
readonly regions: readonly Region["kind"][];
|
|
348
|
+
readonly geometry: ShapeGeometry;
|
|
349
|
+
}
|
|
350
|
+
/** The declared shape kinds, in their order. Only `rect` has all of its geometry. The other kinds have their bounding box only. */
|
|
351
|
+
export declare const SHAPE_KINDS: readonly ShapeKindSpec[];
|
|
352
|
+
/** The ids of `SHAPE_KINDS`, in their order. */
|
|
353
|
+
export declare const SHAPE_KIND_IDS: readonly ShapeKind[];
|
|
354
|
+
/** The shape kinds of a measure or a rule without `shapes`. The contract measured only rectangles before L46. */
|
|
355
|
+
export declare const DEFAULT_SHAPES: readonly ShapeKind[];
|
|
356
|
+
/** A measure or a rule, with the shape kinds that it supports. Without `shapes`, it supports `DEFAULT_SHAPES`. */
|
|
357
|
+
export interface ShapeSupport<Id extends string = string> {
|
|
358
|
+
readonly id: Id;
|
|
359
|
+
readonly shapes?: readonly ShapeKind[];
|
|
360
|
+
}
|
|
361
|
+
/** This function tells if a value is a declared shape kind. */
|
|
362
|
+
export declare function isShapeKind(value: unknown): value is ShapeKind;
|
|
363
|
+
/**
|
|
364
|
+
* This function gives the shape kind of a box. A box with `shapeKind` has that kind.
|
|
365
|
+
* Without it, the kind comes from `shape`: no shape is a `rect`, and an ellipse is `free`.
|
|
366
|
+
*/
|
|
367
|
+
export declare function shapeKindOf(box: LayoutBox): ShapeKind;
|
|
368
|
+
/** This function gives the shape kinds of the boxes of an input, in the order of `SHAPE_KINDS`. An input without boxes gives an empty list. */
|
|
369
|
+
export declare function shapeKindsOf(input: Pick<LayoutInput, "boxes">): ShapeKind[];
|
|
370
|
+
/** This function gives the value of the cell dimension `itemShape` of an input: its one kind, `mixed` for more kinds, or `rect` without boxes. */
|
|
371
|
+
export declare function itemShapeOf(input: Pick<LayoutInput, "boxes">): ShapeKind | "mixed";
|
|
372
|
+
/** This function gives the problem of the shape kind of a box, or `undefined` when `shapeKind` and `shape` agree. */
|
|
373
|
+
export declare function shapeKindProblem(box: LayoutBox): string | undefined;
|
|
374
|
+
/** This function gives the shape kinds that a measure or a rule supports. */
|
|
375
|
+
export declare function shapesOf(use: Pick<ShapeSupport, "shapes">): readonly ShapeKind[];
|
|
376
|
+
/**
|
|
377
|
+
* This function checks that each measure and each rule of a run supports each shape kind of the input. An empty list tells that the run is good.
|
|
378
|
+
* Each break has the claim `shape`, the id of the input, and the first 5 ids of the boxes of the kind.
|
|
379
|
+
*/
|
|
380
|
+
export declare function checkShapes(input: Pick<LayoutInput, "id" | "boxes">, uses: readonly ShapeSupport[]): ClaimBreak[];
|
|
381
|
+
/** The epsilon for the float compares in an engine. */
|
|
382
|
+
export declare const EPS = 1e-6;
|
|
383
|
+
/**
|
|
384
|
+
* The count of grid steps in one unit of a written file. A file rounds each number `v` to `Math.round(v * RECORD_SCALE) / RECORD_SCALE`.
|
|
385
|
+
* Use a multiplication by this value, not a division by `RECORD_EPS`. The two differ at some half steps.
|
|
386
|
+
*/
|
|
387
|
+
export declare const RECORD_SCALE = 1e3;
|
|
388
|
+
/**
|
|
389
|
+
* The epsilon for the float compares on a written file. A file rounds each number to 3 decimals,
|
|
390
|
+
* so a difference of two values can move by up to 0.001. It is `1 / RECORD_SCALE`.
|
|
391
|
+
*/
|
|
392
|
+
export declare const RECORD_EPS = .001;
|
|
393
|
+
/**
|
|
394
|
+
* The tolerance of each hard rule, in layout units. A record writes the tolerance that its run used,
|
|
395
|
+
* in its field `tolerance`, next to `hard`.
|
|
396
|
+
*/
|
|
397
|
+
export interface Tolerance {
|
|
398
|
+
/** Two boxes with their margins break `no-overlap` when their insides overlap by more than this on each axis. */
|
|
399
|
+
readonly overlap: number;
|
|
400
|
+
/** A route breaks `no-pass-through` when a part longer than this is inside a box made this much smaller. */
|
|
401
|
+
readonly through: number;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* The default tolerance of each rule. The packer is exact, so `overlap` is one unit of the rounding.
|
|
405
|
+
* Routes are sampled curves that follow the margin line, so `through` is larger.
|
|
406
|
+
*/
|
|
407
|
+
export declare const DEFAULT_TOLERANCE: Tolerance;
|
|
223
408
|
/** The position of one item. `turn` is 90 when the packer turned a turnable item. */
|
|
224
409
|
export interface Placement {
|
|
225
410
|
readonly id: string;
|
|
@@ -276,6 +461,8 @@ export interface LayoutRecord {
|
|
|
276
461
|
readonly seed: number;
|
|
277
462
|
readonly nodes: number;
|
|
278
463
|
readonly edges: number;
|
|
464
|
+
/** The shape kinds of the boxes of the input, in the order of `SHAPE_KINDS`. Without it, each box is a `rect`. */
|
|
465
|
+
readonly shapes?: readonly ShapeKind[];
|
|
279
466
|
/** The value of each measure, by its name: `pack.*`, `route.*` or `joint.*`. */
|
|
280
467
|
readonly measures: Readonly<Record<string, number>>;
|
|
281
468
|
/** The count of the breaks of each hard rule. A good run has 0 for each rule. */
|
|
@@ -319,8 +506,11 @@ export interface RunEnv {
|
|
|
319
506
|
readonly cpus: number;
|
|
320
507
|
}
|
|
321
508
|
/** The facts of a run that the input does not give. */
|
|
322
|
-
export type RunFacts = Omit<LayoutRecord, "schema" | "input" | "inputHash" | "set" | "nodes" | "edges">;
|
|
323
|
-
/**
|
|
509
|
+
export type RunFacts = Omit<LayoutRecord, "schema" | "input" | "inputHash" | "set" | "nodes" | "edges" | "shapes">;
|
|
510
|
+
/**
|
|
511
|
+
* This function gives the record of a run. The input gives its id, its hash, its set and the counts of the nodes and the edges.
|
|
512
|
+
* The input also gives `shapes`. An input with only `rect` boxes gets no `shapes`, so its record does not change.
|
|
513
|
+
*/
|
|
324
514
|
export declare function toLayoutRecord(input: LayoutInput, run: RunFacts): LayoutRecord;
|
|
325
515
|
/** This function gives the area of a placed box: its shape or its rectangle, at its position. A box without a position gives `undefined`. */
|
|
326
516
|
export declare function placedRect(box: LayoutBox): Rect | undefined;
|
|
@@ -355,6 +545,12 @@ export interface PackHard {
|
|
|
355
545
|
readonly "locked-kept": number;
|
|
356
546
|
readonly complete: number;
|
|
357
547
|
}
|
|
548
|
+
/**
|
|
549
|
+
* The hard rules of a pack, with the shape kinds that each rule supports.
|
|
550
|
+
* `no-overlap` and `in-container` test the bounding box of a shape. That count is exact only for a `rect`.
|
|
551
|
+
* `locked-kept` and `complete` read only the positions and the ids, so they support each kind.
|
|
552
|
+
*/
|
|
553
|
+
export declare const PACK_HARD_RULES: readonly ShapeSupport<keyof PackHard>[];
|
|
358
554
|
/** This function tells if the inside of `region` and the inside of `rect` have a common point. */
|
|
359
555
|
export declare function regionHitsRect(region: Region, rect: Rect): boolean;
|
|
360
556
|
/**
|
|
@@ -425,10 +621,15 @@ export interface MeasureSpec<Id extends string = string> {
|
|
|
425
621
|
};
|
|
426
622
|
/** The role of the measure in the joint selector. */
|
|
427
623
|
readonly role?: "guard" | "change-guard" | "diagnostic" | "time";
|
|
624
|
+
/** The shape kinds of the boxes that the measure supports. Without it, the measure supports only `rect`. `checkShapes` refuses the other kinds. */
|
|
625
|
+
readonly shapes?: readonly ShapeKind[];
|
|
428
626
|
}
|
|
429
627
|
/** The id of a joint measure. `docs/JOINT-MEASURES.md` gives the definitions. */
|
|
430
628
|
export type JointMeasureId = "joint.fill" | "joint.aspectError" | "joint.spill" | "joint.straight.crossings" | "joint.straight.length" | "joint.stability.mean" | "joint.stability.moved" | "joint.proxy.rank" | "joint.ms";
|
|
431
|
-
/**
|
|
629
|
+
/**
|
|
630
|
+
* The specs of the joint measures, in the order of `docs/JOINT-MEASURES.md`.
|
|
631
|
+
* `joint.fill` and `joint.straight.length` read the area of each box, so they support only `rect`. `docs/SHAPES.md` tells the reasons.
|
|
632
|
+
*/
|
|
432
633
|
export declare const JOINT_MEASURES: readonly MeasureSpec<JointMeasureId>[];
|
|
433
634
|
/** The threshold of `joint.stability.moved`, in widths `W` of the base. */
|
|
434
635
|
export declare const JOINT_MOVED_MIN = .01;
|
|
@@ -697,128 +898,6 @@ export declare function pickMoves(trace: Pick<PortfolioTrace, "picked">): {
|
|
|
697
898
|
* It also throws a `RangeError` for an empty list of members, or for two members with the same id.
|
|
698
899
|
*/
|
|
699
900
|
export declare function portfolio<I, O>(id: string, members: readonly Member<I, O>[] | ((input: I) => readonly Member<I, O>[]), key: PortfolioKey<I, O>, options?: PortfolioOptions): Portfolio<I, O>;
|
|
700
|
-
/** One broken claim of a corpus, with the ids of the inputs that break it. */
|
|
701
|
-
export interface ClaimBreak {
|
|
702
|
-
/** The name of the claim, for example `declared`, `split` or `index`. */
|
|
703
|
-
readonly claim: string;
|
|
704
|
-
/** The text of the break. */
|
|
705
|
-
readonly detail: string;
|
|
706
|
-
/** The ids of the inputs that break the claim. The list is empty when the break has no input. */
|
|
707
|
-
readonly inputs: readonly string[];
|
|
708
|
-
}
|
|
709
|
-
/** The claim `claims.declared` of a manifest: the count of the inputs for each declared property. */
|
|
710
|
-
export interface DeclaredClaim {
|
|
711
|
-
/** A property with fewer inputs than this count is thin. */
|
|
712
|
-
readonly minCount: number;
|
|
713
|
-
/** The ids of the properties with a count below `minCount`. */
|
|
714
|
-
readonly thin: readonly string[];
|
|
715
|
-
/** The count of the inputs for each property id. */
|
|
716
|
-
readonly counts: Readonly<Record<string, number>>;
|
|
717
|
-
/** The key of the family of an input. `familyOf` gives the key of one cell. The family is the unit of a verdict. */
|
|
718
|
-
readonly familyBy?: FamilyBy;
|
|
719
|
-
/** The minimum count of the inputs of each family. Without it, `checkDeclared` does not count the families. */
|
|
720
|
-
readonly familyMin?: number;
|
|
721
|
-
}
|
|
722
|
-
/**
|
|
723
|
-
* The key of the family of a cell (`docs/CORPUS-CHECKS.md`).
|
|
724
|
-
*
|
|
725
|
-
* - The flat form is a list of dimensions. The key is the values of these dimensions of the cell, in order, with `/` between them.
|
|
726
|
-
* - The map form chooses an entry by the field `kind` of the cell, or the entry `"*"`. The key is the kind, then the values of the dimensions of the entry.
|
|
727
|
-
*/
|
|
728
|
-
export type FamilyBy = readonly string[] | {
|
|
729
|
-
readonly [kind: string]: readonly string[];
|
|
730
|
-
};
|
|
731
|
-
/** A cell of an input: one value for each dimension. The map form of `FamilyBy` also reads the field `kind`. */
|
|
732
|
-
export type FamilyCell = Readonly<Record<string, unknown>>;
|
|
733
|
-
/** The entry of the map form of `FamilyBy` for each kind without its own entry. */
|
|
734
|
-
export declare const FAMILY_ANY_KIND = "*";
|
|
735
|
-
/**
|
|
736
|
-
* This function gives the family key of a cell. It throws a `RangeError` when the cell does not have a dimension of the key.
|
|
737
|
-
* In the map form, it also throws for a cell without `kind`, and for a kind with no entry and no entry `"*"`.
|
|
738
|
-
* For example, `{ "rect-grid": ["obstacles"], "*": [] }` gives `rect-grid/wall` for a `rect-grid` cell and `gallery` for a `gallery` cell.
|
|
739
|
-
*/
|
|
740
|
-
export declare function familyOf(cell: FamilyCell, familyBy: FamilyBy): string;
|
|
741
|
-
/** The hook that gives the ids of the properties that one input declares. */
|
|
742
|
-
export type Declares<I> = (input: I) => readonly string[];
|
|
743
|
-
/**
|
|
744
|
-
* This function gives the count of the inputs for each property id. Each id of `ids` has a count, also when the count is 0.
|
|
745
|
-
* An id from `declares` that is not in `ids` comes after the ids of `ids`, in the order of the first input that declares it.
|
|
746
|
-
*/
|
|
747
|
-
export declare function declaredCounts<I>(inputs: Iterable<I>, declares: Declares<I>, ids?: readonly string[]): Record<string, number>;
|
|
748
|
-
/**
|
|
749
|
-
* This function reads the field `claims.declared` of a manifest. A manifest without it gives `undefined`.
|
|
750
|
-
* It throws an `Error` for a claim without a whole `minCount`, a list `thin` of ids and a whole count for each id.
|
|
751
|
-
*/
|
|
752
|
-
export declare function declaredClaimOf(manifest: object): DeclaredClaim | undefined;
|
|
753
|
-
/**
|
|
754
|
-
* This function checks the claim `claims.declared` against the inputs. It gives one break `declared` for each problem. An empty list tells that the claim is true.
|
|
755
|
-
*
|
|
756
|
-
* - `ids` are the property ids. The default is the ids of `claim.counts`.
|
|
757
|
-
* - Each id of `ids` has a count in `claim.counts`, and `claim.counts` has no other id. Each count is the count of the inputs.
|
|
758
|
-
* - An id with a count below `minCount` is in `thin`. Each id of `thin` is an id of `ids`.
|
|
759
|
-
* - Each id that `declares` gives is an id of `ids`.
|
|
760
|
-
*
|
|
761
|
-
* With `claim.familyBy`, the hook `cellOf` gives the cell of each input. The default reads the field `cell` of the input.
|
|
762
|
-
*
|
|
763
|
-
* - Each cell has each dimension of its key. In the map form, each cell has a `kind`, and the kind has an entry or the entry `"*"` is there.
|
|
764
|
-
* - Two cells with different dimension values do not give the same key.
|
|
765
|
-
* - With `claim.familyMin`, each family has `familyMin` inputs or more.
|
|
766
|
-
*/
|
|
767
|
-
export declare function checkDeclared<I>(inputs: Iterable<I>, declares: Declares<I>, claim: DeclaredClaim, ids?: readonly string[], cellOf?: (input: I) => FamilyCell | undefined): ClaimBreak[];
|
|
768
|
-
/** The id and the hash of one input of a corpus. */
|
|
769
|
-
export interface CorpusEntry {
|
|
770
|
-
readonly id: string;
|
|
771
|
-
readonly hash: string;
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* This function gives the hash of a corpus: the first 16 hex characters of a SHA-256. The text of the SHA-256 is `canonicalJson`
|
|
775
|
-
* of the corpus id and the `[id, hash]` of each input, in the order of the manifest. A change of one input changes the hash.
|
|
776
|
-
*/
|
|
777
|
-
export declare function corpusHashOf(corpus: string, inputs: readonly CorpusEntry[]): string;
|
|
778
|
-
/** The schema of a split file. */
|
|
779
|
-
export declare const SPLIT_SCHEMA = "corpus-split/1";
|
|
780
|
-
/** One fold of a split: the seeds that fit a selector and the seeds that score it. */
|
|
781
|
-
export interface SplitFold {
|
|
782
|
-
readonly train: readonly number[];
|
|
783
|
-
readonly heldOut: readonly number[];
|
|
784
|
-
}
|
|
785
|
-
/** A split file `corpus-split/1`. Its name is `<corpus id>.<corpus hash>.json`. It is beside the corpus, so the corpus does not change. */
|
|
786
|
-
export interface CorpusSplit {
|
|
787
|
-
readonly schema: typeof SPLIT_SCHEMA;
|
|
788
|
-
readonly corpus: string;
|
|
789
|
-
/** The hash of the corpus: `corpusHashOf` of its manifest. */
|
|
790
|
-
readonly corpusHash: string;
|
|
791
|
-
/** The splits by name. Each split has one fold or more. */
|
|
792
|
-
readonly splits: Readonly<Record<string, {
|
|
793
|
-
readonly folds: readonly SplitFold[];
|
|
794
|
-
}>>;
|
|
795
|
-
}
|
|
796
|
-
/** The fields of a manifest that the split check reads. */
|
|
797
|
-
export interface SplitCorpus {
|
|
798
|
-
readonly corpus: string;
|
|
799
|
-
readonly specs: readonly {
|
|
800
|
-
readonly seeds: readonly number[];
|
|
801
|
-
}[];
|
|
802
|
-
readonly inputs: readonly CorpusEntry[];
|
|
803
|
-
}
|
|
804
|
-
/** This function gives the name of the split file of a corpus. */
|
|
805
|
-
export declare function splitFileName(corpus: string, hash: string): string;
|
|
806
|
-
/**
|
|
807
|
-
* This function checks a split file against a manifest. It gives one break `split` for each problem. An empty list tells that the file is good.
|
|
808
|
-
*
|
|
809
|
-
* - The schema is `corpus-split/1`, the corpus is the id of the manifest and `corpusHash` is `corpusHashOf` of the manifest.
|
|
810
|
-
* - Each split has one fold or more. In each fold, `train` and `heldOut` are lists of seeds, not empty and with no common seed.
|
|
811
|
-
* - Each seed is a seed of a spec of the manifest.
|
|
812
|
-
* - With `name`, the file has the split `name`.
|
|
813
|
-
*/
|
|
814
|
-
export declare function checkSplit(split: unknown, corpus: SplitCorpus, name?: string): ClaimBreak[];
|
|
815
|
-
/**
|
|
816
|
-
* This function gives a copy of the folds of the split `name` of a split file. `where` names the file in the text of an error.
|
|
817
|
-
* It throws an `Error` for each problem of `checkSplit`, and then for an unknown split name.
|
|
818
|
-
*/
|
|
819
|
-
export declare function splitFolds(split: unknown, corpus: SplitCorpus, name: string, where?: string): SplitFold[];
|
|
820
|
-
/** This function gives the folds that hold out one seed each, in the order of the seeds. Each fold trains on the other seeds. */
|
|
821
|
-
export declare function leaveOneSeedOut(seeds: readonly number[]): SplitFold[];
|
|
822
901
|
/** The schema of a strategy space. */
|
|
823
902
|
export declare const STRATEGY_SPACE_SCHEMA = "strategy-space/1";
|
|
824
903
|
/** The kind of a param: a whole number, a real number, one value of a list, or `true` and `false`. */
|
|
@@ -857,11 +936,23 @@ export interface MemberRule {
|
|
|
857
936
|
readonly max: number;
|
|
858
937
|
readonly ordered: boolean;
|
|
859
938
|
}
|
|
939
|
+
/** The inputs that an option supports. A missing field supports each value. */
|
|
940
|
+
export interface OptionSupports {
|
|
941
|
+
/** The shape kinds of the boxes (`docs/SHAPES.md`). Without it, the option supports each kind. */
|
|
942
|
+
readonly shape?: readonly ShapeKind[];
|
|
943
|
+
}
|
|
860
944
|
/** One implementation of a stage. An option with `members` is a meta option: it chooses between whole configs, or wraps them. */
|
|
861
945
|
export interface StageOption {
|
|
862
946
|
readonly id: string;
|
|
863
947
|
readonly params: readonly SpaceParam[];
|
|
864
948
|
readonly members?: MemberRule;
|
|
949
|
+
/** The inputs that the option supports. It describes the option, so it is not part of a config or of its id. */
|
|
950
|
+
readonly supports?: OptionSupports;
|
|
951
|
+
}
|
|
952
|
+
/** The shape kinds of the inputs of a check, a count or an enumeration. Without `shapes`, each option counts. */
|
|
953
|
+
export interface ShapeFilter {
|
|
954
|
+
/** The shape kinds of the input. Only the options that support each of these kinds count. */
|
|
955
|
+
readonly shapes?: readonly ShapeKind[];
|
|
865
956
|
}
|
|
866
957
|
/** One stage of the pipeline of an engine. A config of an `optional` stage can have no option. */
|
|
867
958
|
export interface SpaceStage {
|
|
@@ -917,21 +1008,21 @@ export interface SpaceSize {
|
|
|
917
1008
|
readonly meta: bigint | null;
|
|
918
1009
|
}
|
|
919
1010
|
/** The options of `spaceSize`. */
|
|
920
|
-
export interface SpaceSizeOptions {
|
|
1011
|
+
export interface SpaceSizeOptions extends ShapeFilter {
|
|
921
1012
|
/** The count of the levels of each numeric param, a whole number of 1 or more. */
|
|
922
1013
|
readonly levels: number;
|
|
923
1014
|
/** The largest meta count that `spaceSize` gives. The default is `10n ** 18n`. */
|
|
924
1015
|
readonly maxMeta?: bigint;
|
|
925
1016
|
}
|
|
926
1017
|
/** The options of a grid. The grid gives only the configs without a meta option. */
|
|
927
|
-
export interface GridOptions {
|
|
1018
|
+
export interface GridOptions extends ShapeFilter {
|
|
928
1019
|
readonly mode: "grid";
|
|
929
1020
|
readonly levels: number;
|
|
930
1021
|
/** The largest count of configs. A larger grid causes a `RangeError`. The default is 100000. */
|
|
931
1022
|
readonly limit?: number;
|
|
932
1023
|
}
|
|
933
1024
|
/** The options of a sample. */
|
|
934
|
-
export interface SampleOptions {
|
|
1025
|
+
export interface SampleOptions extends ShapeFilter {
|
|
935
1026
|
readonly mode: "sample";
|
|
936
1027
|
/** The count of the configs, a whole number of 0 or more. */
|
|
937
1028
|
readonly n: number;
|
|
@@ -946,8 +1037,9 @@ export type EnumerateOptions = GridOptions | SampleOptions;
|
|
|
946
1037
|
/**
|
|
947
1038
|
* This function checks one config of a space. It gives one break for each problem. An empty list tells that the config is good.
|
|
948
1039
|
* The `claim` of a break is the kind of the problem, for example `missing`, `unknown`, `inactive`, `param`, `constraint`, `members` or `depth`.
|
|
1040
|
+
* With `shapes`, an option that does not support a kind of the list gives the claim `shape`. A member of a meta option gets the same check.
|
|
949
1041
|
*/
|
|
950
|
-
export declare function checkConfig(space: StrategySpace, config: StrategyConfig): ClaimBreak[];
|
|
1042
|
+
export declare function checkConfig(space: StrategySpace, config: StrategyConfig, options?: ShapeFilter): ClaimBreak[];
|
|
951
1043
|
/**
|
|
952
1044
|
* This function checks a space. It gives one break for each problem. An empty list tells that the space is good.
|
|
953
1045
|
* It finds duplicate names, empty ranges, defaults out of range, enums without values, bad log scales, unknown names and bad named configs.
|
|
@@ -973,6 +1065,7 @@ export declare function paramLevels(param: SpaceParam, levels: number): ParamVal
|
|
|
973
1065
|
/**
|
|
974
1066
|
* This function gives the count of the grid points of a space, with `levels` levels for each numeric param.
|
|
975
1067
|
* It counts only the active params and the combinations that keep the constraints. It gives the meta configs apart.
|
|
1068
|
+
* With `shapes`, it counts only the options that support each kind of the list.
|
|
976
1069
|
*/
|
|
977
1070
|
export declare function spaceSize(space: StrategySpace, options: SpaceSizeOptions): SpaceSize;
|
|
978
1071
|
/**
|
|
@@ -981,8 +1074,14 @@ export declare function spaceSize(space: StrategySpace, options: SpaceSizeOption
|
|
|
981
1074
|
* - The mode `grid` gives each grid point without a meta option, in a stable order. Stages, options and values go in the order of the space.
|
|
982
1075
|
* - The mode `sample` gives `n` configs of a seeded Latin hypercube. The options of a stage get equal strata, and each active param gets its own strata.
|
|
983
1076
|
* - A sample draws again when a point breaks a constraint. After `maxTries` draws, it throws an `Error`. Two sampled configs can be equal.
|
|
1077
|
+
* - With `shapes`, only the options that support each kind of the list count. Without `shapes`, the result does not change.
|
|
984
1078
|
*/
|
|
985
1079
|
export declare function enumerateSpace(space: StrategySpace, options: EnumerateOptions): StrategyConfig[];
|
|
1080
|
+
/**
|
|
1081
|
+
* This function gives the shape kinds that a space accepts, in the order of `SHAPE_KINDS`. The value comes from the `supports` of the options.
|
|
1082
|
+
* A space accepts a kind when it has at least one config without a meta option on that kind.
|
|
1083
|
+
*/
|
|
1084
|
+
export declare function spaceShapeKinds(space: StrategySpace): ShapeKind[];
|
|
986
1085
|
/**
|
|
987
1086
|
* This function joins configs of the parts of a product space into one config of the space `space`.
|
|
988
1087
|
* The name of each stage gets the prefix `<space of the part>.`. The members of a meta option do not change.
|
|
@@ -1074,6 +1173,23 @@ export interface VerdictSignTest {
|
|
|
1074
1173
|
}
|
|
1075
1174
|
/** The label of a verdict. `better` and `worse` tell the side of `b`. */
|
|
1076
1175
|
export type VerdictLabel = "better" | "worse" | "depends on the mix" | "no verdict";
|
|
1176
|
+
/**
|
|
1177
|
+
* The scope of a verdict. The test keeps the families of the corpus as fixed, so its claim is about these families only.
|
|
1178
|
+
* It is not a claim about a new kind of input.
|
|
1179
|
+
*/
|
|
1180
|
+
export type VerdictScope = "these families";
|
|
1181
|
+
/**
|
|
1182
|
+
* The breadth of a verdict: the count of the families against its side.
|
|
1183
|
+
* The side is the side of the label. For `depends on the mix` and `no verdict`, it is the sign of the stratified mean.
|
|
1184
|
+
*/
|
|
1185
|
+
export interface VerdictBreadth {
|
|
1186
|
+
/** The count of the families with a sign against the side. A stratified mean of exactly 0 has no side, so this count is 0. */
|
|
1187
|
+
readonly against: number;
|
|
1188
|
+
/** The count of the families. */
|
|
1189
|
+
readonly of: number;
|
|
1190
|
+
/** The count of the families with the sign 0. */
|
|
1191
|
+
readonly ties: number;
|
|
1192
|
+
}
|
|
1077
1193
|
/** The result of `verdict`. */
|
|
1078
1194
|
export interface VerdictResult {
|
|
1079
1195
|
readonly measure: string;
|
|
@@ -1090,6 +1206,12 @@ export interface VerdictResult {
|
|
|
1090
1206
|
/** `true` only when the two means have the same sign, the two intervals are clear of 0 and the permutation p is below `level`. */
|
|
1091
1207
|
readonly agree: boolean;
|
|
1092
1208
|
readonly label: VerdictLabel;
|
|
1209
|
+
/** The scope of the claim: the families of the corpus, not a new kind of input. */
|
|
1210
|
+
readonly scope: VerdictScope;
|
|
1211
|
+
/** The count of the families against the side of the verdict, of all the families and of the ties. */
|
|
1212
|
+
readonly breadth: VerdictBreadth;
|
|
1213
|
+
/** The label, the scope and the breadth in one line, for example `better on these families, worse on 2 of 6 (1 tie)`. */
|
|
1214
|
+
readonly summary: string;
|
|
1093
1215
|
/** The inputs without a pair: one side has no record, a skipped record or no value of the measure. */
|
|
1094
1216
|
readonly dropped: readonly string[];
|
|
1095
1217
|
}
|
|
@@ -1100,6 +1222,7 @@ export interface VerdictResult {
|
|
|
1100
1222
|
* - `stratified` is the mean of the family means. Its bootstrap draws the seeds inside each family. `pooled` is the mean of the inputs.
|
|
1101
1223
|
* - The permutation test changes the sign of each difference inside its family. Its statistic is the mean of the family means.
|
|
1102
1224
|
* - The label is `better` or `worse` only when `agree` is `true`. Opposite signs of the two means give `depends on the mix`.
|
|
1225
|
+
* - `scope`, `breadth` and `summary` tell that the claim is about these families, and how many families are against it.
|
|
1103
1226
|
*
|
|
1104
1227
|
* It throws a `RangeError` for a missing `tie` or `level`, and for no pair. Two records of one side and input, or a value that is not finite, also cause a `RangeError`.
|
|
1105
1228
|
*/
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/geometry.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/geometry.ts","../src/corpus.ts","../src/input.ts","../src/shapes.ts","../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/measures.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/strategy-space.ts","../src/verdict.ts"],"mappings":";YACY;;qBAGC,gBAAgB;iBAEZ;WACN;WACA;;;iBAIM;WACN;WACA;WACA;WACA;;;iBAIM;WACN;WACA;WACA;WACA;;;;;;YAOC;WACG;WAAuB;WAAoB;WAAoB;WAAoB;;WAEnF;WACA;WACA;;WAEA;WAAyB;WAAqB;WAAqB;;WACnE;WAA0B;WAAqB;WAAqB;WAAqB;;;YAG5F,kBAAkB;;wBAGd,YAAY,QAAQ,qBAAqB;;wBAOzC,KAAK,MAAM,MAAM,QAAQ,qBAAqB;;wBAM9C,SAAS,QAAQ,SAAS;;wBAyB1B,UAAU,QAAQ,QAAQ,YAAY,aAAa;;;;;wBAoBnD,UAAU,GAAG,MAAM,GAAG;WAAkB;WAAoB;;;iBCnG3D;;WAEN;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA,QAAQ,SAAS;;WAEjB,WAAW;;WAEX;;;;;;;;YASC;;;;YAGA,aAAa,SAAS;;qBAGrB;;;;;;wBA4CG,SAAS,MAAM,YAAY,UAAU;;YAazC,SAAS,MAAM,OAAO;;;;;wBAMlB,eAAe,GAAG,QAAQ,SAAS,IAAI,UAAU,SAAS,IAAI,0BAA8B;;;;;wBAa5F,gBAAgB,mBAAmB;;;;;;;;;;;;;;;wBAuCnC,cAAc,GAC5B,QAAQ,SAAS,IACjB,UAAU,SAAS,IACnB,OAAO,eACP,yBACA,UAAS,OAAO,MAAM,yBACrB;;iBAiEc;WACN;WACA;;;;;;wBAOK,aAAa,gBAAgB,iBAAiB;;qBAKjD;;iBAGI;WACN;WACA;;;iBAIM;WACN,eAAe;WACf;;WAEA;;WAE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