@mark1russell7/layout-contract 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +9 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +76 -6
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/space-walk.ts +13 -4
- package/src/strategy-space.ts +86 -4
package/build/index.d.ts
CHANGED
|
@@ -813,11 +813,19 @@ export interface SampleOptions extends ShapeFilter {
|
|
|
813
813
|
/**
|
|
814
814
|
* How a point keeps the constraints. With `reject` (the default), a point that breaks a constraint draws again.
|
|
815
815
|
* 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.
|
|
816
|
+
* The stages of `fixed` draw before the other stages.
|
|
816
817
|
* A space whose constraints reject most draws gets its sample with `walk`. The two values give different configs for one seed.
|
|
817
818
|
* 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.
|
|
818
819
|
* Thus a mean over this sample is not a mean of the space.
|
|
819
820
|
*/
|
|
820
821
|
readonly draw?: "reject" | "walk";
|
|
822
|
+
/**
|
|
823
|
+
* The options that each config of the sample has. A key is the name of a stage, and its value is the id of one option of that stage. The other stages draw as before.
|
|
824
|
+
* A stage of a product space has the name of its part before its own name, for example `pack.placement`.
|
|
825
|
+
* A fixed meta option needs `meta: "sample"`. A meta option of another stage of the same part goes out, because such an option replaces the fixed stage.
|
|
826
|
+
* A fixed option that the shape filter removes, or that the constraints forbid, gets a `RangeError` with the reason.
|
|
827
|
+
*/
|
|
828
|
+
readonly fixed?: Readonly<Record<string, string>>;
|
|
821
829
|
}
|
|
822
830
|
/** The options of `enumerateSpace`. */
|
|
823
831
|
export type EnumerateOptions = GridOptions | SampleOptions;
|
|
@@ -877,6 +885,7 @@ export declare function spaceSize(space: StrategySpace, options: SpaceSizeOption
|
|
|
877
885
|
* - A meta option with a `pool` gives only the entries of its pool. With `shapes`, only the entries whose members support each kind count.
|
|
878
886
|
* - A sample draws again when a point chooses a meta option without a member list. `spaceSize` gives such an option 0.
|
|
879
887
|
* - With `shapes`, a sample throws a `RangeError` when the space has no config for the kinds. The error names the stages without an option and the meta options without members.
|
|
888
|
+
* - With `fixed`, each config has the fixed option at each named stage. A fixed option that the space, the shape filter or the constraints do not permit gets a `RangeError` with the reason.
|
|
880
889
|
*/
|
|
881
890
|
export declare function enumerateSpace(space: StrategySpace, options: EnumerateOptions): StrategyConfig[];
|
|
882
891
|
/**
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/balance.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/strategy-space.ts","../src/strategy-options.ts","../src/strategy-catalog.ts","../src/verdict.ts","../src/families.ts"],"mappings":";;qBACa;;qBAGA;;;;;qBAMA;;;;;qBAMA;;;;;iBAMI;;WAEN;;WAEA;;;;;;qBAOE,mBAAmB;;iBC5Bf;WACN;WACA;WACA;WACA;;;iBAIM;WACN;WACA;WACA,WAAW,SAAS;;;iBAId;WACN,qBAAqB;;WAErB;;WAEA;aAAiB;aAAoB;;;WAErC;aAA2B;aAAqB;aAAoB;;WACpE,iBAAiB;;;;;;;wBAQZ,UAAU,OAAO,aAAa,QAAQ,aAAa;;YC/BvD;;iBAGK;WACN;WACA,OAAO;WACP;WACA;;WAEA,SAAS,SAAS;WAClB;;WAEA;;WAEA;WACA;WACA;WACA;WACA;;WAEA,kBAAkB;;WAElB,UAAU,SAAS;;WAEnB,MAAM,SAAS;;WAEf,YAAY,SAAS,QAAQ;;WAE7B;;;;;;;WAOA;;WAEA;;WAEA;;WAEA;;;;;;WAMA;;WAEA;;WAEA;;WAEA;;;;;WAKA;;WAEA,MAAM;;WAEN;WACA;;;;;;YAOC,WAAW,SA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I5B;WACN,eAAe;;WAEf;;WAEA;WACA,iBAAiB;WACjB,uBAAuB;;WAEvB,QAAQ,SAAS,eAAe;;WAEhC,iBAAiB;;;iBAIX;WACN;;WAEA,SAAS,SAAS,eAAe;;WAEjC,mBAAmB;;;iBAIb;;WAEN;WACA,QAAQ,SAAS,eAAe;;;iBAI1B;;WAEN;;WAEA;;;iBAIM,yBAAyB;;WAE/B;;WAEA;;;iBAIM,oBAAoB;WAC1B;WACA;;WAEA;;;iBAIM,sBAAsB;WAC5B;;WAEA;WACA;;WAEA;;WAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/balance.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/strategy-space.ts","../src/strategy-options.ts","../src/strategy-catalog.ts","../src/verdict.ts","../src/families.ts"],"mappings":";;qBACa;;qBAGA;;;;;qBAMA;;;;;qBAMA;;;;;iBAMI;;WAEN;;WAEA;;;;;;qBAOE,mBAAmB;;iBC5Bf;WACN;WACA;WACA;WACA;;;iBAIM;WACN;WACA;WACA,WAAW,SAAS;;;iBAId;WACN,qBAAqB;;WAErB;;WAEA;aAAiB;aAAoB;;;WAErC;aAA2B;aAAqB;aAAoB;;WACpE,iBAAiB;;;;;;;wBAQZ,UAAU,OAAO,aAAa,QAAQ,aAAa;;YC/BvD;;iBAGK;WACN;WACA,OAAO;WACP;WACA;;WAEA,SAAS,SAAS;WAClB;;WAEA;;WAEA;WACA;WACA;WACA;WACA;;WAEA,kBAAkB;;WAElB,UAAU,SAAS;;WAEnB,MAAM,SAAS;;WAEf,YAAY,SAAS,QAAQ;;WAE7B;;;;;;;WAOA;;WAEA;;WAEA;;WAEA;;;;;;WAMA;;WAEA;;WAEA;;WAEA;;;;;WAKA;;WAEA,MAAM;;WAEN;WACA;;;;;;YAOC,WAAW,SAAS;;iBAGf;WACN;WACA;WACA;;W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AqB;;WAErB;WACA,aAAa;;WAEb,cAAc,MAAM;;EAE7B,MAAM,OAAO,aAAa,cAAc,MAAM,kBAAkB;;;iBAIjD;;WAEN;;WAEA;WACA;;WAEA,QAAQ,OAAO;;;;;;;wBAWV,cAAc,MAAM,aAAa,cAAc,gBAAgB,cAAc,UAAS,iBAAsB,aAAa;;;;;qBA+D5H,YAAY;;;;qBA0BZ,eAAe;;;;;;;;;qBAuBf,kBAAkB,aAAa;;;;;;qBAqD/B,gBAAgB,aAAa"}
|
package/build/index.js
CHANGED
|
@@ -2918,13 +2918,16 @@ function fitsWalk(constraints, fixed, stage, id) {
|
|
|
2918
2918
|
fixed.delete(stage);
|
|
2919
2919
|
return ok;
|
|
2920
2920
|
}
|
|
2921
|
-
/**
|
|
2922
|
-
function
|
|
2921
|
+
/**
|
|
2922
|
+
* This function gives the plan of a walk. Stages of equal size keep the order of the space.
|
|
2923
|
+
* The stages of `first` go first, for example the stages of the sample option `fixed`. Thus the other stages draw only from the options that keep the constraints with them.
|
|
2924
|
+
*/
|
|
2925
|
+
function walkPlan(stages, lists, constraints, n, first = /* @__PURE__ */ new Set()) {
|
|
2923
2926
|
return {
|
|
2924
2927
|
stages,
|
|
2925
2928
|
lists,
|
|
2926
2929
|
n,
|
|
2927
|
-
order: stages.map((_, k) => k).sort((a, b) => lists[b].length - lists[a].length || a - b),
|
|
2930
|
+
order: stages.map((_, k) => k).sort((a, b) => Number(first.has(stages[b].name)) - Number(first.has(stages[a].name)) || lists[b].length - lists[a].length || a - b),
|
|
2928
2931
|
naming: stages.map((s) => constraints.filter((c) => c.if.stage === s.name || otherStage(c) === s.name))
|
|
2929
2932
|
};
|
|
2930
2933
|
}
|
|
@@ -3611,6 +3614,68 @@ function noSample(space, kept, shapes, meta) {
|
|
|
3611
3614
|
if (empty.length === 0 && removed.length === 0) text += " The constraints remove each config.";
|
|
3612
3615
|
return new RangeError(text);
|
|
3613
3616
|
}
|
|
3617
|
+
/** This function gives a constraint in words, for the reason of an error. */
|
|
3618
|
+
function constraintText(c) {
|
|
3619
|
+
const ref = (r) => `${r.stage} ${r.option === null ? "has no option" : `is ${r.option}`}`;
|
|
3620
|
+
return "not" in c.then ? `if ${ref(c.if)}, then not ${ref(c.then.not)}` : `if ${ref(c.if)}, then ${ref(c.then)}`;
|
|
3621
|
+
}
|
|
3622
|
+
/**
|
|
3623
|
+
* This function throws a `RangeError` for a bad `fixed` option of a sample. A stage or an option that the space does not have is bad.
|
|
3624
|
+
* A meta option without `meta: "sample"` is bad, and so are two fixed options that a constraint forbids.
|
|
3625
|
+
*/
|
|
3626
|
+
function assertFixed(space, fixed, meta) {
|
|
3627
|
+
for (const [stage, id] of Object.entries(fixed)) {
|
|
3628
|
+
const s = space.stages.find((x) => x.name === stage);
|
|
3629
|
+
if (s === void 0) throw new RangeError(`The option fixed names the stage ${stage}, and the space ${space.engine} has no such stage.`);
|
|
3630
|
+
const o = s.options.find((x) => x.id === id);
|
|
3631
|
+
if (o === void 0) throw new RangeError(`The option fixed names the option ${String(id)} of the stage ${stage}, and the stage has no such option.`);
|
|
3632
|
+
if (o.members !== void 0 && !meta) throw new RangeError(`The option fixed names the meta option ${stage}.${id}, and a sample with meta skip has no meta option. Set meta to "sample".`);
|
|
3633
|
+
}
|
|
3634
|
+
const ids = new Map(Object.entries(fixed));
|
|
3635
|
+
const other = (c) => "not" in c.then ? c.then.not.stage : c.then.stage;
|
|
3636
|
+
const broken = (space.constraints ?? []).filter((c) => ids.has(c.if.stage) && ids.has(other(c)) && !holds(c, ids));
|
|
3637
|
+
if (broken.length > 0) {
|
|
3638
|
+
const names = Object.entries(fixed).map(([stage, id]) => `${stage}.${id}`);
|
|
3639
|
+
throw new RangeError(`The constraints of the space ${space.engine} forbid the fixed options ${names.join(", ")}. The broken constraints: ${broken.map(constraintText).join("; ")}.`);
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
/**
|
|
3643
|
+
* This function gives the restricted space `kept` with only the fixed option at each fixed stage. A fixed stage that was optional stops being optional.
|
|
3644
|
+
* A meta option of another stage of the part of a fixed stage goes out. A sample gives no option to the other stages of the part of its meta option.
|
|
3645
|
+
*/
|
|
3646
|
+
function fixStages(space, kept, fixed, shapes) {
|
|
3647
|
+
const prefix = prefixes(kept);
|
|
3648
|
+
const parts = new Set(Object.keys(fixed).map((stage) => prefix.get(stage)));
|
|
3649
|
+
const stages = kept.stages.map((s) => {
|
|
3650
|
+
const id = fixed[s.name];
|
|
3651
|
+
if (id === void 0) return parts.has(prefix.get(s.name)) ? {
|
|
3652
|
+
...s,
|
|
3653
|
+
options: s.options.filter((o) => o.members === void 0)
|
|
3654
|
+
} : s;
|
|
3655
|
+
const options = s.options.filter((o) => o.id === id).map((o) => o.members === void 0 ? o : withMemberSpace(o, memberSpaces.get(o) ?? partOf(kept, s.name).space));
|
|
3656
|
+
if (options.length === 0) throw new RangeError(`The fixed option ${s.name}.${id} of the space ${space.engine} does not support the shape kinds ${(shapes ?? []).join(", ")}.`);
|
|
3657
|
+
return {
|
|
3658
|
+
...s,
|
|
3659
|
+
options,
|
|
3660
|
+
optional: false
|
|
3661
|
+
};
|
|
3662
|
+
});
|
|
3663
|
+
return {
|
|
3664
|
+
...kept,
|
|
3665
|
+
stages
|
|
3666
|
+
};
|
|
3667
|
+
}
|
|
3668
|
+
/** This function gives a copy of a meta option whose members come from `members`. */
|
|
3669
|
+
function withMemberSpace(o, members) {
|
|
3670
|
+
const copy = { ...o };
|
|
3671
|
+
memberSpaces.set(copy, members);
|
|
3672
|
+
return copy;
|
|
3673
|
+
}
|
|
3674
|
+
/** This function gives the error of a sample whose fixed options keep each constraint between them. The constraints with the other stages remove each config. */
|
|
3675
|
+
function noFixedSample(space, fixed) {
|
|
3676
|
+
const names = Object.entries(fixed).map(([stage, id]) => `${stage}.${id}`);
|
|
3677
|
+
return /* @__PURE__ */ new RangeError(`The space ${space.engine} has no config with the fixed options ${names.join(", ")}. No constraint between two fixed options breaks, so the constraints with the other stages remove each config.`);
|
|
3678
|
+
}
|
|
3614
3679
|
/** This function gives the count of the base configs of a space that is known to be good. */
|
|
3615
3680
|
const baseCount = (space, levels, limit) => combos(space, levels, false, limit).reduce((sum, c) => sum + c.weight, 0n);
|
|
3616
3681
|
/** This function throws a `RangeError` for a list of shape kinds with a kind that is not declared. */
|
|
@@ -3693,7 +3758,7 @@ const subSeed = (seed, step) => Math.floor(stepRandom(seed, step)() * 4294967296
|
|
|
3693
3758
|
* This function gives a sample of a space: Latin hypercube strata over the options, the params and the member counts.
|
|
3694
3759
|
* `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.
|
|
3695
3760
|
*/
|
|
3696
|
-
function sampleConfigs(space, n, seed, meta, maxTries, canon = space, walk = false) {
|
|
3761
|
+
function sampleConfigs(space, n, seed, meta, maxTries, canon = space, walk = false, first = /* @__PURE__ */ new Set()) {
|
|
3697
3762
|
const stages = space.stages;
|
|
3698
3763
|
const prefix = prefixes(space);
|
|
3699
3764
|
const bounded = new Set(stages.filter((s) => meta && s.options.some((o) => memberSpaces.has(o) || o.members?.max === 0)).map((s) => prefix.get(s.name)));
|
|
@@ -3710,7 +3775,7 @@ function sampleConfigs(space, n, seed, meta, maxTries, canon = space, walk = fal
|
|
|
3710
3775
|
if (!usable.has(o)) usable.set(o, hasMembers(space, s.name, o));
|
|
3711
3776
|
return usable.get(o);
|
|
3712
3777
|
};
|
|
3713
|
-
const plan = walk ? walkPlan(stages, lists, space.constraints ?? [], n) : null;
|
|
3778
|
+
const plan = walk ? walkPlan(stages, lists, space.constraints ?? [], n, first) : null;
|
|
3714
3779
|
const points = [];
|
|
3715
3780
|
let tries = 0;
|
|
3716
3781
|
for (let round = 0; points.length < n; round++) {
|
|
@@ -3799,6 +3864,7 @@ function sampleConfigs(space, n, seed, meta, maxTries, canon = space, walk = fal
|
|
|
3799
3864
|
* - A meta option with a `pool` gives only the entries of its pool. With `shapes`, only the entries whose members support each kind count.
|
|
3800
3865
|
* - A sample draws again when a point chooses a meta option without a member list. `spaceSize` gives such an option 0.
|
|
3801
3866
|
* - With `shapes`, a sample throws a `RangeError` when the space has no config for the kinds. The error names the stages without an option and the meta options without members.
|
|
3867
|
+
* - With `fixed`, each config has the fixed option at each named stage. A fixed option that the space, the shape filter or the constraints do not permit gets a `RangeError` with the reason.
|
|
3802
3868
|
*/
|
|
3803
3869
|
function enumerateSpace(space, options) {
|
|
3804
3870
|
assertSpace(space);
|
|
@@ -3814,12 +3880,16 @@ function enumerateSpace(space, options) {
|
|
|
3814
3880
|
if (meta !== "skip" && meta !== "sample") throw new RangeError(`The option meta is ${String(meta)}, not skip or sample.`);
|
|
3815
3881
|
const draw = options.draw ?? "reject";
|
|
3816
3882
|
if (draw !== "reject" && draw !== "walk") throw new RangeError(`The option draw is ${String(draw)}, not reject or walk.`);
|
|
3883
|
+
const fixed = options.fixed;
|
|
3884
|
+
if (fixed !== void 0) assertFixed(space, fixed, meta === "sample");
|
|
3817
3885
|
if (options.n === 0) return [];
|
|
3818
3886
|
const kept = restrict(space, options.shapes);
|
|
3887
|
+
const drawn = fixed === void 0 ? kept : fixStages(space, kept, fixed, options.shapes);
|
|
3819
3888
|
try {
|
|
3820
|
-
return sampleConfigs(
|
|
3889
|
+
return sampleConfigs(drawn, options.n, options.seed, meta === "sample", options.maxTries ?? Math.max(1e3, 100 * options.n), space, draw === "walk", new Set(Object.keys(fixed ?? {})));
|
|
3821
3890
|
} catch (error) {
|
|
3822
3891
|
if (options.shapes !== void 0 && !hasConfig(kept, meta === "sample")) throw noSample(space, kept, options.shapes, meta === "sample");
|
|
3892
|
+
if (fixed !== void 0 && !hasConfig(drawn, meta === "sample")) throw noFixedSample(space, fixed);
|
|
3823
3893
|
throw error;
|
|
3824
3894
|
}
|
|
3825
3895
|
}
|