@mark1russell7/layout-contract 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,6 +88,11 @@ declare function overlapOf(a: Rect, b: Rect): {
88
88
  * Segments that only touch at an end, or that are collinear, do not cross. The test has no tolerance.
89
89
  */
90
90
  declare function segmentsCross(a: Point, b: Point, c: Point, d: Point): boolean;
91
+ /**
92
+ * This function gives the point where the segments `ab` and `cd` cross, or `undefined`.
93
+ * It gives a point exactly when `segmentsCross` is true, so a touch at an end and collinear segments give `undefined`.
94
+ */
95
+ declare function crossingPoint(a: Point, b: Point, c: Point, d: Point): Point | undefined;
91
96
  /** This function gives the shortest distance from `p` to the segment `ab`. A segment of length 0 is the point `a`. */
92
97
  declare function pointSegmentDistance(p: Point, a: Point, b: Point): number;
93
98
  /** One broken claim of a corpus, with the ids of the inputs that break it. */
@@ -603,7 +608,7 @@ interface MeasureSpec<Id extends string = string> {
603
608
  readonly bound?: ShapeBound;
604
609
  }
605
610
  /** The id of a joint measure. `docs/JOINT-MEASURES.md` gives the definitions. */
606
- 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";
611
+ type JointMeasureId = "joint.fill" | "joint.aspectError" | "joint.spill" | "joint.straight.crossings" | "joint.straight.length" | "joint.stability.mean" | "joint.stability.moved" | "joint.proxy.rank" | "joint.route.length" | "joint.ms";
607
612
  /**
608
613
  * The specs of the joint measures, in the order of `docs/JOINT-MEASURES.md`.
609
614
  * `joint.fill` and `joint.straight.length` read the area of each box, so they support only `rect`. `docs/SHAPES.md` tells the reasons.
@@ -626,5 +631,5 @@ declare function minEffectOf(spec: Pick<MeasureSpec, "minEffect">, a?: number, b
626
631
  * Two equal values are a tie, also two infinite values. A value `NaN` is an error.
627
632
  */
628
633
  declare function compareMeasure(candidate: number, baseline: number, spec: Pick<MeasureSpec, "direction" | "minEffect">): Verdict;
629
- export { CorpusSplit as $, shapeKindsOf as A, regionArea as At, LayoutInput as B, checkShapes as C, Sides as Ct, ruleLevel as D, marginSides as Dt, itemShapeOf as E, grow as Et, LayoutBox as F, PairGap as G, PackInput as H, LayoutCell as I, packLinks as J, Port as K, LayoutContainer as L, shapeSupportProblems as M, toRect as Mt, shapesOf as N, toSizedRect as Nt, shapeKindOf as O, overlapOf as Ot, Item as P, translate as Pt, CorpusEntry as Q, LayoutEdge as R, boxArea as S, Side as St, isShapeKind as T, boundsOf as Tt, PackInputOptions as U, Obstacle as V, PackLink as W, toPackInput as X, portPoint as Y, ClaimBreak as Z, ShapeKind as _, Margin as _t, MeasureSpec as a, SPLIT_SCHEMA as at, ShapeLimit as b, Region as bt, minEffectOf as c, checkDeclared as ct, SHAPE_KINDS as d, declaredClaimOf as dt, DeclaredClaim as et, SHAPE_KIND_IDS as f, declaredCounts as ft, ShapeInput as g, splitFolds as gt, ShapeGeometry as h, splitFileName as ht, JointMeasureId as i, FamilyCell as it, shapeLevel as j, segmentsCross as jt, shapeKindProblem as k, pointSegmentDistance as kt, DEFAULT_SHAPES as l, checkSplit as lt, ShapeCheck as m, leaveOneSeedOut as mt, JOINT_MEASURES as n, FAMILY_ANY_KIND as nt, Verdict as o, SplitCorpus as ot, ShapeBound as p, familyOf as pt, canonicalInput as q, JOINT_MOVED_MIN as r, FamilyBy as rt, compareMeasure as s, SplitFold as st, Direction as t, Declares as tt, RuleLevel as u, corpusHashOf as ut, ShapeKindSpec as v, Point as vt, inputShapeLevel as w, SizedRect as wt, ShapeSupport as x, SIDES as xt, ShapeLevel as y, Rect as yt, LayoutGenerator as z };
630
- //# sourceMappingURL=measures-KWg_was6.d.ts.map
634
+ export { CorpusSplit as $, shapeKindsOf as A, pointSegmentDistance as At, LayoutInput as B, checkShapes as C, Sides as Ct, ruleLevel as D, grow as Dt, itemShapeOf as E, crossingPoint as Et, LayoutBox as F, translate as Ft, PairGap as G, PackInput as H, LayoutCell as I, packLinks as J, Port as K, LayoutContainer as L, shapeSupportProblems as M, segmentsCross as Mt, shapesOf as N, toRect as Nt, shapeKindOf as O, marginSides as Ot, Item as P, toSizedRect as Pt, CorpusEntry as Q, LayoutEdge as R, boxArea as S, Side as St, isShapeKind as T, boundsOf as Tt, PackInputOptions as U, Obstacle as V, PackLink as W, toPackInput as X, portPoint as Y, ClaimBreak as Z, ShapeKind as _, Margin as _t, MeasureSpec as a, SPLIT_SCHEMA as at, ShapeLimit as b, Region as bt, minEffectOf as c, checkDeclared as ct, SHAPE_KINDS as d, declaredClaimOf as dt, DeclaredClaim as et, SHAPE_KIND_IDS as f, declaredCounts as ft, ShapeInput as g, splitFolds as gt, ShapeGeometry as h, splitFileName as ht, JointMeasureId as i, FamilyCell as it, shapeLevel as j, regionArea as jt, shapeKindProblem as k, overlapOf as kt, DEFAULT_SHAPES as l, checkSplit as lt, ShapeCheck as m, leaveOneSeedOut as mt, JOINT_MEASURES as n, FAMILY_ANY_KIND as nt, Verdict as o, SplitCorpus as ot, ShapeBound as p, familyOf as pt, canonicalInput as q, JOINT_MOVED_MIN as r, FamilyBy as rt, compareMeasure as s, SplitFold as st, Direction as t, Declares as tt, RuleLevel as u, corpusHashOf as ut, ShapeKindSpec as v, Point as vt, inputShapeLevel as w, SizedRect as wt, ShapeSupport as x, SIDES as xt, ShapeLevel as y, Rect as yt, LayoutGenerator as z };
635
+ //# sourceMappingURL=measures-COqcrCzv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measures-COqcrCzv.d.ts","names":[],"sources":["../src/geometry.ts","../src/corpus.ts","../src/input.ts","../src/shapes.ts","../src/measures.ts"],"mappings":";KACY;;cAGC,gBAAgB;UAEZ;WACN;WACA;;;UAIM;WACN;WACA;WACA;WACA;;;;;;UAOM;WACN;WACA;WACA;WACA;;;iBAIK,OAAO,MAAM,YAAY;;iBAKzB,YAAY,MAAM,OAAO;;UAKxB;WACN;WACA;WACA;WACA;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function of a host: the width of a run of text in a font, in pixels.
4
4
  * A browser host gives `canvasAdvance(context)`. A test or a server host gives a function of a font file.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/layout-contract",
4
- "version": "0.5.0",
4
+ "version": "0.5.2",
5
5
  "description": "The shared contract of the packing and highways layout engines: the input and record formats, the turn rule, margins, tolerances and hard rules.",
6
6
  "keywords": [
7
7
  "layout",
package/src/families.ts CHANGED
@@ -832,6 +832,62 @@ export const EDGE_KEY_STEP: CorpusStep = /* @__PURE__ */ Object.freeze({
832
832
  apply: (input: LayoutInput, seed: number, d: DimensionValues) => edgeKeyStep(input, { edgeKey: edgeKeyOf(d) }, seed),
833
833
  });
834
834
 
835
+ /** The set of `CIRCLE_SCATTERED` when the caller gives no set. */
836
+ const CIRCLE_SET = "circle-v1";
837
+
838
+ /**
839
+ * The shared family `circle-scattered`, version 1: circle items of random whole radii in a fixed container, with no obstacles and no edges.
840
+ *
841
+ * - The dimension `containerShape` takes `rect` or `circle`. One seed gives the same radii in the 2 containers, so a pair joins on the seed.
842
+ * - The circles fill approximately half of the container, and the container is at least as large as the largest circle.
843
+ * - The stream `items` gives each radius, from 8 to 40. The stream `container` gives the width of a rectangle over its side, from 0.80 to 1.25.
844
+ * - The family has no margin and no gap. Each value comes from whole numbers and `Math.sqrt`, which each engine rounds correctly, so the family is `exact`.
845
+ */
846
+ export const CIRCLE_SCATTERED: CorpusFamily<LayoutInput> = /* @__PURE__ */ Object.freeze({
847
+ name: "circle-scattered",
848
+ version: 1,
849
+ owner: "layout-contract",
850
+ meaning: "Circle items of random radii in a fixed rectangle or circle container, which they fill approximately half.",
851
+ dimensions: /* @__PURE__ */ Object.freeze([/* @__PURE__ */ sharedDimension("count", { default: 40 }), /* @__PURE__ */ sharedDimension("containerShape", { supported: ["rect", "circle"] })]),
852
+ seeding: "stepRandom(seed, items) gives the radius of each item. stepRandom(seed, container) gives the width over the side of a rectangle, in hundredths.",
853
+ crossEngine: "exact",
854
+ generate(seed: number, dims: DimensionValues, context: GenerateContext): LayoutInput {
855
+ const count = dims["count"];
856
+ if (typeof count !== "number" || !Number.isInteger(count) || count < 0) throw new RangeError(`circle-scattered: the count is a whole number of 0 or more, not ${String(count)}.`);
857
+ const containerShape = dims["containerShape"];
858
+ if (containerShape !== "rect" && containerShape !== "circle") throw new RangeError(`circle-scattered: the container shape is rect or circle, not ${String(containerShape)}.`);
859
+ const set = context.set ?? CIRCLE_SET;
860
+ let r = stepRandom(seed, "items");
861
+ const radii = Array.from({ length: count }, () => randomInt(r, 8, 40));
862
+ const largest = radii.reduce((m, v) => Math.max(m, v), 1);
863
+ const squares = radii.reduce((sum, v) => sum + v * v, 0);
864
+ let container: LayoutInput["container"];
865
+ if (containerShape === "circle") {
866
+ const big = Math.max(largest, Math.ceil(Math.sqrt(2 * squares)));
867
+ container = { w: 2 * big, h: 2 * big, fixed: "size", shape: { kind: "circle", cx: big, cy: big, r: big } };
868
+ } else {
869
+ // The circles have the area PI * squares. A rectangle of 6.3 * squares holds them at approximately half, and 6.3 keeps PI out of the input.
870
+ const area = Math.ceil((63 * squares) / 10);
871
+ r = stepRandom(seed, "container");
872
+ const w = Math.max(2 * largest, Math.ceil((Math.sqrt(area) * randomInt(r, 80, 125)) / 100));
873
+ container = { w, h: Math.max(2 * largest, Math.ceil(area / w)), fixed: "size" };
874
+ }
875
+ const body: LayoutInput = {
876
+ schema: "layout-input/1",
877
+ id: `${set}/circle-scattered/${containerShape}/s${seed}`,
878
+ set,
879
+ family: "circle-scattered",
880
+ seed,
881
+ source: "made-up",
882
+ generator: { name: "circle-scattered", version: 1, params: { count, containerShape }, seed },
883
+ container,
884
+ boxes: radii.map((v, i) => ({ id: `c${i}`, w: 2 * v, h: 2 * v, shape: { kind: "circle", cx: v, cy: v, r: v } })),
885
+ edges: [],
886
+ };
887
+ return { ...body, hash: documentHash(body) };
888
+ },
889
+ });
890
+
835
891
  /** The set of `RECT_SCATTERED` when the caller gives no set. */
836
892
  const XCHECK_SET = "xcheck-v1";
837
893
 
package/src/geometry.ts CHANGED
@@ -175,6 +175,17 @@ export function segmentsCross(a: Point, b: Point, c: Point, d: Point): boolean {
175
175
  return opposite(orient(c, d, a), orient(c, d, b)) && opposite(orient(a, b, c), orient(a, b, d));
176
176
  }
177
177
 
178
+ /**
179
+ * This function gives the point where the segments `ab` and `cd` cross, or `undefined`.
180
+ * It gives a point exactly when `segmentsCross` is true, so a touch at an end and collinear segments give `undefined`.
181
+ */
182
+ export function crossingPoint(a: Point, b: Point, c: Point, d: Point): Point | undefined {
183
+ if (!segmentsCross(a, b, c, d)) return undefined;
184
+ const from = orient(c, d, a);
185
+ const t = from / (from - orient(c, d, b));
186
+ return { x: a.x + t * (b.x - a.x), y: a.y + t * (b.y - a.y) };
187
+ }
188
+
178
189
  /** This function gives the shortest distance from `p` to the segment `ab`. A segment of length 0 is the point `a`. */
179
190
  export function pointSegmentDistance(p: Point, a: Point, b: Point): number {
180
191
  const dx = b.x - a.x;
package/src/measures.ts CHANGED
@@ -49,6 +49,7 @@ export type JointMeasureId =
49
49
  | "joint.stability.mean"
50
50
  | "joint.stability.moved"
51
51
  | "joint.proxy.rank"
52
+ | "joint.route.length"
52
53
  | "joint.ms";
53
54
 
54
55
  /** The shape kinds of a joint measure that reads only the bounding boxes, the centers and the positions of the boxes. */
@@ -69,6 +70,7 @@ export const JOINT_MEASURES: readonly MeasureSpec<JointMeasureId>[] = /* @__PURE
69
70
  { id: "joint.stability.mean", minEffect: 0.005, unit: "W", direction: "lower", min: 0, max: Infinity, floor: 0, tol: 0.005, role: "change-guard", shapes: BOUNDS_ONLY },
70
71
  { id: "joint.stability.moved", minEffect: 0.02, unit: "0 to 1", direction: "lower", min: 0, max: 1, floor: 0, tol: 0.02, role: "change-guard", shapes: BOUNDS_ONLY },
71
72
  { id: "joint.proxy.rank", unit: "-1 to 1", direction: "higher", min: -1, max: 1, role: "diagnostic", shapes: BOUNDS_ONLY },
73
+ { id: "joint.route.length", unit: "layout units for each route", direction: "lower", min: 0, max: Infinity, role: "diagnostic", shapes: BOUNDS_ONLY },
72
74
  { id: "joint.ms", unit: "milliseconds", direction: "lower", min: 0, max: Infinity, role: "time", shapes: BOUNDS_ONLY },
73
75
  ] as const);
74
76
 
package/src/record.ts CHANGED
@@ -34,7 +34,9 @@ export interface LayoutRecord {
34
34
  readonly hardRule?: number;
35
35
  /**
36
36
  * The value is `true` when two runs with the same seed give the same positions.
37
- * A skipped record has `null`, because no run made a claim. Each other record has a boolean.
37
+ * A skipped record has `null`, because no run made a claim.
38
+ * A record with `oneRun: true` can also have `null`: the pair had no second run to compare.
39
+ * Each other record has a boolean.
38
40
  */
39
41
  readonly deterministic: boolean | null;
40
42
  /** The id of the prediction that was written before the run. */
@@ -46,6 +48,7 @@ export interface LayoutRecord {
46
48
  /**
47
49
  * The value is `true` when a measure of the pair chose 1 timed repeat and no warm-up.
48
50
  * Then `ms` is one time, so a time gate does not read this record.
51
+ * A bench that runs such a pair only once writes `deterministic: null`, and its record makes no claim on determinism.
49
52
  */
50
53
  readonly oneRun?: boolean;
51
54
  /** The wall budget of the pair of a strategy and an input, in milliseconds. */
@@ -153,7 +156,7 @@ export function hardRuleOf(record: Pick<LayoutRecord, "hardRule">): number {
153
156
  /**
154
157
  * This function gives the problems of one `layout-record/1` value. An empty list means a good record.
155
158
  * A record that has `skipped` has `deterministic: null`. An old skipped record with a boolean is also correct.
156
- * A record without `skipped` has a boolean. The check accepts fields that the format does not know.
159
+ * A record without `skipped` has a boolean, or `null` when it has `oneRun: true`. The check accepts fields that the format does not know.
157
160
  */
158
161
  export function checkLayoutRecord(value: unknown): string[] {
159
162
  if (!isFields(value)) return ["the record is not an object"];
@@ -179,7 +182,8 @@ export function checkLayoutRecord(value: unknown): string[] {
179
182
  if (v["env"] !== undefined) out.push(...envProblems(v["env"]));
180
183
  const deterministic = v["deterministic"];
181
184
  if (v["skipped"] === undefined) {
182
- if (typeof deterministic !== "boolean") out.push("deterministic is not a boolean, and the record has no skipped");
185
+ const noClaim = deterministic === null && v["oneRun"] === true;
186
+ if (typeof deterministic !== "boolean" && !noClaim) out.push("deterministic is not a boolean, and the record has no skipped");
183
187
  } else if (deterministic !== null && typeof deterministic !== "boolean") out.push("deterministic of a skipped record is not null or a boolean");
184
188
  return out;
185
189
  }
package/src/rules.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { boundsOf, grow, marginSides, overlapOf, type Margin, type Rect, type Region } from "./geometry.ts";
1
+ import { boundsOf, grow, marginSides, overlapOf, type Margin, type Point, type Rect, type Region } from "./geometry.ts";
2
2
  import type { LayoutBox, LayoutContainer, LayoutInput, Obstacle, PairGap, Port } from "./input.ts";
3
3
  import { applyPack, type PackOutput } from "./output.ts";
4
4
  import { SHAPE_KIND_IDS, shapeKindProblem, type ShapeSupport } from "./shapes.ts";
@@ -215,6 +215,109 @@ export function circlesOutside(input: LayoutInput, tolerance: number = DEFAULT_T
215
215
  return count;
216
216
  }
217
217
 
218
+ /** This function gives the length of the part of the segment `ab` inside a circle. A radius of 0 or less gives 0. */
219
+ function partInCircle(a: Point, b: Point, cx: number, cy: number, r: number): number {
220
+ if (r <= 0) return 0;
221
+ const dx = b.x - a.x;
222
+ const dy = b.y - a.y;
223
+ const fx = a.x - cx;
224
+ const fy = a.y - cy;
225
+ const l2 = dx * dx + dy * dy;
226
+ if (l2 === 0) return 0;
227
+ const half = fx * dx + fy * dy;
228
+ const inner = half * half - l2 * (fx * fx + fy * fy - r * r);
229
+ if (inner <= 0) return 0;
230
+ const root = Math.sqrt(inner);
231
+ const t0 = Math.max(0, (-half - root) / l2);
232
+ const t1 = Math.min(1, (-half + root) / l2);
233
+ return t1 > t0 ? (t1 - t0) * Math.sqrt(l2) : 0;
234
+ }
235
+
236
+ /** This function gives the length of the part of the segment `ab` inside the open box from (`x0`, `y0`) to (`x1`, `y1`). A box with no inside gives 0. */
237
+ function partInBox(a: Point, b: Point, x0: number, y0: number, x1: number, y1: number): number {
238
+ if (x1 <= x0 || y1 <= y0) return 0;
239
+ const dx = b.x - a.x;
240
+ const dy = b.y - a.y;
241
+ let t0 = 0;
242
+ let t1 = 1;
243
+ for (const [from, d, lo, hi] of [[a.x, dx, x0, x1], [a.y, dy, y0, y1]] as const) {
244
+ if (d === 0) {
245
+ if (from <= lo || from >= hi) return 0;
246
+ continue;
247
+ }
248
+ const ta = (lo - from) / d;
249
+ const tb = (hi - from) / d;
250
+ t0 = Math.max(t0, Math.min(ta, tb));
251
+ t1 = Math.min(t1, Math.max(ta, tb));
252
+ if (t0 > t1) return 0;
253
+ }
254
+ return (t1 - t0) * Math.sqrt(dx * dx + dy * dy);
255
+ }
256
+
257
+ /**
258
+ * This function tells if the segment `ab` goes through a placed box, by the rule of `Tolerance.through`.
259
+ * A part of the segment longer than `tolerance` is inside the shape made `tolerance` smaller.
260
+ *
261
+ * - A circle box reads its circle. Each other kind reads its bounding box, so on a polygon or a free shape the answer is an upper bound.
262
+ * - The margin of the box does not count. A box without a position gives `false`.
263
+ */
264
+ export function segmentThroughShape(a: Point, b: Point, box: LayoutBox, tolerance: number = DEFAULT_TOLERANCE.through): boolean {
265
+ const disc = placedCircle(box);
266
+ if (disc !== undefined) return partInCircle(a, b, disc.cx, disc.cy, disc.r - tolerance) > tolerance;
267
+ const r = placedRect(box);
268
+ if (r === undefined) return false;
269
+ return partInBox(a, b, r.x + tolerance, r.y + tolerance, r.x + r.w - tolerance, r.y + r.h - tolerance) > tolerance;
270
+ }
271
+
272
+ /** A route between two boxes: the ids of its ends and its points. `countLinksThroughShapes` reads it. */
273
+ export interface ShapeLink {
274
+ readonly source: string;
275
+ readonly target: string;
276
+ readonly points: readonly Point[];
277
+ }
278
+
279
+ /**
280
+ * This function counts the routes that go through a placed box that is not one of their two ends, by `segmentThroughShape`.
281
+ * A route counts once, also when it goes through more than one box.
282
+ */
283
+ export function countLinksThroughShapes(boxes: readonly LayoutBox[], links: readonly ShapeLink[], tolerance: number = DEFAULT_TOLERANCE.through): number {
284
+ const placed = boxes.flatMap((box) => {
285
+ const r = placedRect(box);
286
+ return r === undefined ? [] : [{ box, r }];
287
+ });
288
+ placed.sort((p, q) => p.r.x - q.r.x);
289
+ const widest = placed.reduce((m, p) => Math.max(m, p.r.w), 0);
290
+ const firstAt = (x: number): number => {
291
+ let lo = 0;
292
+ let hi = placed.length;
293
+ while (lo < hi) {
294
+ const mid = (lo + hi) >>> 1;
295
+ if (placed[mid]!.r.x < x) lo = mid + 1;
296
+ else hi = mid;
297
+ }
298
+ return lo;
299
+ };
300
+ let count = 0;
301
+ for (const link of links) {
302
+ let hit = false;
303
+ for (let i = 1; i < link.points.length && !hit; i++) {
304
+ const a = link.points[i - 1]!;
305
+ const b = link.points[i]!;
306
+ const left = Math.min(a.x, b.x);
307
+ const right = Math.max(a.x, b.x);
308
+ const top = Math.min(a.y, b.y);
309
+ const bottom = Math.max(a.y, b.y);
310
+ for (let k = firstAt(left - widest); k < placed.length && placed[k]!.r.x < right && !hit; k++) {
311
+ const { box, r } = placed[k]!;
312
+ if (r.x + r.w <= left || r.y >= bottom || r.y + r.h <= top) continue;
313
+ if (box.id !== link.source && box.id !== link.target && segmentThroughShape(a, b, box, tolerance)) hit = true;
314
+ }
315
+ }
316
+ if (hit) count++;
317
+ }
318
+ return count;
319
+ }
320
+
218
321
  /**
219
322
  * This function counts the placed boxes that go out of the container.
220
323
  * Each box with its margin must stay inside the container made smaller by `inset`. Only the fixed sides of the size count. A shaped container counts as its bounding box.
@@ -0,0 +1,63 @@
1
+ // The walk draw of a sample of a strategy space (`docs/STRATEGY-SPACE.md`). The package root does not export this file.
2
+ import type { OptionRef, SpaceConstraint, SpaceStage, StageOption } from "./strategy-space.ts";
3
+
4
+ const refMatches = (ref: OptionRef, choices: ReadonlyMap<string, string | null>): boolean => (choices.get(ref.stage) ?? null) === ref.option;
5
+
6
+ /** This function tells if the option choices keep a constraint. */
7
+ export function holds(c: SpaceConstraint, choices: ReadonlyMap<string, string | null>): boolean {
8
+ if (!refMatches(c.if, choices)) return true;
9
+ return "not" in c.then ? !refMatches(c.then.not, choices) : refMatches(c.then, choices);
10
+ }
11
+
12
+ const otherStage = (c: SpaceConstraint): string => ("not" in c.then ? c.then.not.stage : c.then.stage);
13
+
14
+ /** This function tells if an option of a stage keeps each constraint between that stage and the stages that a walk has fixed. */
15
+ export function fitsWalk(constraints: readonly SpaceConstraint[], fixed: Map<string, string | null>, stage: string, id: string | null): boolean {
16
+ fixed.set(stage, id);
17
+ const ok = constraints.every((c) => !fixed.has(c.if.stage === stage ? otherStage(c) : c.if.stage) || holds(c, fixed));
18
+ fixed.delete(stage);
19
+ return ok;
20
+ }
21
+
22
+ /** The order of the stages of a walk, and the constraints that name each stage. */
23
+ export interface WalkPlan {
24
+ /** The stages of the space. */
25
+ readonly stages: readonly SpaceStage[];
26
+ /** The options of each stage for a draw. */
27
+ readonly lists: readonly (readonly (StageOption | null)[])[];
28
+ /** The indexes of the stages, from the largest stage to the smallest. */
29
+ readonly order: readonly number[];
30
+ /** The constraints that name each stage. */
31
+ readonly naming: readonly (readonly SpaceConstraint[])[];
32
+ /** The count of points of a round. */
33
+ readonly n: number;
34
+ }
35
+
36
+ /** This function gives the plan of a walk. Stages of equal size keep the order of the space. */
37
+ export function walkPlan(stages: readonly SpaceStage[], lists: readonly (readonly (StageOption | null)[])[], constraints: readonly SpaceConstraint[], n: number): WalkPlan {
38
+ return {
39
+ stages,
40
+ lists,
41
+ n,
42
+ order: stages.map((_, k) => k).sort((a, b) => lists[b]!.length - lists[a]!.length || a - b),
43
+ naming: stages.map((s) => constraints.filter((c) => c.if.stage === s.name || otherStage(c) === s.name)),
44
+ };
45
+ }
46
+
47
+ /**
48
+ * This function gives the options of one point of a walk. It fixes the largest stage first. Thus that stage keeps its equal strata, and the constraints limit only the smaller stages.
49
+ * The value `picks[k][i]` is the stratum of the stage `k` for the point `i`. A stage with no open option gets `null`, and the caller rejects that point.
50
+ * The argument `fits` lets a test give a fault. The default is `fitsWalk`.
51
+ */
52
+ export function walkPoint(plan: WalkPlan, picks: readonly (readonly number[])[], i: number, fits: typeof fitsWalk = fitsWalk): Map<string, StageOption | null> {
53
+ const fixed = new Map<string, string | null>();
54
+ const out = new Map<string, StageOption | null>();
55
+ for (const k of plan.order) {
56
+ const s = plan.stages[k]!;
57
+ const open = plan.lists[k]!.filter((o) => fits(plan.naming[k]!, fixed, s.name, o?.id ?? null));
58
+ const o = open[Math.floor((picks[k]![i]! * open.length) / plan.n)] ?? null;
59
+ fixed.set(s.name, o?.id ?? null);
60
+ out.set(s.name, o);
61
+ }
62
+ return out;
63
+ }
@@ -2,6 +2,7 @@
2
2
  import type { ClaimBreak } from "./corpus.ts";
3
3
  import { canonicalJson, sha256Hex } from "./hash.ts";
4
4
  import { stepRandom } from "./random.ts";
5
+ import { holds, walkPlan, walkPoint } from "./space-walk.ts";
5
6
  import { isShapeKind, SHAPE_KIND_IDS, type ShapeKind } from "./shapes.ts";
6
7
 
7
8
  /** The schema of a strategy space. */
@@ -164,6 +165,14 @@ export interface SampleOptions extends ShapeFilter {
164
165
  readonly meta?: "skip" | "sample";
165
166
  /** The largest count of option draws. The default is the larger value of 1000 and `100 * n`. */
166
167
  readonly maxTries?: number;
168
+ /**
169
+ * How a point keeps the constraints. With `reject` (the default), a point that breaks a constraint draws again.
170
+ * With `walk`, a point draws its stages from the largest to the smallest. Each stage draws only from the options that keep the constraints with the stages before it.
171
+ * A space whose constraints reject most draws gets its sample with `walk`. The two values give different configs for one seed.
172
+ * A sample of `walk` is not uniform over the valid configs. Each option of the largest stage gets an equal share, whatever count of valid configs it has.
173
+ * Thus a mean over this sample is not a mean of the space.
174
+ */
175
+ readonly draw?: "reject" | "walk";
167
176
  }
168
177
 
169
178
  /** The options of `enumerateSpace`. */
@@ -245,14 +254,6 @@ function partOf(space: StrategySpace, stage: string): { readonly space: Strategy
245
254
  /** This function gives the prefix of the innermost part of each stage. */
246
255
  const prefixes = (space: StrategySpace): Map<string, string> => new Map(space.stages.map((s) => [s.name, partOf(space, s.name).prefix]));
247
256
 
248
- const refMatches = (ref: OptionRef, choices: ReadonlyMap<string, string | null>): boolean => (choices.get(ref.stage) ?? null) === ref.option;
249
-
250
- /** This function tells if the option choices keep a constraint. */
251
- function holds(c: SpaceConstraint, choices: ReadonlyMap<string, string | null>): boolean {
252
- if (!refMatches(c.if, choices)) return true;
253
- return "not" in c.then ? !refMatches(c.then.not, choices) : refMatches(c.then, choices);
254
- }
255
-
256
257
  const describe = (c: SpaceConstraint): string => {
257
258
  const ref = (r: OptionRef): string => `${r.stage}=${r.option ?? "null"}`;
258
259
  return "not" in c.then ? `if ${ref(c.if)} then not ${ref(c.then.not)}` : `if ${ref(c.if)} then ${ref(c.then)}`;
@@ -949,7 +950,7 @@ const subSeed = (seed: number, step: string): number => Math.floor(stepRandom(se
949
950
  * This function gives a sample of a space: Latin hypercube strata over the options, the params and the member counts.
950
951
  * `canon` is the space of `canonicalConfig`: the space before a shape filter. A member of an option with `view: "bounds"` can have an option that the filter removed.
951
952
  */
952
- function sampleConfigs(space: StrategySpace, n: number, seed: number, meta: boolean, maxTries: number, canon: StrategySpace = space): StrategyConfig[] {
953
+ function sampleConfigs(space: StrategySpace, n: number, seed: number, meta: boolean, maxTries: number, canon: StrategySpace = space, walk = false): StrategyConfig[] {
953
954
  const stages = space.stages;
954
955
  const prefix = prefixes(space);
955
956
  // A stage without options can stay empty in a part with a meta option of `view: "bounds"`, because that option replaces the stage.
@@ -968,15 +969,17 @@ function sampleConfigs(space: StrategySpace, n: number, seed: number, meta: bool
968
969
  if (!usable.has(o)) usable.set(o, hasMembers(space, s.name, o));
969
970
  return usable.get(o)!;
970
971
  };
972
+ const plan = walk ? walkPlan(stages, lists, space.constraints ?? [], n) : null;
971
973
  const points: Map<string, StageOption | null>[] = [];
972
974
  let tries = 0;
973
975
  for (let round = 0; points.length < n; round++) {
974
976
  const r = stepRandom(seed, `options:${round}`);
975
- const columns = lists.map((list) => permutation(n, r).map((p) => list[Math.floor((p * list.length) / n)]!));
977
+ const picks = walk ? lists.map(() => permutation(n, r)) : [];
978
+ const columns = walk ? [] : lists.map((list) => permutation(n, r).map((p) => list[Math.floor((p * list.length) / n)]!));
976
979
  for (let i = 0; i < n && points.length < n; i++) {
977
- if (tries >= maxTries) throw new Error(`The constraints of the space ${space.engine} remove too many points: ${points.length} of ${n} configs after ${tries} tries.`);
980
+ if (tries >= maxTries) throw new Error(`The constraints of the space ${space.engine} remove too many points: ${points.length} of ${n} configs after ${tries} tries.${walk ? "" : ' The option draw: "walk" gets a sample of a space with many constraints.'}`);
978
981
  tries++;
979
- const choices = new Map<string, StageOption | null>(stages.map((s, k) => [s.name, columns[k]![i]!]));
982
+ const choices = plan !== null ? walkPoint(plan, picks, i) : new Map<string, StageOption | null>(stages.map((s, k) => [s.name, columns[k]![i]!]));
980
983
  const metaPart = new Map<string, string>();
981
984
  for (const s of stages) {
982
985
  const o = choices.get(s.name);
@@ -1015,7 +1018,7 @@ function sampleConfigs(space: StrategySpace, n: number, seed: number, meta: bool
1015
1018
  const part = memberSpaces.get(o) ?? partOf(space, s.name).space;
1016
1019
  const poolSize = Math.max(n, 4 * o.members.max, 8);
1017
1020
  const seen = new Set<string>();
1018
- const pool = sampleConfigs(part, poolSize, subSeed(seed, `pool:${s.name}:${o.id}`), false, Math.max(1000, 100 * poolSize)).filter((c) => {
1021
+ const pool = sampleConfigs(part, poolSize, subSeed(seed, `pool:${s.name}:${o.id}`), false, Math.max(1000, 100 * poolSize), part, walk).filter((c) => {
1019
1022
  const id = idOf(c);
1020
1023
  return seen.has(id) ? false : (seen.add(id), true);
1021
1024
  });
@@ -1045,6 +1048,7 @@ function sampleConfigs(space: StrategySpace, n: number, seed: number, meta: bool
1045
1048
  * - 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.
1046
1049
  * - 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.
1047
1050
  * - A sample draws again when a point breaks a constraint. After `maxTries` draws, it throws an `Error`. Two sampled configs can be equal.
1051
+ * - With `draw: "walk"`, each stage draws only from the options that keep the constraints with the stages before it. The largest stage keeps its equal strata.
1048
1052
  * - With `shapes`, only the options that support each kind of the list count. Without `shapes`, the result does not change.
1049
1053
  * - A meta option with a `pool` gives only the entries of its pool. With `shapes`, only the entries whose members support each kind count.
1050
1054
  * - A sample draws again when a point chooses a meta option without a member list. `spaceSize` gives such an option 0.
@@ -1062,10 +1066,12 @@ export function enumerateSpace(space: StrategySpace, options: EnumerateOptions):
1062
1066
  if (!Number.isInteger(options.seed)) throw new RangeError(`The seed ${options.seed} is not a whole number.`);
1063
1067
  const meta = options.meta ?? "skip";
1064
1068
  if (meta !== "skip" && meta !== "sample") throw new RangeError(`The option meta is ${String(meta)}, not skip or sample.`);
1069
+ const draw = options.draw ?? "reject";
1070
+ if (draw !== "reject" && draw !== "walk") throw new RangeError(`The option draw is ${String(draw)}, not reject or walk.`);
1065
1071
  if (options.n === 0) return [];
1066
1072
  const kept = restrict(space, options.shapes);
1067
1073
  try {
1068
- return sampleConfigs(kept, options.n, options.seed, meta === "sample", options.maxTries ?? Math.max(1000, 100 * options.n), space);
1074
+ return sampleConfigs(kept, options.n, options.seed, meta === "sample", options.maxTries ?? Math.max(1000, 100 * options.n), space, draw === "walk");
1069
1075
  } catch (error) {
1070
1076
  // Only a space without a config for the shape kinds gives the RangeError. A different failure keeps its own error.
1071
1077
  if (options.shapes !== undefined && !hasConfig(kept, meta === "sample")) throw noSample(space, kept, options.shapes, meta === "sample");
package/src/tolerance.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  /** The epsilon for the float compares in an engine. */
2
2
  export const EPS = 1e-6;
3
3
 
4
+ /** The count of `EPS` steps in one layout unit. It is the integer equal to `1 / EPS`. */
5
+ export const EPS_STEPS = 1_000_000;
6
+
4
7
  /**
5
8
  * 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`.
6
9
  * Use a multiplication by this value, not a division by `RECORD_EPS`. The two differ at some half steps.
@@ -1 +0,0 @@
1
- {"version":3,"file":"measures-KWg_was6.d.ts","names":[],"sources":["../src/geometry.ts","../src/corpus.ts","../src/input.ts","../src/shapes.ts","../src/measures.ts"],"mappings":";KACY;;cAGC,gBAAgB;UAEZ;WACN;WACA;;;UAIM;WACN;WACA;WACA;WACA;;;;;;UAOM;WACN;WACA;WACA;WACA;;;iBAIK,OAAO,MAAM,YAAY;;iBAKzB,YAAY,MAAM,OAAO;;UAKxB;WACN;WACA;WACA;WACA;;;;;;KAOC;WACG;WAAuB;WAAoB;WAAoB;WAAoB;;WAEnF;WACA;WACA;;WAEA;WAAyB;WAAqB;WAAqB;;WACnE;WAA0B;WAAqB;WAAqB;WAAqB;;;KAG5F,kBAAkB;;iBAGd,YAAY,QAAQ,qBAAqB;;iBAOzC,KAAK,MAAM,MAAM,QAAQ,qBAAqB;;iBAM9C,SAAS,QAAQ,SAAS;;;;;iBA4B1B,WAAW,QAAQ;;iBAyBnB,UAAU,QAAQ,QAAQ,YAAY,aAAa;;;;;iBAoBnD,UAAU,GAAG,MAAM,GAAG;WAAkB;WAAoB;;;;;;iBAqB5D,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG;;iBAK/C,qBAAqB,GAAG,OAAO,GAAG,OAAO,GAAG;;UC9K3C;;WAEN;;WAEA;;WAEA;;;UAIM;;WAEN;;WAEA;;WAEA,QAAQ,SAAS;;WAEjB,WAAW;;WAEX;;;;;;;;KASC;;;;KAGA,aAAa,SAAS;;cAGrB;;;;;;iBA4CG,SAAS,MAAM,YAAY,UAAU;;KAazC,SAAS,MAAM,OAAO;;;;;iBAMlB,eAAe,GAAG,QAAQ,SAAS,IAAI,UAAU,SAAS,IAAI,0BAA8B;;;;;iBAa5F,gBAAgB,mBAAmB;;;;;;;;;;;;;;;iBAuCnC,cAAc,GAC5B,QAAQ,SAAS,IACjB,UAAU,SAAS,IACnB,OAAO,eACP,yB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