@mark1russell7/stack-endurance 0.8.13 → 0.8.15

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 CHANGED
@@ -50,6 +50,8 @@ With the option `horizon` of `h` days, the shortfall counts only the first `h` d
50
50
 
51
51
  The option `share` of `yearShortfall` sets the share of the stores in each case. The default `take` uses `enduranceOf`. With `best`, the query uses `bestEndurance`, and the horizon of the shortfall is the horizon of the share. Thus a draw at the horizon keeps back only `h` times its demand, and the lower levels get the rest.
52
52
 
53
+ Since 0.8.15, a prior can have an `interval` of its `perYear` at a level (`RateInterval` of the core). Then `yearShortfall` gives a `range`. It is the same sum with the rate of each case at the low end of its interval, and at the high end. Each end holds only for each case alone, so the range shows the sampling error of the rates. It is not a joint interval. A case with no interval is in `range.without`, and its rate is at the two ends.
54
+
53
55
  A draw that only the parts of `down` stop has no curve of its duration. The query puts it in `unread`, and its shortfall is not in the sum. A gate shows it as no read, not as a pass.
54
56
 
55
57
  A cut can have no `duration`, as before a source gives its curve. Then each draw whose stop the cut can be part of goes in `unread`. A draw whose minimal stop sets do not have the cut keeps its curves. When the query has no minimal sets, it cannot tell, so the draw goes in `unread`. The gate gives the warning `endurance-cut-no-curve` for each such cut.
@@ -85,6 +87,7 @@ Two groups of cuts that share no minimal set are independent, so the independent
85
87
  - Each value has one number for each curve of `stopCurves`: `event`, `independent` and `upper`.
86
88
  - The chance of `upper` is not more than the true chance, for each dependence of the cuts. Thus the range from `upper` to the other two shows the doubt of the dependence.
87
89
  - `holds` names the draws whose supply the case does not stop. `unread` names the draws whose stop has no curve.
90
+ - `band` gives the same values with each cut at the low end of its band (`shorter`) and at the high end (`longer`). The days do not change. Each end holds only at each day, so the two values are a range of the sampling error, not a joint interval. A draw has no `band` when a cut of its stop has a curve and no band. Since 0.8.14.
88
91
 
89
92
  ## The joint days
90
93
 
package/build/add-on.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as checkEndurance, t as joinEndurance } from "./join-BwVV5q6r.js";
1
+ import { r as checkEndurance, t as joinEndurance } from "./join-C9nJDe7B.js";
2
2
  import { t as ENDURANCE_SCHEMA } from "./layer-a3Fr70Uh.js";
3
3
  import { parseEndurance } from "./schema.js";
4
4
  // src/add-on.ts
package/build/index.d.ts CHANGED
@@ -372,16 +372,39 @@ export interface YearShortfallOptions extends CaseOptions, ShortfallOptions {
372
372
  */
373
373
  readonly share?: Share | undefined;
374
374
  }
375
+ /** The user-days of each level for each curve of the stop: the three sums of a shortfall. Since 0.8.15. */
376
+ export type ShortfallDays = Pick<Shortfall, "levels" | "independent" | "upper">;
377
+ /**
378
+ * The range of the shortfall of one year from the intervals of the rates of its cases (`Prior.interval`). Since 0.8.15.
379
+ * `low` puts the rate of each case at the low end of its interval, and `high` puts it at the high end.
380
+ * Each end holds only for each case alone, so the two values are a range of the sampling error, not a joint interval.
381
+ * The mean of a skewed law can be above the high end, so the expected value can be above `high`.
382
+ */
383
+ export interface RateRange {
384
+ /** The least level of the intervals of the cases in the sum. */
385
+ readonly level: number;
386
+ readonly low: ShortfallDays;
387
+ readonly high: ShortfallDays;
388
+ /** The cases in the sum with no interval of their rate. Their rate is at the two ends. */
389
+ readonly without: readonly string[];
390
+ }
391
+ /** The part of one case in the shortfall of one year. */
392
+ export interface YearCase {
393
+ readonly case: string;
394
+ /** The expected count of the events of the case at the place in one year (`yearRate`). */
395
+ readonly rate: number;
396
+ /** The interval of `rate` from the interval of the prior, times its reach. A prior with no interval gives none. Since 0.8.15. */
397
+ readonly rateInterval?: readonly [low: number, high: number] | undefined;
398
+ readonly endurance: Endurance;
399
+ readonly shortfall: Shortfall;
400
+ }
375
401
  /** The shortfall of one year at one place, with the part of each case. */
376
402
  export interface YearShortfall extends Shortfall {
377
403
  readonly place: string;
378
404
  /** The part of each case. `rate` is the expected count of its events in one year. */
379
- readonly cases: readonly {
380
- readonly case: string;
381
- readonly rate: number;
382
- readonly endurance: Endurance;
383
- readonly shortfall: Shortfall;
384
- }[];
405
+ readonly cases: readonly YearCase[];
406
+ /** The range from the intervals of the rates. A year with no case with an interval has no range. Since 0.8.15. */
407
+ readonly range?: RateRange | undefined;
385
408
  }
386
409
  /**
387
410
  * This function gives the shortfall of one year at one place.
@@ -393,6 +416,7 @@ export interface YearShortfall extends Shortfall {
393
416
  * - `bound` is the weakest bound of the cases in the sum. A case with no prior, or with an expected count of 0, adds 0, so it does not change the bound.
394
417
  *
395
418
  * - With `share: "best"`, the endurance of each case comes from `bestEndurance` with the horizon of the shortfall.
419
+ * - `range` is the same sum with the rate of each case at each end of its interval (`RateRange`).
396
420
  *
397
421
  * @param layer - The endurance layer, with its cases and priors
398
422
  * @param place - The place of the priors
@@ -411,6 +435,20 @@ export interface CurveValues {
411
435
  /** The value of the upper curve: the safe side for each dependence of the cuts. */
412
436
  readonly upper: number;
413
437
  }
438
+ /** The chance and the shortfall of a draw at one end of the sampling bands of its cuts. Since 0.8.14. */
439
+ export interface BandValues {
440
+ readonly lasts: CurveValues;
441
+ readonly shortfall: CurveValues;
442
+ }
443
+ /**
444
+ * The values of a draw at the two ends of the sampling bands of its cuts (`Cut.band`). Since 0.8.14.
445
+ * `shorter` puts each cut at the low end of its band, and `longer` puts each cut at the high end.
446
+ * Each end holds only pointwise, so the two values are a range of the sampling error, not a joint interval.
447
+ */
448
+ export interface DrawBand {
449
+ readonly shorter: BandValues;
450
+ readonly longer: BandValues;
451
+ }
414
452
  /** The outlook of one draw in one event of a case. */
415
453
  export interface DrawOutlook {
416
454
  readonly need: string;
@@ -433,6 +471,11 @@ export interface DrawOutlook {
433
471
  readonly bound: CutBound$1;
434
472
  /** This is true when the upper curve is coarse (`StopCurves.coarse`). */
435
473
  readonly coarse: boolean;
474
+ /**
475
+ * The values at the two ends of the sampling bands of the cuts, with the same days. Since 0.8.14.
476
+ * It is missing when a cut that can be part of the stop has a curve and no band. Then the sampling error has no read.
477
+ */
478
+ readonly band?: DrawBand | undefined;
436
479
  }
437
480
  /** The outlook of one event of a case: the days, the chance and the shortfall of each draw. */
438
481
  export interface CaseOutlook {
@@ -458,6 +501,7 @@ export interface CaseOutlook {
458
501
  * - The days come from the share of the stores: `enduranceOf` for `take`, `bestEndurance` with the horizon for `best`.
459
502
  * - The chance and the shortfall use the curves of `stopCurves`. They count the stop only up to the horizon.
460
503
  * - `upper` is the safe side: its chance is not more, and its shortfall is not less, than the true value for each dependence.
504
+ * - `band` gives the same values with each cut at each end of its sampling band (`Cut.band`). The days do not change.
461
505
  *
462
506
  * @param layer - The endurance layer
463
507
  * @param caseCuts - The case
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["CutBound"],"sources":["../src/endurance.ts","../src/joint.ts","../src/best.ts","../src/shortfall.ts","../src/check.ts","../src/join.ts","../src/sample.ts"],"mappings":";;;iBAUiB;;WAEN,IAAI;;WAEJ,QAAQ;;WAER;;;;;;wBAOK,YAAY,UAAU,UAAU,SAAS,KAAK,iCAAiC;;;;;;;wBAoB/E,aAAa,OAAO,gBAAgB,IAAI,SAAS,eAAc,sBAAkC;;wBAYjG,WAAW,MAAM,MAAM,UAAU;;;;;wBAQjC,UAAU,OAAO,gBAAgB,UAAU,UAAU,cAAc,sBAAsB;;wBAWzF,SAAS,WAAW;;wBAKpB,aAAa,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAuLxB,YAAY,OAAO,gBAAgB,UAAU,UAAU,SAAS,cAAc;;iBC3P7E;WACN;WACA,IAAI;;;;;WAKJ;;WAEA;;WAEA;;;;;;WAMA,OAAO,SAAS,eAAe,SAAS;;;;;WAKxC;;WAEA,MAAM,SAAS;;;;;;WAMf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+BK,UAAU,OAAO,gBAAgB,UAAU,UAAU,SAAS,aAAa,2BAA2B;;iBC/CrG,oBAAoB;;;;;;WAM1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyDK,cAAc,OAAO,gBAAgB,UAAU,UAAU,SAAS,cAAc;;;;;;wBC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WACA;WACA;WACA,OAAO;;WAEP;;WAEA,gBAAgB;;WAEhB;;WAEA;;WAEA,OAAOA;;;;;;;;;;;;;;;wBAgBF,YAAY,OAAO,gBAAgB,UAAU,UAAU,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;qBCzrBpF;;YAmCD,wBAAwB;;iBAGnB,uBAAuB;WAC7B,MAAM;;;;;;;;;;;wBAcD,eAAe,OAAO,gBAAgB,QAAQ,QAAQ;;wBAiJtD,kBAAkB,iBAAiB;;;;;;;;;;;;;;;;;wBC7MnC,cAAc,iBAAiB,WAAW,oBAAoB,WAAW;;qBCf5E,wBAAwB;;;;;;;;;qBAkBxB,kBAAkB"}
1
+ {"version":3,"file":"index.d.ts","names":["CutBound"],"sources":["../src/endurance.ts","../src/joint.ts","../src/best.ts","../src/shortfall.ts","../src/check.ts","../src/join.ts","../src/sample.ts"],"mappings":";;;iBAUiB;;WAEN,IAAI;;WAEJ,QAAQ;;WAER;;;;;;wBAOK,YAAY,UAAU,UAAU,SAAS,KAAK,iCAAiC;;;;;;;wBAoB/E,aAAa,OAAO,gBAAgB,IAAI,SAAS,eAAc,sBAAkC;;wBAYjG,WAAW,MAAM,MAAM,UAAU;;;;;wBAQjC,UAAU,OAAO,gBAAgB,UAAU,UAAU,cAAc,sBAAsB;;wBAWzF,SAAS,WAAW;;wBAKpB,aAAa,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAuLxB,YAAY,OAAO,gBAAgB,UAAU,UAAU,SAAS,cAAc;;iBC3P7E;WACN;WACA,IAAI;;;;;WAKJ;;WAEA;;WAEA;;;;;;WAMA,OAAO,SAAS,eAAe,SAAS;;;;;WAKxC;;WAEA,MAAM,SAAS;;;;;;WAMf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+BK,UAAU,OAAO,gBAAgB,UAAU,UAAU,SAAS,aAAa,2BAA2B;;iBC/CrG,oBAAoB;;;;;;WAM1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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O,gBAAgB,eAAe,SAAS,uBAAuB;;YA8CxF,iBAAiB;;iBAGZ;;WAEN;;WAEA;;WAEA;;;iBAIM;WACN,OAAO;WACP,WAAW;;;;;;;iBAQL;WACN,SAAS;WACT,QAAQ;;;iBAIF;WACN;WACA;WACA;WACA;;WAEA;;WAEA;;;;;;WAMA,OAAO;;WAEP,WAAW;;WAEX,OAAOA;;WAEP;;;;;WAKA,OAAO;;;iBAID;WACN;WACA;WACA;WACA,OAAO;;WAEP;;WAEA,gBAAgB;;WAEhB;;WAEA;;WAEA,OAAOA;;;;;;;;;;;;;;;;wBAiBF,YAAY,OAAO,gBAAgB,UAAU,UAAU,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;qBC9vBpF;;YAmCD,wBAAwB;;iBAGnB,uBAAuB;WAC7B,MAAM;;;;;;;;;;;wBAcD,eAAe,OAAO,gBAAgB,QAAQ,QAAQ;;wBAsJtD,kBAAkB,iBAAiB;;;;;;;;;;;;;;;;;wBClNnC,cAAc,iBAAiB,WAAW,oBAAoB,WAAW;;qBCf5E,wBAAwB;;;;;;;;;qBAkBxB,kBAAkB"}
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as ENDURANCE_SCHEMA } from "./layer-a3Fr70Uh.js";
2
- import { S as exact, _ as fewestRow, a as hasEnduranceError, b as addTo, c as drawDemand, d as giftResource, f as storeAmounts, g as drawBlock, h as deviceUse, i as curveFault, l as enduranceOf, m as caseParts, n as ENDURANCE_CODES, o as caseDraws, p as Program, r as checkEndurance, s as caseStopped, t as joinEndurance, u as giftNeed, v as reachOf, x as dense, y as valueAt } from "./join-BwVV5q6r.js";
2
+ import { S as exact, _ as fewestRow, a as hasEnduranceError, b as addTo, c as drawDemand, d as giftResource, f as storeAmounts, g as drawBlock, h as deviceUse, i as curveFault, l as enduranceOf, m as caseParts, n as ENDURANCE_CODES, o as caseDraws, p as Program, r as checkEndurance, s as caseStopped, t as joinEndurance, u as giftNeed, v as reachOf, x as dense, y as valueAt } from "./join-C9nJDe7B.js";
3
3
  import { DEFAULT_MAX_SETS, STACK_SCHEMA, neededParts, stopSets, survivalAt, weakestBound } from "@mark1russell7/system-stack";
4
4
  import { ONE, ZERO, add, div, equals, mul, neg, sign, sub, toNumber } from "@mark1russell7/rational";
5
5
  import { solveLexicographic } from "@mark1russell7/linear";
@@ -918,6 +918,7 @@ function shareEndurance(layer, caseCuts, options, share) {
918
918
  * - `bound` is the weakest bound of the cases in the sum. A case with no prior, or with an expected count of 0, adds 0, so it does not change the bound.
919
919
  *
920
920
  * - With `share: "best"`, the endurance of each case comes from `bestEndurance` with the horizon of the shortfall.
921
+ * - `range` is the same sum with the rate of each case at each end of its interval (`RateRange`).
921
922
  *
922
923
  * @param layer - The endurance layer, with its cases and priors
923
924
  * @param place - The place of the priors
@@ -936,15 +937,34 @@ function yearShortfall(layer, place, options) {
936
937
  const independentUpper = [];
937
938
  const cases = [];
938
939
  const bounds = [];
940
+ const low = {
941
+ levels: zeroLevels(layer),
942
+ independent: zeroLevels(layer),
943
+ upper: zeroLevels(layer)
944
+ };
945
+ const high = {
946
+ levels: zeroLevels(layer),
947
+ independent: zeroLevels(layer),
948
+ upper: zeroLevels(layer)
949
+ };
950
+ const without = [];
951
+ let level = 1e400;
939
952
  for (const caseCuts of layer.cases ?? []) {
940
953
  const prior = (layer.priors ?? []).find((item) => item.case === caseCuts.case && item.place === place);
941
954
  if (prior === void 0) continue;
942
955
  const rate = yearRate(prior);
943
956
  const endurance = shareEndurance(layer, caseCuts, options, share);
944
957
  const shortfall = caseShortfall(layer, caseCuts, endurance, options);
945
- for (const [level, days] of Object.entries(shortfall.levels)) levels[level] = (levels[level] ?? 0) + rate * days;
946
- for (const [level, days] of Object.entries(shortfall.independent)) independent[level] = (independent[level] ?? 0) + rate * days;
947
- for (const [level, days] of Object.entries(shortfall.upper)) upper[level] = (upper[level] ?? 0) + rate * days;
958
+ addDays({
959
+ levels,
960
+ independent,
961
+ upper
962
+ }, shortfall, rate);
963
+ const rateInterval = prior.interval === void 0 ? void 0 : [prior.interval.low * prior.reach, prior.interval.high * prior.reach];
964
+ if (rateInterval === void 0) without.push(caseCuts.case);
965
+ else level = Math.min(level, prior.interval?.level ?? level);
966
+ addDays(low, shortfall, rateInterval?.[0] ?? rate);
967
+ addDays(high, shortfall, rateInterval?.[1] ?? rate);
948
968
  for (const need of shortfall.unread) if (!unread.includes(need)) unread.push(need);
949
969
  for (const need of shortfall.coarse) if (!coarse.includes(need)) coarse.push(need);
950
970
  for (const need of shortfall.independentUpper) if (!independentUpper.includes(need)) independentUpper.push(need);
@@ -952,10 +972,17 @@ function yearShortfall(layer, place, options) {
952
972
  cases.push({
953
973
  case: caseCuts.case,
954
974
  rate,
975
+ ...rateInterval === void 0 ? {} : { rateInterval },
955
976
  endurance,
956
977
  shortfall
957
978
  });
958
979
  }
980
+ const range = Number.isFinite(level) ? { range: {
981
+ level,
982
+ low,
983
+ high,
984
+ without
985
+ } } : {};
959
986
  return {
960
987
  place,
961
988
  levels,
@@ -965,9 +992,16 @@ function yearShortfall(layer, place, options) {
965
992
  coarse,
966
993
  independentUpper,
967
994
  bound: weakestBound(bounds),
968
- cases
995
+ cases,
996
+ ...range
969
997
  };
970
998
  }
999
+ /** This function adds the user-days of a shortfall times a count of events to each sum of the days. */
1000
+ function addDays(days, shortfall, count) {
1001
+ for (const [level, value] of Object.entries(shortfall.levels)) days.levels[level] = (days.levels[level] ?? 0) + count * value;
1002
+ for (const [level, value] of Object.entries(shortfall.independent)) days.independent[level] = (days.independent[level] ?? 0) + count * value;
1003
+ for (const [level, value] of Object.entries(shortfall.upper)) days.upper[level] = (days.upper[level] ?? 0) + count * value;
1004
+ }
971
1005
  /**
972
1006
  * This function gives the outlook of one event of a case. For each draw, it gives the days, the chance that the
973
1007
  * stores last through the stop, and the shortfall. A page of a place can show it for each case of its region.
@@ -975,6 +1009,7 @@ function yearShortfall(layer, place, options) {
975
1009
  * - The days come from the share of the stores: `enduranceOf` for `take`, `bestEndurance` with the horizon for `best`.
976
1010
  * - The chance and the shortfall use the curves of `stopCurves`. They count the stop only up to the horizon.
977
1011
  * - `upper` is the safe side: its chance is not more, and its shortfall is not less, than the true value for each dependence.
1012
+ * - `band` gives the same values with each cut at each end of its sampling band (`Cut.band`). The days do not change.
978
1013
  *
979
1014
  * @param layer - The endurance layer
980
1015
  * @param caseCuts - The case
@@ -989,6 +1024,19 @@ function caseOutlook(layer, caseCuts, options) {
989
1024
  const stopped = caseDraws(layer, caseCuts, caseStopped(caseCuts, options));
990
1025
  const stoppedNeeds = new Set(stopped.map((draw) => draw.need));
991
1026
  const stoppedOf = stoppedMemo(caseCuts, options);
1027
+ const banded = caseCuts.cuts.some((cut) => cut.band !== void 0);
1028
+ const endCuts = (end) => ({
1029
+ ...caseCuts,
1030
+ cuts: caseCuts.cuts.map(({ duration: _, band, ...cut }) => band === void 0 ? cut : {
1031
+ ...cut,
1032
+ duration: band[end],
1033
+ band
1034
+ })
1035
+ });
1036
+ const ends = banded ? {
1037
+ shorter: endCuts("low"),
1038
+ longer: endCuts("high")
1039
+ } : void 0;
992
1040
  const draws = [];
993
1041
  const unread = [];
994
1042
  const bounds = [];
@@ -1002,6 +1050,24 @@ function caseOutlook(layer, caseCuts, options) {
1002
1050
  const users = draw.users ?? 1;
1003
1051
  const lasts = (curve) => held.days >= horizon ? 1 : 1 - survivalAt(curve, held.days);
1004
1052
  const short = (curve) => tailDays(curve, held.days, horizon) * users;
1053
+ const values = (stop) => ({
1054
+ lasts: {
1055
+ event: lasts(stop.event),
1056
+ independent: lasts(stop.independent),
1057
+ upper: lasts(stop.upper)
1058
+ },
1059
+ shortfall: {
1060
+ event: short(stop.event),
1061
+ independent: short(stop.independent),
1062
+ upper: short(stop.upper)
1063
+ }
1064
+ });
1065
+ const shorter = ends === void 0 ? void 0 : stopCurvesWith(ends.shorter, draw, options, stoppedOf);
1066
+ const longer = ends === void 0 ? void 0 : stopCurvesWith(ends.longer, draw, options, stoppedOf);
1067
+ const band = shorter === void 0 || longer === void 0 ? {} : { band: {
1068
+ shorter: values(shorter),
1069
+ longer: values(longer)
1070
+ } };
1005
1071
  bounds.push(curves.bound);
1006
1072
  draws.push({
1007
1073
  need: draw.need,
@@ -1010,18 +1076,10 @@ function caseOutlook(layer, caseCuts, options) {
1010
1076
  users,
1011
1077
  days: held.days,
1012
1078
  ...held.atHorizon === true ? { atHorizon: true } : {},
1013
- lasts: {
1014
- event: lasts(curves.event),
1015
- independent: lasts(curves.independent),
1016
- upper: lasts(curves.upper)
1017
- },
1018
- shortfall: {
1019
- event: short(curves.event),
1020
- independent: short(curves.independent),
1021
- upper: short(curves.upper)
1022
- },
1079
+ ...values(curves),
1023
1080
  bound: curves.bound,
1024
- coarse: curves.coarse
1081
+ coarse: curves.coarse,
1082
+ ...band
1025
1083
  });
1026
1084
  }
1027
1085
  const holds = layer.draws.filter((draw) => !stoppedNeeds.has(draw.need)).map((draw) => draw.need);