@mark1russell7/rigor-generators 0.1.16 → 0.1.17
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 +30 -0
- package/build/covering.d.ts +54 -0
- package/build/covering.d.ts.map +1 -0
- package/build/covering.js +187 -0
- package/build/covering.js.map +1 -0
- package/build/index.d.ts +2 -1
- package/build/index.js +2 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -143,6 +143,36 @@ The parameters of a dimension come from `r.fork("dimension:" + name)`. The same
|
|
|
143
143
|
|
|
144
144
|
For the mean of a sum of 3 inputs from 50 points, the Latin hypercube gives 0.00042 of the variance of the random design. A test holds the ratio below 1/1000.
|
|
145
145
|
|
|
146
|
+
## Covering arrays
|
|
147
|
+
|
|
148
|
+
A covering array of strength `t` has few rows, but each combination of `t` values of `t` different dimensions is in one row or more.
|
|
149
|
+
The default strength is 2, so each pair of values is in a row. A test of each row then finds each fault that 2 values cause together.
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
import { coveringRows, random, tupleCoverage } from "@mark1russell7/rigor-generators";
|
|
153
|
+
|
|
154
|
+
const dimensions = { shape: ["rect", "circle", "polygon"], count: [1, 10, 100], edges: ["none", "few", "many"], spacing: [0, 4] };
|
|
155
|
+
const rows = coveringRows(dimensions, random(1).fork("pairwise"));
|
|
156
|
+
// 9 rows hold the 45 pairs. The full product has 54 rows.
|
|
157
|
+
tupleCoverage(rows, dimensions).share; // 1
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
- `coveringArray(levels, r, options)` gives the index of a level of each dimension. `coveringRows(dimensions, r, options)` gives the values by name.
|
|
161
|
+
- The option `strength` sets `t`. With fewer dimensions than `t`, the array is the full product.
|
|
162
|
+
- The algorithm is a greedy AETG. It makes `candidates` rows (the default is 50) for each row that it keeps.
|
|
163
|
+
- The arrays are small, but not always the smallest. The row count is at least the product of the `t` largest counts of levels.
|
|
164
|
+
- The draws come from `r`. The same dimensions, options and seed give the same rows.
|
|
165
|
+
- `tupleCoverage(rows, dimensions, t)` gives the share of the combinations that some rows hold, and the list of the missing combinations. It compares the values as text.
|
|
166
|
+
- More than `COVERING_LIMIT` (10 million) combinations is a `RangeError`, not a long run.
|
|
167
|
+
|
|
168
|
+
### Moves from the copies
|
|
169
|
+
|
|
170
|
+
| Copy | Move |
|
|
171
|
+
| --- | --- |
|
|
172
|
+
| `pairwise(dimensions, seed)` of `packages/joint` in `layout-contract` | `coveringRows(dimensions, random(seed).fork("pairwise"))` gives the same rows. A test holds a record of the copy. One dimension gives a row for each value, not no rows. |
|
|
173
|
+
| `coverage(cells, dimensions)` of `packages/joint` in `layout-contract` | `tupleCoverage(cells, dimensions)`. The field `pairs` becomes `tuples`. A missing pair has the same key. |
|
|
174
|
+
| `allPairs` and `pairsOf` of `bench/law-cover.ts` in `packing` | `tupleCoverage`. The key of a pair changes from `area:x+aspect:y` to `area=x&aspect=y`. |
|
|
175
|
+
|
|
146
176
|
## The input of `fnv1a32`
|
|
147
177
|
|
|
148
178
|
The option `input` of `fnv1a32` selects the units that the hash reads. Use it to replace a local copy of FNV-1a with the same hashes.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Covering arrays: few rows that still hold each combination of `t` values of `t` different dimensions.
|
|
3
|
+
* With the strength 2, each pair of values of 2 dimensions is in one row or more (a pairwise array).
|
|
4
|
+
*/
|
|
5
|
+
import { Random } from "./random.js";
|
|
6
|
+
/** The default count of candidate rows for each row that `coveringArray` keeps. */
|
|
7
|
+
export declare const COVERING_CANDIDATES = 50;
|
|
8
|
+
/** The largest count of combinations of values that one array covers. A larger array is an error, not a long run. */
|
|
9
|
+
export declare const COVERING_LIMIT = 1e7;
|
|
10
|
+
/** The options of `coveringArray` and `coveringRows`. */
|
|
11
|
+
export interface CoveringOptions {
|
|
12
|
+
/** The strength `t`: each `t` values of `t` different dimensions are in one row or more. The default is 2. */
|
|
13
|
+
readonly strength?: number;
|
|
14
|
+
/** The count of candidate rows for each row that the array keeps. The default is `COVERING_CANDIDATES`. */
|
|
15
|
+
readonly candidates?: number;
|
|
16
|
+
}
|
|
17
|
+
/** The coverage of a set of rows over some dimensions. */
|
|
18
|
+
export interface Coverage {
|
|
19
|
+
/** The count of the combinations of `t` values of `t` different dimensions. */
|
|
20
|
+
readonly tuples: number;
|
|
21
|
+
/** The count of the combinations that one row or more holds. */
|
|
22
|
+
readonly covered: number;
|
|
23
|
+
/** `covered` divided by `tuples`. Dimensions with no combination give 1. */
|
|
24
|
+
readonly share: number;
|
|
25
|
+
/** The combinations that no row holds, as `<dimension>=<value>&<dimension>=<value>`, in the order of the dimensions. */
|
|
26
|
+
readonly missing: readonly string[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This function gives a covering array of strength `t` over dimensions with `levels[i]` levels each. Each row has the index
|
|
30
|
+
* of one level of each dimension. With fewer dimensions than `t`, the array covers each combination of all the dimensions.
|
|
31
|
+
* Thus no dimensions give one empty row, as the product of no sets has one item.
|
|
32
|
+
*
|
|
33
|
+
* The algorithm is a greedy AETG. Each row starts at a level with the most open combinations. The array makes `candidates`
|
|
34
|
+
* rows, and it keeps the row that covers the most new combinations. Each candidate takes the dimensions in a random order.
|
|
35
|
+
* Each dimension takes the level that covers the most new combinations with the dimensions before it.
|
|
36
|
+
* The random draws come from `r`, thus the same levels, options and seed give the same rows.
|
|
37
|
+
*
|
|
38
|
+
* This function throws a `RangeError` for a dimension with no level, for bad options, and for more than `COVERING_LIMIT` combinations.
|
|
39
|
+
*/
|
|
40
|
+
export declare function coveringArray(levels: readonly number[], r: Random, options?: CoveringOptions): number[][];
|
|
41
|
+
/**
|
|
42
|
+
* This function gives a covering array over named dimensions: each row has one value of each dimension. The values of a
|
|
43
|
+
* dimension are its levels, in their order. The options and the draws are those of `coveringArray`. The value of each name
|
|
44
|
+
* in a row has the type of the levels of its dimension. Thus dimensions of different types can be in one call.
|
|
45
|
+
*/
|
|
46
|
+
export declare function coveringRows<D extends Readonly<Record<string, readonly unknown[]>>>(dimensions: D, r: Random, options?: CoveringOptions): { [K in keyof D]: D[K][number]; }[];
|
|
47
|
+
/**
|
|
48
|
+
* This function gives the coverage of some rows over named dimensions, with the strength `t` (the default is 2). A row holds a
|
|
49
|
+
* combination when it has each of its values. The function compares the values as text with `String`, and it ignores the
|
|
50
|
+
* fields of a row that are not dimensions. With fewer dimensions than `t`, the combinations are those of all the dimensions.
|
|
51
|
+
* Thus no dimensions give one empty combination, with the key `""`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function tupleCoverage(rows: readonly Readonly<Record<string, unknown>>[], dimensions: Readonly<Record<string, readonly unknown[]>>, strength?: number): Coverage;
|
|
54
|
+
//# sourceMappingURL=covering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"covering.d.ts","names":[],"sources":["../src/covering.ts"],"mappings":";;;;;;qBAOa;;qBAGA;;iBAGI;;WAEN;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA;;WAEA;;;;;;;;;;;;;;wBA2CK,cAAc,2BAA2B,GAAG,QAAQ,UAAS;;;;;;wBA8G7D,aAAa,UAAU,SAAS,qCAAqC,YAAY,GAAG,GAAG,QAAQ,UAAS,qBAA0B,WAAW,IAAI,EAAE;;;;;;;wBAgBnJ,cAAc,eAAe,SAAS,4BAA4B,YAAY,SAAS,qCAAqC,oBAAe"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// src/covering.ts
|
|
2
|
+
/** The default count of candidate rows for each row that `coveringArray` keeps. */
|
|
3
|
+
const COVERING_CANDIDATES = 50;
|
|
4
|
+
/** The largest count of combinations of values that one array covers. A larger array is an error, not a long run. */
|
|
5
|
+
const COVERING_LIMIT = 1e7;
|
|
6
|
+
const isWhole = (value, least) => typeof value === "number" && Number.isSafeInteger(value) && value >= least;
|
|
7
|
+
/** This function gives each set of `t` indices from 0 to `k - 1`, each set in increasing order, the sets in lexical order. */
|
|
8
|
+
function combinations(k, t) {
|
|
9
|
+
const out = [];
|
|
10
|
+
const pick = [];
|
|
11
|
+
const walk = (from) => {
|
|
12
|
+
if (pick.length === t) {
|
|
13
|
+
out.push([...pick]);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
for (let i = from; i <= k - (t - pick.length); i++) {
|
|
17
|
+
pick.push(i);
|
|
18
|
+
walk(i + 1);
|
|
19
|
+
pick.pop();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
walk(0);
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
/** This function checks the options and gives the strength for `k` dimensions: the given strength, or `k` when there are fewer dimensions. */
|
|
26
|
+
function strengthOf(k, options) {
|
|
27
|
+
const strength = options.strength ?? 2;
|
|
28
|
+
if (!isWhole(strength, 1)) throw new RangeError(`covering: the strength is a whole number of 1 or more, not ${String(strength)}.`);
|
|
29
|
+
return Math.min(strength, k);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* This function gives a covering array of strength `t` over dimensions with `levels[i]` levels each. Each row has the index
|
|
33
|
+
* of one level of each dimension. With fewer dimensions than `t`, the array covers each combination of all the dimensions.
|
|
34
|
+
* Thus no dimensions give one empty row, as the product of no sets has one item.
|
|
35
|
+
*
|
|
36
|
+
* The algorithm is a greedy AETG. Each row starts at a level with the most open combinations. The array makes `candidates`
|
|
37
|
+
* rows, and it keeps the row that covers the most new combinations. Each candidate takes the dimensions in a random order.
|
|
38
|
+
* Each dimension takes the level that covers the most new combinations with the dimensions before it.
|
|
39
|
+
* The random draws come from `r`, thus the same levels, options and seed give the same rows.
|
|
40
|
+
*
|
|
41
|
+
* This function throws a `RangeError` for a dimension with no level, for bad options, and for more than `COVERING_LIMIT` combinations.
|
|
42
|
+
*/
|
|
43
|
+
function coveringArray(levels, r, options = {}) {
|
|
44
|
+
for (const [i, size] of levels.entries()) if (!isWhole(size, 1)) throw new RangeError(`coveringArray: dimension ${i} has ${String(size)} levels, not a whole number of 1 or more.`);
|
|
45
|
+
const t = strengthOf(levels.length, options);
|
|
46
|
+
const candidates = options.candidates ?? 50;
|
|
47
|
+
if (!isWhole(candidates, 1)) throw new RangeError(`coveringArray: candidates is a whole number of 1 or more, not ${String(candidates)}.`);
|
|
48
|
+
const k = levels.length;
|
|
49
|
+
if (k === 0) return [[]];
|
|
50
|
+
const combos = combinations(k, t);
|
|
51
|
+
const comboOf = new Map(combos.map((combo, index) => [combo.join(","), index]));
|
|
52
|
+
const sizes = combos.map((combo) => combo.reduce((product, d) => product * levels[d], 1));
|
|
53
|
+
const total = sizes.reduce((sum, size) => sum + size, 0);
|
|
54
|
+
if (total > 1e7) throw new RangeError(`coveringArray: ${total} combinations of values, more than ${COVERING_LIMIT}.`);
|
|
55
|
+
const open = sizes.map((size) => new Uint8Array(size).fill(1));
|
|
56
|
+
const openBy = levels.map((size, d) => new Array(size).fill(combos.reduce((sum, combo, c) => sum + (combo.includes(d) ? sizes[c] / levels[d] : 0), 0)));
|
|
57
|
+
let left = total;
|
|
58
|
+
const indexOf = (combo, row) => combo.reduce((index, d) => index * levels[d] + row[d], 0);
|
|
59
|
+
const bestLevel = (f, row, done, choose) => {
|
|
60
|
+
const sets = combinations(done.length, t - 1).map((rest) => {
|
|
61
|
+
const combo = [...rest.map((i) => done[i]), f].sort((a, b) => a - b);
|
|
62
|
+
return {
|
|
63
|
+
flags: open[comboOf.get(combo.join(","))],
|
|
64
|
+
combo
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
let top = -1;
|
|
68
|
+
let tops = [];
|
|
69
|
+
for (let v = 0; v < levels[f]; v++) {
|
|
70
|
+
row[f] = v;
|
|
71
|
+
let n = 0;
|
|
72
|
+
for (const { flags, combo } of sets) n += flags[indexOf(combo, row)];
|
|
73
|
+
if (n > top) {
|
|
74
|
+
top = n;
|
|
75
|
+
tops = [];
|
|
76
|
+
}
|
|
77
|
+
if (n === top) tops.push(v);
|
|
78
|
+
}
|
|
79
|
+
return [choose(tops), top];
|
|
80
|
+
};
|
|
81
|
+
const rows = [];
|
|
82
|
+
while (left > 0) {
|
|
83
|
+
let most = -1;
|
|
84
|
+
let starts = [];
|
|
85
|
+
for (let d = 0; d < k; d++) for (let v = 0; v < levels[d]; v++) {
|
|
86
|
+
if (openBy[d][v] > most) {
|
|
87
|
+
most = openBy[d][v];
|
|
88
|
+
starts = [];
|
|
89
|
+
}
|
|
90
|
+
if (openBy[d][v] === most) starts.push([d, v]);
|
|
91
|
+
}
|
|
92
|
+
let best = [];
|
|
93
|
+
let bestGain = -1;
|
|
94
|
+
for (let c = 0; c < candidates; c++) {
|
|
95
|
+
const [first, level] = r.pick(starts);
|
|
96
|
+
const row = new Array(k).fill(-1);
|
|
97
|
+
row[first] = level;
|
|
98
|
+
const done = [first];
|
|
99
|
+
let gain = t === 1 ? open[comboOf.get(String(first))][level] : 0;
|
|
100
|
+
for (const f of r.shuffle([...Array(k).keys()].filter((d) => d !== first))) {
|
|
101
|
+
const [chosen, top] = bestLevel(f, row, done, (ties) => r.pick(ties));
|
|
102
|
+
row[f] = chosen;
|
|
103
|
+
gain += top;
|
|
104
|
+
done.push(f);
|
|
105
|
+
}
|
|
106
|
+
if (gain > bestGain) {
|
|
107
|
+
best = row;
|
|
108
|
+
bestGain = gain;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (bestGain === 0) {
|
|
112
|
+
const c = open.findIndex((flags) => flags.includes(1));
|
|
113
|
+
let index = open[c].indexOf(1);
|
|
114
|
+
best = new Array(k).fill(-1);
|
|
115
|
+
for (const d of [...combos[c]].reverse()) {
|
|
116
|
+
best[d] = index % levels[d];
|
|
117
|
+
index = Math.floor(index / levels[d]);
|
|
118
|
+
}
|
|
119
|
+
const done = [...combos[c]];
|
|
120
|
+
for (let f = 0; f < k; f++) {
|
|
121
|
+
if (done.includes(f)) continue;
|
|
122
|
+
best[f] = bestLevel(f, best, done, (ties) => ties[0])[0];
|
|
123
|
+
done.push(f);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
for (const [c, combo] of combos.entries()) {
|
|
127
|
+
const at = indexOf(combo, best);
|
|
128
|
+
if (open[c][at] === 1) {
|
|
129
|
+
open[c][at] = 0;
|
|
130
|
+
left--;
|
|
131
|
+
for (const d of combo) openBy[d][best[d]]--;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
rows.push(best);
|
|
135
|
+
}
|
|
136
|
+
return rows;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* This function gives a covering array over named dimensions: each row has one value of each dimension. The values of a
|
|
140
|
+
* dimension are its levels, in their order. The options and the draws are those of `coveringArray`. The value of each name
|
|
141
|
+
* in a row has the type of the levels of its dimension. Thus dimensions of different types can be in one call.
|
|
142
|
+
*/
|
|
143
|
+
function coveringRows(dimensions, r, options = {}) {
|
|
144
|
+
const names = Object.keys(dimensions);
|
|
145
|
+
const levels = dimensions;
|
|
146
|
+
return coveringArray(names.map((name) => levels[name].length), r, options).map((row) => Object.fromEntries(names.map((name, i) => [name, levels[name][row[i]]])));
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* This function gives the coverage of some rows over named dimensions, with the strength `t` (the default is 2). A row holds a
|
|
150
|
+
* combination when it has each of its values. The function compares the values as text with `String`, and it ignores the
|
|
151
|
+
* fields of a row that are not dimensions. With fewer dimensions than `t`, the combinations are those of all the dimensions.
|
|
152
|
+
* Thus no dimensions give one empty combination, with the key `""`.
|
|
153
|
+
*/
|
|
154
|
+
function tupleCoverage(rows, dimensions, strength = 2) {
|
|
155
|
+
const names = Object.keys(dimensions);
|
|
156
|
+
const t = strengthOf(names.length, { strength });
|
|
157
|
+
const combos = combinations(names.length, t);
|
|
158
|
+
const keyOf = (combo, values) => combo.map((d, i) => `${names[d]}=${String(values[i])}`).join("&");
|
|
159
|
+
let tuples = 0;
|
|
160
|
+
for (const combo of combos) tuples += combo.reduce((product, d) => product * dimensions[names[d]].length, 1);
|
|
161
|
+
if (tuples > 1e7) throw new RangeError(`tupleCoverage: ${tuples} combinations of values, more than ${COVERING_LIMIT}.`);
|
|
162
|
+
const seen = /* @__PURE__ */ new Set();
|
|
163
|
+
for (const row of rows) for (const combo of combos) seen.add(keyOf(combo, combo.map((d) => row[names[d]])));
|
|
164
|
+
const missing = [];
|
|
165
|
+
for (const combo of combos) {
|
|
166
|
+
const values = combo.map((d) => dimensions[names[d]]);
|
|
167
|
+
const walk = (i, chosen) => {
|
|
168
|
+
if (i === combo.length) {
|
|
169
|
+
const key = keyOf(combo, chosen);
|
|
170
|
+
if (!seen.has(key)) missing.push(key);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
for (const value of values[i]) walk(i + 1, [...chosen, value]);
|
|
174
|
+
};
|
|
175
|
+
walk(0, []);
|
|
176
|
+
}
|
|
177
|
+
const covered = tuples - missing.length;
|
|
178
|
+
return {
|
|
179
|
+
tuples,
|
|
180
|
+
covered,
|
|
181
|
+
share: tuples === 0 ? 1 : covered / tuples,
|
|
182
|
+
missing
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export { COVERING_CANDIDATES, COVERING_LIMIT, coveringArray, coveringRows, tupleCoverage };
|
|
186
|
+
|
|
187
|
+
//# sourceMappingURL=covering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"covering.js","names":[],"sources":["../src/covering.ts"],"sourcesContent":["/**\n * Covering arrays: few rows that still hold each combination of `t` values of `t` different dimensions.\n * With the strength 2, each pair of values of 2 dimensions is in one row or more (a pairwise array).\n */\nimport type { Random } from \"./random.ts\";\n\n/** The default count of candidate rows for each row that `coveringArray` keeps. */\nexport const COVERING_CANDIDATES = 50;\n\n/** The largest count of combinations of values that one array covers. A larger array is an error, not a long run. */\nexport const COVERING_LIMIT = 10_000_000;\n\n/** The options of `coveringArray` and `coveringRows`. */\nexport interface CoveringOptions {\n /** The strength `t`: each `t` values of `t` different dimensions are in one row or more. The default is 2. */\n readonly strength?: number;\n /** The count of candidate rows for each row that the array keeps. The default is `COVERING_CANDIDATES`. */\n readonly candidates?: number;\n}\n\n/** The coverage of a set of rows over some dimensions. */\nexport interface Coverage {\n /** The count of the combinations of `t` values of `t` different dimensions. */\n readonly tuples: number;\n /** The count of the combinations that one row or more holds. */\n readonly covered: number;\n /** `covered` divided by `tuples`. Dimensions with no combination give 1. */\n readonly share: number;\n /** The combinations that no row holds, as `<dimension>=<value>&<dimension>=<value>`, in the order of the dimensions. */\n readonly missing: readonly string[];\n}\n\nconst isWhole = (value: unknown, least: number): value is number => typeof value === \"number\" && Number.isSafeInteger(value) && value >= least;\n\n/** This function gives each set of `t` indices from 0 to `k - 1`, each set in increasing order, the sets in lexical order. */\nfunction combinations(k: number, t: number): number[][] {\n const out: number[][] = [];\n const pick: number[] = [];\n const walk = (from: number): void => {\n if (pick.length === t) {\n out.push([...pick]);\n return;\n }\n for (let i = from; i <= k - (t - pick.length); i++) {\n pick.push(i);\n walk(i + 1);\n pick.pop();\n }\n };\n walk(0);\n return out;\n}\n\n/** This function checks the options and gives the strength for `k` dimensions: the given strength, or `k` when there are fewer dimensions. */\nfunction strengthOf(k: number, options: CoveringOptions): number {\n const strength = options.strength ?? 2;\n if (!isWhole(strength, 1)) throw new RangeError(`covering: the strength is a whole number of 1 or more, not ${String(strength)}.`);\n return Math.min(strength, k);\n}\n\n/**\n * This function gives a covering array of strength `t` over dimensions with `levels[i]` levels each. Each row has the index\n * of one level of each dimension. With fewer dimensions than `t`, the array covers each combination of all the dimensions.\n * Thus no dimensions give one empty row, as the product of no sets has one item.\n *\n * The algorithm is a greedy AETG. Each row starts at a level with the most open combinations. The array makes `candidates`\n * rows, and it keeps the row that covers the most new combinations. Each candidate takes the dimensions in a random order.\n * Each dimension takes the level that covers the most new combinations with the dimensions before it.\n * The random draws come from `r`, thus the same levels, options and seed give the same rows.\n *\n * This function throws a `RangeError` for a dimension with no level, for bad options, and for more than `COVERING_LIMIT` combinations.\n */\nexport function coveringArray(levels: readonly number[], r: Random, options: CoveringOptions = {}): number[][] {\n for (const [i, size] of levels.entries()) {\n if (!isWhole(size, 1)) throw new RangeError(`coveringArray: dimension ${i} has ${String(size)} levels, not a whole number of 1 or more.`);\n }\n const t = strengthOf(levels.length, options);\n const candidates = options.candidates ?? COVERING_CANDIDATES;\n if (!isWhole(candidates, 1)) throw new RangeError(`coveringArray: candidates is a whole number of 1 or more, not ${String(candidates)}.`);\n const k = levels.length;\n if (k === 0) return [[]];\n\n const combos = combinations(k, t);\n const comboOf = new Map(combos.map((combo, index) => [combo.join(\",\"), index]));\n const sizes = combos.map((combo) => combo.reduce((product, d) => product * levels[d]!, 1));\n const total = sizes.reduce((sum, size) => sum + size, 0);\n if (total > COVERING_LIMIT) throw new RangeError(`coveringArray: ${total} combinations of values, more than ${COVERING_LIMIT}.`);\n // open[c][index] is 1 while the combination `index` of the values of the dimensions `combos[c]` has no row.\n const open = sizes.map((size) => new Uint8Array(size).fill(1));\n // openBy[d][v] is the count of the open combinations that hold level `v` of dimension `d`.\n const openBy = levels.map((size, d) => new Array<number>(size).fill(combos.reduce((sum, combo, c) => sum + (combo.includes(d) ? sizes[c]! / levels[d]! : 0), 0)));\n let left = total;\n const indexOf = (combo: readonly number[], row: readonly number[]): number => combo.reduce((index, d) => index * levels[d]! + row[d]!, 0);\n // The level of dimension `f` that closes the most open combinations with the levels of the row on the dimensions `done`.\n // The gain of a level counts each set of `t - 1` dimensions of `done` with `f`. The function draws among the ties with `choose`.\n const bestLevel = (f: number, row: number[], done: readonly number[], choose: (ties: number[]) => number): [level: number, gain: number] => {\n const sets = combinations(done.length, t - 1).map((rest) => {\n const combo = [...rest.map((i) => done[i]!), f].sort((a, b) => a - b);\n return { flags: open[comboOf.get(combo.join(\",\"))!]!, combo };\n });\n let top = -1;\n let tops: number[] = [];\n for (let v = 0; v < levels[f]!; v++) {\n row[f] = v;\n let n = 0;\n for (const { flags, combo } of sets) n += flags[indexOf(combo, row)]!;\n if (n > top) {\n top = n;\n tops = [];\n }\n if (n === top) tops.push(v);\n }\n return [choose(tops), top];\n };\n\n const rows: number[][] = [];\n while (left > 0) {\n let most = -1;\n let starts: [number, number][] = [];\n for (let d = 0; d < k; d++) {\n for (let v = 0; v < levels[d]!; v++) {\n if (openBy[d]![v]! > most) {\n most = openBy[d]![v]!;\n starts = [];\n }\n if (openBy[d]![v] === most) starts.push([d, v]);\n }\n }\n let best: number[] = [];\n let bestGain = -1;\n for (let c = 0; c < candidates; c++) {\n const [first, level] = r.pick(starts);\n const row = new Array<number>(k).fill(-1);\n row[first] = level;\n const done = [first];\n let gain = t === 1 ? open[comboOf.get(String(first))!]![level]! : 0;\n for (const f of r.shuffle([...Array(k).keys()].filter((d) => d !== first))) {\n const [chosen, top] = bestLevel(f, row, done, (ties) => r.pick(ties));\n row[f] = chosen;\n gain += top;\n done.push(f);\n }\n if (gain > bestGain) {\n best = row;\n bestGain = gain;\n }\n }\n if (bestGain === 0) {\n // With a strength of 3 or more, the greedy rows can miss each open combination. The row then starts from the first open\n // combination, and each other dimension takes its lowest level with the most gain. This row closes one combination or more.\n const c = open.findIndex((flags) => flags.includes(1));\n let index = open[c]!.indexOf(1);\n best = new Array<number>(k).fill(-1);\n for (const d of [...combos[c]!].reverse()) {\n best[d] = index % levels[d]!;\n index = Math.floor(index / levels[d]!);\n }\n const done = [...combos[c]!];\n for (let f = 0; f < k; f++) {\n if (done.includes(f)) continue;\n best[f] = bestLevel(f, best, done, (ties) => ties[0]!)[0];\n done.push(f);\n }\n }\n for (const [c, combo] of combos.entries()) {\n const at = indexOf(combo, best);\n if (open[c]![at] === 1) {\n open[c]![at] = 0;\n left--;\n for (const d of combo) openBy[d]![best[d]!]!--;\n }\n }\n rows.push(best);\n }\n return rows;\n}\n\n/**\n * This function gives a covering array over named dimensions: each row has one value of each dimension. The values of a\n * dimension are its levels, in their order. The options and the draws are those of `coveringArray`. The value of each name\n * in a row has the type of the levels of its dimension. Thus dimensions of different types can be in one call.\n */\nexport function coveringRows<D extends Readonly<Record<string, readonly unknown[]>>>(dimensions: D, r: Random, options: CoveringOptions = {}): { [K in keyof D]: D[K][number] }[] {\n const names = Object.keys(dimensions);\n const levels: Readonly<Record<string, readonly unknown[]>> = dimensions;\n return coveringArray(\n names.map((name) => levels[name]!.length),\n r,\n options,\n ).map((row) => Object.fromEntries(names.map((name, i) => [name, levels[name]![row[i]!]])) as { [K in keyof D]: D[K][number] });\n}\n\n/**\n * This function gives the coverage of some rows over named dimensions, with the strength `t` (the default is 2). A row holds a\n * combination when it has each of its values. The function compares the values as text with `String`, and it ignores the\n * fields of a row that are not dimensions. With fewer dimensions than `t`, the combinations are those of all the dimensions.\n * Thus no dimensions give one empty combination, with the key `\"\"`.\n */\nexport function tupleCoverage(rows: readonly Readonly<Record<string, unknown>>[], dimensions: Readonly<Record<string, readonly unknown[]>>, strength = 2): Coverage {\n const names = Object.keys(dimensions);\n const t = strengthOf(names.length, { strength });\n const combos = combinations(names.length, t);\n const keyOf = (combo: readonly number[], values: readonly unknown[]): string => combo.map((d, i) => `${names[d]}=${String(values[i])}`).join(\"&\");\n let tuples = 0;\n for (const combo of combos) tuples += combo.reduce((product, d) => product * dimensions[names[d]!]!.length, 1);\n if (tuples > COVERING_LIMIT) throw new RangeError(`tupleCoverage: ${tuples} combinations of values, more than ${COVERING_LIMIT}.`);\n const seen = new Set<string>();\n for (const row of rows) {\n for (const combo of combos) seen.add(keyOf(combo, combo.map((d) => row[names[d]!])));\n }\n const missing: string[] = [];\n for (const combo of combos) {\n const values = combo.map((d) => dimensions[names[d]!]!);\n const walk = (i: number, chosen: unknown[]): void => {\n if (i === combo.length) {\n const key = keyOf(combo, chosen);\n if (!seen.has(key)) missing.push(key);\n return;\n }\n for (const value of values[i]!) walk(i + 1, [...chosen, value]);\n };\n walk(0, []);\n }\n const covered = tuples - missing.length;\n return { tuples, covered, share: tuples === 0 ? 1 : covered / tuples, missing };\n}\n"],"mappings":";;AAOA,MAAa,sBAAsB;;AAGnC,MAAa,iBAAiB;AAsB9B,MAAM,WAAW,OAAgB,UAAmC,OAAO,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AAC;CAC3C,MAAM,SAAS,OAA0B,WAAuC,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,OAAO,OAAO,EAAE,GAAG,CAAC,CAAC,KAAK,GAAG;CAChJ,IAAI,SAAS;CACb,KAAK,MAAM,SAAS,QAAQ,UAAU,MAAM,QAAQ,SAAS,MAAM,UAAU,WAAW,MAAM,GAAI,CAAE,QAAQ,CAAC;CAC7G,IAAI,SAAA,KAAyB,MAAM,IAAI,WAAW,kBAAkB,OAAO,qCAAqC,eAAe,EAAE;CACjI,MAAM,uBAAO,IAAI,IAAY;CAC7B,KAAK,MAAM,OAAO,MAChB,KAAK,MAAM,SAAS,QAAQ,KAAK,IAAI,MAAM,OAAO,MAAM,KAAK,MAAM,IAAI,MAAM,GAAI,CAAC,CAAC;CAErF,MAAM,UAAoB,CAAC;CAC3B,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,SAAS,MAAM,KAAK,MAAM,WAAW,MAAM,GAAK;EACtD,MAAM,QAAQ,GAAW,WAA4B;GACnD,IAAI,MAAM,MAAM,QAAQ;IACtB,MAAM,MAAM,MAAM,OAAO,MAAM;IAC/B,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG,QAAQ,KAAK,GAAG;IACpC;GACF;GACA,KAAK,MAAM,SAAS,OAAO,IAAK,KAAK,IAAI,GAAG,CAAC,GAAG,QAAQ,KAAK,CAAC;EAChE;EACA,KAAK,GAAG,CAAC,CAAC;CACZ;CACA,MAAM,UAAU,SAAS,QAAQ;CACjC,OAAO;EAAE;EAAQ;EAAS,OAAO,WAAW,IAAI,IAAI,UAAU;EAAQ;CAAQ;AAChF"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { COVERING_CANDIDATES, COVERING_LIMIT, Coverage, CoveringOptions, coveringArray, coveringRows, tupleCoverage } from "./covering.js";
|
|
1
2
|
import { DistributionSpec, Param, dependsOnLibm, sampler } from "./distributions.js";
|
|
2
3
|
import { normalCdf, normalQuantile } from "./normal.js";
|
|
3
4
|
import { Distribution, betaCdf, distributionOf } from "./quantiles.js";
|
|
@@ -5,4 +6,4 @@ import { Dimension, InputFamily, Point, SaltelliDesign, familyMap, familyPoints,
|
|
|
5
6
|
import { CanonicalOptions, Sha256Options, canonicalHash, canonicalJson, sha256Hex } from "./hash.js";
|
|
6
7
|
import { DIAGRAM_BOX_AREA, GIT_BLOB_BYTES, RECORDED_TABLES, RecordedTable, recordedSpec } from "./recorded.js";
|
|
7
8
|
import { Random, Source, deriveSeed, fnv1a32, mulberry32, plackettLuceOrder, random, randomOf, seedOf, seedsFrom, stablePick } from "./random.js";
|
|
8
|
-
export { type CanonicalOptions, DIAGRAM_BOX_AREA, type Dimension, type Distribution, type DistributionSpec, GIT_BLOB_BYTES, type InputFamily, type Param, type Point, RECORDED_TABLES, type Random, type RecordedTable, type SaltelliDesign, type Sha256Options, type Source, betaCdf, canonicalHash, canonicalJson, dependsOnLibm, deriveSeed, distributionOf, familyMap, familyPoints, fnv1a32, latinHypercube, mulberry32, normalCdf, normalQuantile, plackettLuceOrder, random, randomDesign, randomOf, recordedSpec, saltelliDesign, sampler, seedOf, seedsFrom, sha256Hex, stablePick, stratifiedDesign };
|
|
9
|
+
export { COVERING_CANDIDATES, COVERING_LIMIT, type CanonicalOptions, type Coverage, type CoveringOptions, DIAGRAM_BOX_AREA, type Dimension, type Distribution, type DistributionSpec, GIT_BLOB_BYTES, type InputFamily, type Param, type Point, RECORDED_TABLES, type Random, type RecordedTable, type SaltelliDesign, type Sha256Options, type Source, betaCdf, canonicalHash, canonicalJson, coveringArray, coveringRows, dependsOnLibm, deriveSeed, distributionOf, familyMap, familyPoints, fnv1a32, latinHypercube, mulberry32, normalCdf, normalQuantile, plackettLuceOrder, random, randomDesign, randomOf, recordedSpec, saltelliDesign, sampler, seedOf, seedsFrom, sha256Hex, stablePick, stratifiedDesign, tupleCoverage };
|
package/build/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { COVERING_CANDIDATES, COVERING_LIMIT, coveringArray, coveringRows, tupleCoverage } from "./covering.js";
|
|
1
2
|
import { dependsOnLibm, sampler } from "./distributions.js";
|
|
2
3
|
import { normalCdf, normalQuantile } from "./normal.js";
|
|
3
4
|
import { betaCdf, distributionOf } from "./quantiles.js";
|
|
@@ -5,4 +6,4 @@ import { familyMap, familyPoints, latinHypercube, randomDesign, saltelliDesign,
|
|
|
5
6
|
import { canonicalHash, canonicalJson, sha256Hex } from "./hash.js";
|
|
6
7
|
import { DIAGRAM_BOX_AREA, GIT_BLOB_BYTES, RECORDED_TABLES, recordedSpec } from "./recorded.js";
|
|
7
8
|
import { deriveSeed, fnv1a32, mulberry32, plackettLuceOrder, random, randomOf, seedOf, seedsFrom, stablePick } from "./random.js";
|
|
8
|
-
export { DIAGRAM_BOX_AREA, GIT_BLOB_BYTES, RECORDED_TABLES, betaCdf, canonicalHash, canonicalJson, dependsOnLibm, deriveSeed, distributionOf, familyMap, familyPoints, fnv1a32, latinHypercube, mulberry32, normalCdf, normalQuantile, plackettLuceOrder, random, randomDesign, randomOf, recordedSpec, saltelliDesign, sampler, seedOf, seedsFrom, sha256Hex, stablePick, stratifiedDesign };
|
|
9
|
+
export { COVERING_CANDIDATES, COVERING_LIMIT, DIAGRAM_BOX_AREA, GIT_BLOB_BYTES, RECORDED_TABLES, betaCdf, canonicalHash, canonicalJson, coveringArray, coveringRows, dependsOnLibm, deriveSeed, distributionOf, familyMap, familyPoints, fnv1a32, latinHypercube, mulberry32, normalCdf, normalQuantile, plackettLuceOrder, random, randomDesign, randomOf, recordedSpec, saltelliDesign, sampler, seedOf, seedsFrom, sha256Hex, stablePick, stratifiedDesign, tupleCoverage };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@mark1russell7/rigor-generators",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"description": "A seeded random number generator (mulberry32) with the draws that tests and benchmarks make: integers, picks, weights, shuffles, samples, normal values and named streams. It also gives a content hash: SHA-256 and canonical JSON (RFC 8785).",
|
|
4
|
+
"version": "0.1.17",
|
|
5
|
+
"description": "A seeded random number generator (mulberry32) with the draws that tests and benchmarks make: integers, picks, weights, shuffles, samples, normal values and named streams. It also gives covering arrays (pairwise and of strength t), and a content hash: SHA-256 and canonical JSON (RFC 8785).",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"random",
|
|
8
8
|
"seed",
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
"deterministic",
|
|
17
17
|
"testing",
|
|
18
18
|
"benchmark",
|
|
19
|
-
"fixtures"
|
|
19
|
+
"fixtures",
|
|
20
|
+
"pairwise",
|
|
21
|
+
"covering-array",
|
|
22
|
+
"combinatorial-testing"
|
|
20
23
|
],
|
|
21
24
|
"homepage": "https://github.com/mark1russell7/rigor/tree/main/packages/generators#readme",
|
|
22
25
|
"bugs": {
|
|
@@ -43,6 +46,7 @@
|
|
|
43
46
|
},
|
|
44
47
|
"devDependencies": {
|
|
45
48
|
"@mark1russell7/cue": "^2.0.0",
|
|
49
|
+
"@mark1russell7/rigor-testkit": "^0.1.10",
|
|
46
50
|
"@types/node": "^26.6.5",
|
|
47
51
|
"esbuild": "^0.28.2",
|
|
48
52
|
"fast-check": "^4.10.2",
|