@mark1russell7/capacity 0.1.1 → 0.2.0

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
@@ -438,9 +438,28 @@ if (gate.outcome === "block") console.log(gate.reason);
438
438
  - **A job.** A read of a job that agrees with its law falls on one side with a chance of `(1 - level) / 2` or less. The binomial test of the count of each side gives the p of the job.
439
439
  - **A side.** `partialConjunction` joins the p of the jobs for the claim "two jobs or more show this side" (`GATE_JOBS`). One job on an odd runner cannot block alone.
440
440
  - **The family.** `holm` corrects the tests of the two sides of each law at the level 0.01 (`GATE_ALPHA`). A rejected side is a block.
441
+ - **The size of the family.** The option `family` sets the count of laws before the reads. The default is the count of cases. A law with no power stays in the family.
441
442
  - **A low side is a block too.** The subject is faster or smaller than its law, thus the law is out of date. A new fit must replace it.
442
443
  - **No read.** The function `gateOf` of `@mark1russell7/rigor-bench` joins the laws. A law with fewer than two jobs gives no read. So does a law with too few reads to reject a side. A gate with no law gives no read. It does not pass.
443
444
 
445
+ ### A second look
446
+
447
+ A gate with no read can measure more jobs and look again. The level stays at `alpha` over the two looks.
448
+
449
+ - **No power.** A law is not tested when its best p is above `alpha / (2 × family)`. The best p is the p with each read on one side. It depends only on the counts, thus this choice does not spend the level.
450
+ - **More jobs.** A case of a law with no power gets `more` when it gives `again`, the reads of one new job. `more` is the least count of new jobs with which the law can decide, `MAX_MORE_JOBS` at most.
451
+ - **The second look.** The option `decided` gives the cases of the first look. Each decided case keeps its outcome. The function tests the other cases with all jobs.
452
+ - **The level.** Each law is tested at one look at most. Each look gives a false block with a chance of `alpha` times its share of the tests, or less. The sum is `alpha` or less.
453
+ - **The lab.** The job `gate` of the workflow writes the new jobs of each gate with no read. The job `lab-again` measures them on the CPU models of the laws, and the job `gate-final` gives the second look (CAP-122).
454
+
455
+ ### The reads that a job needs
456
+
457
+ A job with few reads cannot reject a side, also when each of its reads is on that side. More jobs do not correct this. `gateReadsFor(jobs, laws)` gives the least count of reads in each job with which the gate can decide a law.
458
+
459
+ - **The rule.** It is the least count r for which `jobs` jobs, each with r reads on one side, give a p of `alpha / (2 × laws)` or less.
460
+ - **An example.** At 13 jobs and 9 laws, a job needs 3 reads. With 2 reads, the best p is 12 × 0.025² = 0.0075. That is above 0.01 / 18.
461
+ - **The use.** A plan of a gate gives each job at least this count of points in the range of each law. The lab examines each gate plan against its law files with this rule.
462
+
444
463
  The caller gives the jobs of each law. Each job measured the subject in the conditions of the law. A job with `noRead` gives no read, for example a job with a noise floor over its limit. The lab gives the jobs, the noise rule and the workflow (CAP-26).
445
464
 
446
465
  A study used the 8 jobs of the laws of the request rate on the Intel Xeon 6975P-C, at eight rates from 1000 to 30000:
package/build/index.d.ts CHANGED
@@ -411,6 +411,8 @@ interface GateJob {
411
411
  interface GateCase {
412
412
  readonly law: Law;
413
413
  readonly jobs: readonly GateJob[];
414
+ /** This count is the reads of the law in a new job, for example the points of the plan that the law reads. It gives `LawGateCase.more`. */
415
+ readonly again?: number;
414
416
  }
415
417
  /** These options set the level of the run range, the level of the family of tests and the count of jobs of a side. */
416
418
  interface LawGateOptions extends LevelOptions {
@@ -418,6 +420,16 @@ interface LawGateOptions extends LevelOptions {
418
420
  readonly alpha?: number;
419
421
  /** This count is the jobs that each must show a side. The default is `GATE_JOBS`. */
420
422
  readonly jobs?: number;
423
+ /**
424
+ * This count is the laws of the family of tests. Each law gives two tests. A case that this look does not test adds two
425
+ * tests with a p of 1. The default is the count of cases. It cannot be less than the count of cases.
426
+ */
427
+ readonly family?: number;
428
+ /**
429
+ * These cases are the outcomes of the earlier looks of the same gate. A case with an outcome other than "cannot decide"
430
+ * keeps it, and this look does not test it. Give the same family to each look.
431
+ */
432
+ readonly decided?: readonly LawGateCase[];
421
433
  }
422
434
  /** A job count tells the reads of one job for one law, and the p of the count of each side. */
423
435
  interface JobCount {
@@ -457,7 +469,14 @@ interface LawGateCase extends GateCaseOutcome {
457
469
  readonly noRead: readonly NoReadJob[];
458
470
  /** These tests are the two sides, or an empty list for a case with too few jobs. */
459
471
  readonly sides: readonly SideTest[];
472
+ /**
473
+ * This count is the least count of new jobs with which the case can decide, each with `GateCase.again` reads. Only a
474
+ * case that cannot decide has it. A case with no `again`, or with no count up to `MAX_MORE_JOBS`, does not have it.
475
+ */
476
+ readonly more?: number;
460
477
  }
478
+ /** This count is the most new jobs of one case that `lawGate` examines for `LawGateCase.more`. */
479
+ export declare const MAX_MORE_JOBS = 16;
461
480
  /** A law gate is the gate of `@mark1russell7/rigor-bench` over the laws, with the facts that it uses. */
462
481
  interface LawGate extends Gate {
463
482
  readonly level: number;
@@ -466,6 +485,8 @@ interface LawGate extends Gate {
466
485
  readonly need: number;
467
486
  /** This chance is the chance of one side for one read of a job that agrees with its law: `(1 - level) / 2`. */
468
487
  readonly share: number;
488
+ /** This count is the laws of the family of tests (`LawGateOptions.family`). */
489
+ readonly family: number;
469
490
  readonly cases: readonly LawGateCase[];
470
491
  }
471
492
  /**
@@ -478,15 +499,36 @@ interface LawGate extends Gate {
478
499
  * A job with `noRead`, or with no read in the range of the law, gives no read.
479
500
  * - **A side:** `partialConjunction` joins the p of the jobs for the claim "`jobs` jobs or more show this side". Thus one
480
501
  * job on an odd runner cannot block alone. The claim has no condition on how the reads of one job depend on each other.
481
- * - **The family:** `holm` corrects the tests of the two sides of each law at the level `alpha`. A rejected side makes the
482
- * case `beyond`. A low side is a block too: the law is no longer the law of the subject, and a new fit must replace it.
483
- * - **No read:** a case with fewer than `jobs` jobs that read is `cannot decide`. So is a case whose reads are too few to
484
- * reject a side, also with each read on that side. The gate of `@mark1russell7/rigor-bench` (`gateOf`) joins the cases.
485
- * A gate with no case, or with a case that cannot decide and no block, is "no read". It does not pass.
502
+ * - **The family:** `holm` corrects the tests of the two sides of each law at the level `alpha`. The family has two tests
503
+ * for each of `family` laws. A rejected side makes the case `beyond`. A low side is a block too: the law is no longer
504
+ * the law of the subject, and a new fit must replace it.
505
+ * - **No read:** a case with fewer than `jobs` jobs that read is `cannot decide`. So is a case with too few reads to reject
506
+ * a side at the first step of Holm, with each read on that side. These cases are not tested: each has a p of 1.
507
+ * The gate of `@mark1russell7/rigor-bench` (`gateOf`) joins the cases. A gate with no case, or with a case that cannot
508
+ * decide and no block, is "no read". It does not pass.
509
+ * - **More jobs:** a case that cannot decide has `more` when its `again` gives the reads of a new job. It is the least count
510
+ * of new jobs with which the case can decide.
511
+ * - **Looks:** the option `decided` gives the outcomes of the earlier looks, for example before the new jobs. Each look
512
+ * tests only the cases that no earlier look decided, with one family for all looks. A case without power at a look is
513
+ * not tested at that look. Thus each case is tested at one look at most. The count a(t) is the tests of look t with a law
514
+ * that holds, and A is the sum over all looks. Look t gives a false block with a chance of `alpha` × a(t) / A or less. The sum is
515
+ * `alpha` or less.
486
516
  *
487
517
  * The function throws a `RangeError` for a level, an alpha or a count of jobs that is not valid.
488
518
  */
489
519
  export declare const lawGate: (cases: readonly GateCase[], options?: LawGateOptions) => LawGate;
520
+ /**
521
+ * This function gives the least count of reads in each job with which `lawGate` can decide a case. Let each job have r
522
+ * reads, each on one side. The count is the least r for which `jobs` jobs give a p of `alpha / (2 × laws)` or less. This
523
+ * bound is the first step of Holm when each of `laws` laws is a case of the gate.
524
+ *
525
+ * A job with fewer reads cannot reject a side, also when each of its reads is on that side. Thus a plan of a gate must
526
+ * give each job this count of points that each law reads. More jobs do not correct too few reads in each job.
527
+ *
528
+ * The function throws a `RangeError` in three cases. The first is `jobs` or `laws` that is not a whole number above 0.
529
+ * The second is `jobs` below the count of jobs of a side. The third is no count up to 64 reads that can decide.
530
+ */
531
+ export declare const gateReadsFor: (jobs: number, laws: number, options?: LawGateOptions) => number;
490
532
  /**
491
533
  * This function examines a demand and gives each problem that it finds. A demand with no problem
492
534
  * gives an empty list.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/names.ts","../src/check.ts","../src/forms.ts","../src/fit.ts","../src/knee.ts","../src/gate.ts","../src/workload-check.ts","../src/app-check.ts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A;;;;;;UAOM;WACN;WACA;WACA,QAAQ;;WAER;;WAEA;;WAEA;;;;;;;;;;UAWM;WACN;WACA;WACA,QAAQ;WACR,QAAQ;WACR;WACA;WACA,iBAAiB;;;;;;;;;;UAWX;WACN;WACA;WACA,OAAO;WACP;WACA;WACA,iBAAiB;WACjB,MAAM;;;;;;;;;;;;;;;;;;;qBAkRJ,aAAc,OAAO,YAAY,eAAe,QAAQ,QAAQ,UAAS,iBAAoB,OAAO,YAAY;;;;;;;;;;;;;;;;;;qBAuChH,YAAa,OAAO,YAAY,QAAQ,QAAQ,UAAS,iBAAoB,OAAO,WAAW;;UA8D3F;WACN;WACA;;;;;WAKA;;WAEA;;;;;;;;;;;UAYM;WACN;WACA;;WAEA,OAAO;;WAEP,QAAQ;;WAER,iBAAiB;WACjB,SAAS,mBAAmB,OAAO,WAAW;WAC9C,UAAU,eAAe,mBAAmB,OAAO,YAAY;;;;;;;;;;;;;;;qBA0B7D,cAAe,OAAO,YAAY,QAAQ,QAAQ,OAAO,OAAO,UAAS,iBAAoB,OAAO,aAAa"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/names.ts","../src/check.ts","../src/forms.ts","../src/fit.ts","../src/knee.ts","../src/gate.ts","../src/workload-check.ts","../src/app-check.ts","../src/observe.ts","../src/app-metrics.ts","../src/instance-check.ts","../src/limit.ts","../src/scale.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;qBAGa,MAAM;;qBAGN,MAAM;;;;;;;;;;;;;;;;;;qBCuCN,WAAY,KAAK,iBAAe;;qBCtChC;;;;;;UAOI;WACN;WACA,OAAO;WACP,OAAO;;;;;;;;;;KAWN;WACG;;WACA;WAAyB;WAAqC;;;;;;;;;KASjE;WAAoB;;WAA6B;;WAA4B;WAAwB;;;;;;UAMhG;WACN;WACA,MAAM;WACN,SAAS;;;;;;UAOH;WACN;WACA;WACA,gBAAgB;WAChB,iBAAiB;;;;;;UAOX;WACN;WACA,YAAY,SAAS;;;UAIf;WAC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BAuChH,YAAa,OAAO,YAAY,QAAQ,QAAQ,UAAS,iBAAoB,OAAO,WAAW;;UA8D3F;WACN;WACA;;;;;WAKA;;WAEA;;;;;;;;;;;UAYM;WACN;WACA;;WAEA,OAAO;;WAEP,QAAQ;;WAER,iBAAiB;WACjB,SAAS,mBAAmB,OAAO,WAAW;WAC9C,UAAU,eAAe,mBAAmB,OAAO,YAAY;;;;;;;;;;;;;;;qBA0B7D,cAAe,OAAO,YAAY,QAAQ,QAAQ,OAAO,OAAO,UAAS,iBAAoB,OAAO,aAAa"}
package/build/index.js CHANGED
@@ -963,6 +963,8 @@ const lawRead = (law, point, value, options = {}) => {
963
963
  side: value > run.high ? "high" : value < run.low ? "low" : "within"
964
964
  });
965
965
  };
966
+ /** This count is the most new jobs of one case that `lawGate` examines for `LawGateCase.more`. */
967
+ const MAX_MORE_JOBS = 16;
966
968
  /** This function gives the text of a number with at most 3 significant digits. */
967
969
  const short = (value) => Number.isInteger(value) ? String(value) : value.toPrecision(3);
968
970
  /** This function gives the counts of one job for one law, or the reason that the job gives no read. */
@@ -999,6 +1001,20 @@ const countOf = (law, job, level, share) => {
999
1001
  unread
1000
1002
  };
1001
1003
  };
1004
+ /** This function gives the best p of a side: the p with each read of each job on that side. */
1005
+ const bestOf = (reads, share, need) => partialConjunction(reads.map((count) => binomialTest(count, count, share, "greater")), need);
1006
+ /**
1007
+ * This function gives the least count of new jobs with which a case can decide. Each new job gives `again` reads.
1008
+ * The case has jobs with `reads` reads. To decide, it needs `need` jobs or more, and a best p of `bound` or less.
1009
+ * The function gives nothing when no count up to `MAX_MORE_JOBS` can decide.
1010
+ */
1011
+ const moreOf = (reads, again, share, need, bound) => {
1012
+ if (!Number.isInteger(again) || again < 1) return void 0;
1013
+ for (let more = 1; more <= 16; more += 1) {
1014
+ const all = [...reads, ...Array.from({ length: more }, () => again)];
1015
+ if (all.length >= need && bestOf(all, share, need) <= bound) return more;
1016
+ }
1017
+ };
1002
1018
  /**
1003
1019
  * This function gives the gate of some laws. For each law, it tells if the measured values of the jobs stay in the run
1004
1020
  * range of the law. It is the rule of a gate of the laws of a subject, for example on a pull request.
@@ -1009,11 +1025,20 @@ const countOf = (law, job, level, share) => {
1009
1025
  * A job with `noRead`, or with no read in the range of the law, gives no read.
1010
1026
  * - **A side:** `partialConjunction` joins the p of the jobs for the claim "`jobs` jobs or more show this side". Thus one
1011
1027
  * job on an odd runner cannot block alone. The claim has no condition on how the reads of one job depend on each other.
1012
- * - **The family:** `holm` corrects the tests of the two sides of each law at the level `alpha`. A rejected side makes the
1013
- * case `beyond`. A low side is a block too: the law is no longer the law of the subject, and a new fit must replace it.
1014
- * - **No read:** a case with fewer than `jobs` jobs that read is `cannot decide`. So is a case whose reads are too few to
1015
- * reject a side, also with each read on that side. The gate of `@mark1russell7/rigor-bench` (`gateOf`) joins the cases.
1016
- * A gate with no case, or with a case that cannot decide and no block, is "no read". It does not pass.
1028
+ * - **The family:** `holm` corrects the tests of the two sides of each law at the level `alpha`. The family has two tests
1029
+ * for each of `family` laws. A rejected side makes the case `beyond`. A low side is a block too: the law is no longer
1030
+ * the law of the subject, and a new fit must replace it.
1031
+ * - **No read:** a case with fewer than `jobs` jobs that read is `cannot decide`. So is a case with too few reads to reject
1032
+ * a side at the first step of Holm, with each read on that side. These cases are not tested: each has a p of 1.
1033
+ * The gate of `@mark1russell7/rigor-bench` (`gateOf`) joins the cases. A gate with no case, or with a case that cannot
1034
+ * decide and no block, is "no read". It does not pass.
1035
+ * - **More jobs:** a case that cannot decide has `more` when its `again` gives the reads of a new job. It is the least count
1036
+ * of new jobs with which the case can decide.
1037
+ * - **Looks:** the option `decided` gives the outcomes of the earlier looks, for example before the new jobs. Each look
1038
+ * tests only the cases that no earlier look decided, with one family for all looks. A case without power at a look is
1039
+ * not tested at that look. Thus each case is tested at one look at most. The count a(t) is the tests of look t with a law
1040
+ * that holds, and A is the sum over all looks. Look t gives a false block with a chance of `alpha` × a(t) / A or less. The sum is
1041
+ * `alpha` or less.
1017
1042
  *
1018
1043
  * The function throws a `RangeError` for a level, an alpha or a count of jobs that is not valid.
1019
1044
  */
@@ -1025,32 +1050,55 @@ const lawGate = (cases, options = {}) => {
1025
1050
  if (!(alpha > 0 && alpha < 1)) throw new RangeError(`The alpha ${alpha} is not between 0 and 1.`);
1026
1051
  if (!Number.isInteger(need) || need < 1) throw new RangeError(`The count of jobs ${need} is not a whole number above 0.`);
1027
1052
  const share = (1 - level) / 2;
1028
- const counted = cases.map(({ law, jobs }) => {
1053
+ const family = options.family ?? cases.length;
1054
+ if (!Number.isInteger(family) || family < cases.length) throw new RangeError(`The family ${family} is not a whole number of ${cases.length} cases or more.`);
1055
+ const tests = family * 2;
1056
+ const bound = alpha / tests;
1057
+ const decided = new Map((options.decided ?? []).filter((each) => each.outcome !== "cannot decide").map((each) => [each.case, each]));
1058
+ const counted = cases.map(({ law, jobs, again }) => {
1029
1059
  const found = jobs.map((job) => countOf(law, job, level, share));
1030
1060
  return {
1031
1061
  law,
1032
1062
  jobs: found.filter((each) => "reads" in each),
1033
- noRead: found.filter((each) => "reason" in each)
1063
+ noRead: found.filter((each) => "reason" in each),
1064
+ again
1034
1065
  };
1035
1066
  });
1036
- const decidable = counted.filter((each) => each.jobs.length >= need);
1037
- const tests = decidable.length * 2;
1067
+ const powered = (each) => !decided.has(each.law.id) && each.jobs.length >= need && bestOf(each.jobs.map((job) => job.reads), share, need) <= bound;
1068
+ const tested = counted.filter(powered);
1038
1069
  const pOf = (jobs, side) => partialConjunction(jobs.map((job) => side === "high" ? job.pHigh : job.pLow), need);
1039
- const corrected = holm(decidable.flatMap((each) => [pOf(each.jobs, "high"), pOf(each.jobs, "low")]), alpha);
1070
+ const corrected = holm([...tested.flatMap((each) => [pOf(each.jobs, "high"), pOf(each.jobs, "low")]), ...Array.from({ length: tests - tested.length * 2 }, () => 1)], alpha);
1040
1071
  let next = 0;
1041
- const outcomes = counted.map(({ law, jobs, noRead }) => {
1072
+ const outcomes = counted.map((each) => {
1073
+ const { law, jobs, noRead, again } = each;
1074
+ const earlier = decided.get(law.id);
1075
+ if (earlier !== void 0) return earlier;
1042
1076
  const base = {
1043
1077
  case: law.id,
1044
1078
  jobs,
1045
1079
  noRead
1046
1080
  };
1047
- if (jobs.length < need) {
1048
- const reason = `${jobs.length} jobs read the law. The gate needs ${need} jobs or more.${noRead.length > 0 ? ` ${noRead[0].reason}` : ""}`;
1081
+ if (!powered(each)) {
1082
+ const more = again === void 0 ? void 0 : moreOf(jobs.map((job) => job.reads), again, share, need, bound);
1083
+ const extra = more === void 0 ? {} : { more };
1084
+ if (jobs.length < need) {
1085
+ const reason = `${jobs.length} jobs read the law. The gate needs ${need} jobs or more.${noRead.length > 0 ? ` ${noRead[0].reason}` : ""}`;
1086
+ return {
1087
+ ...base,
1088
+ outcome: "cannot decide",
1089
+ reason,
1090
+ sides: [],
1091
+ ...extra
1092
+ };
1093
+ }
1094
+ const best = bestOf(jobs.map((job) => job.reads), share, need);
1095
+ const reason = `The reads are too few to reject a side: with each read on one side, the p is ${short(best)}, above ${short(bound)}.`;
1049
1096
  return {
1050
1097
  ...base,
1051
1098
  outcome: "cannot decide",
1052
1099
  reason,
1053
- sides: []
1100
+ sides: [],
1101
+ ...extra
1054
1102
  };
1055
1103
  }
1056
1104
  const sides = ["high", "low"].map((side) => {
@@ -1063,7 +1111,6 @@ const lawGate = (cases, options = {}) => {
1063
1111
  reject: test?.reject ?? false
1064
1112
  };
1065
1113
  });
1066
- const best = partialConjunction(jobs.map((job) => binomialTest(job.reads, job.reads, share, "greater")), need);
1067
1114
  const reads = jobs.reduce((sum, job) => sum + job.reads, 0);
1068
1115
  const high = jobs.reduce((sum, job) => sum + job.high, 0);
1069
1116
  const low = jobs.reduce((sum, job) => sum + job.low, 0);
@@ -1078,15 +1125,6 @@ const lawGate = (cases, options = {}) => {
1078
1125
  sides
1079
1126
  };
1080
1127
  }
1081
- if (best > alpha / tests) {
1082
- const reason = `The reads are too few to reject a side: with each read on one side, the p is ${short(best)}, above ${short(alpha / tests)}.`;
1083
- return {
1084
- ...base,
1085
- outcome: "cannot decide",
1086
- reason,
1087
- sides
1088
- };
1089
- }
1090
1128
  return {
1091
1129
  ...base,
1092
1130
  outcome: "within",
@@ -1100,9 +1138,36 @@ const lawGate = (cases, options = {}) => {
1100
1138
  alpha,
1101
1139
  need,
1102
1140
  share,
1141
+ family,
1103
1142
  cases: outcomes
1104
1143
  };
1105
1144
  };
1145
+ /** This count is the most reads in one job that `gateReadsFor` examines. */
1146
+ const MAX_GATE_READS = 64;
1147
+ /**
1148
+ * This function gives the least count of reads in each job with which `lawGate` can decide a case. Let each job have r
1149
+ * reads, each on one side. The count is the least r for which `jobs` jobs give a p of `alpha / (2 × laws)` or less. This
1150
+ * bound is the first step of Holm when each of `laws` laws is a case of the gate.
1151
+ *
1152
+ * A job with fewer reads cannot reject a side, also when each of its reads is on that side. Thus a plan of a gate must
1153
+ * give each job this count of points that each law reads. More jobs do not correct too few reads in each job.
1154
+ *
1155
+ * The function throws a `RangeError` in three cases. The first is `jobs` or `laws` that is not a whole number above 0.
1156
+ * The second is `jobs` below the count of jobs of a side. The third is no count up to 64 reads that can decide.
1157
+ */
1158
+ const gateReadsFor = (jobs, laws, options = {}) => {
1159
+ const level = options.level ?? .95;
1160
+ const alpha = options.alpha ?? .01;
1161
+ const need = options.jobs ?? 2;
1162
+ if (!(level > 0 && level < 1)) throw new RangeError(`The level ${level} is not between 0 and 1.`);
1163
+ if (!(alpha > 0 && alpha < 1)) throw new RangeError(`The alpha ${alpha} is not between 0 and 1.`);
1164
+ if (!Number.isInteger(need) || need < 1) throw new RangeError(`The count of jobs ${need} is not a whole number above 0.`);
1165
+ if (!Number.isInteger(laws) || laws < 1) throw new RangeError(`The count of laws ${laws} is not a whole number above 0.`);
1166
+ if (!Number.isInteger(jobs) || jobs < need) throw new RangeError(`The count of jobs ${jobs} is not a whole number of ${need} or more.`);
1167
+ const share = (1 - level) / 2;
1168
+ for (let reads = 1; reads <= MAX_GATE_READS; reads += 1) if (bestOf(Array.from({ length: jobs }, () => reads), share, need) <= alpha / (2 * laws)) return reads;
1169
+ throw new RangeError(`At ${jobs} jobs and ${laws} laws, ${MAX_GATE_READS} reads in each job cannot decide a case.`);
1170
+ };
1106
1171
  // src/app-metrics.ts
1107
1172
  /**
1108
1173
  * This function gives the increase of a counter from its values in the order of their times. A value below
@@ -1708,6 +1773,6 @@ const scaleLadder = (model, demand, range, options = {}) => {
1708
1773
  reachAt
1709
1774
  });
1710
1775
  };
1711
- export { APP_FILE, APP_FORMAT, APP_LINE_KINDS, COMPOSITION_FORMAT, DEFAULT_LEVEL, FORMS, FORM_VARIABLE, GATE_ALPHA, GATE_JOBS, INSTANCE_FORMAT, KNEE_STEPS, LAW_FORMAT, LIMITS_FORMAT, MAX_VARIABLES, NAME, NO_DEMAND, RATE, RESOURCE_UNITS, SCALE_MOST, SCALE_STEPS, SLUG, WORKLOAD_FORMAT, appWorkloadProblems, bootstrapDraws, catalogForm, checkApp, checkComposition, checkInstance, checkLaw, checkLimits, checkWorkload, compositionValue, constantIdsOf, constantIntervals, countReach, counterIncrease, demandProblems, fillPlaceholders, fitLaw, formOf, formSlopes, formValues, gridOf, instancePointOf, instanceProblems, isHttps, isLawTerm, kneeRuleProblem, lawGate, lawKnee, lawReach, lawRead, lawValue, leastCount, leastGroups, limitAmount, limitProblems, limitUse, limitUses, loadPointOf, mergeDemands, metricsGaps, observationOf, observedWorkload, placeholdersOf, programOf, requestPath, scaleDemand, scaleLadder, scaleRule, separableOf, shareOf, slopeOf, startOf, totalRate };
1776
+ export { APP_FILE, APP_FORMAT, APP_LINE_KINDS, COMPOSITION_FORMAT, DEFAULT_LEVEL, FORMS, FORM_VARIABLE, GATE_ALPHA, GATE_JOBS, INSTANCE_FORMAT, KNEE_STEPS, LAW_FORMAT, LIMITS_FORMAT, MAX_MORE_JOBS, MAX_VARIABLES, NAME, NO_DEMAND, RATE, RESOURCE_UNITS, SCALE_MOST, SCALE_STEPS, SLUG, WORKLOAD_FORMAT, appWorkloadProblems, bootstrapDraws, catalogForm, checkApp, checkComposition, checkInstance, checkLaw, checkLimits, checkWorkload, compositionValue, constantIdsOf, constantIntervals, countReach, counterIncrease, demandProblems, fillPlaceholders, fitLaw, formOf, formSlopes, formValues, gateReadsFor, gridOf, instancePointOf, instanceProblems, isHttps, isLawTerm, kneeRuleProblem, lawGate, lawKnee, lawReach, lawRead, lawValue, leastCount, leastGroups, limitAmount, limitProblems, limitUse, limitUses, loadPointOf, mergeDemands, metricsGaps, observationOf, observedWorkload, placeholdersOf, programOf, requestPath, scaleDemand, scaleLadder, scaleRule, separableOf, shareOf, slopeOf, startOf, totalRate };
1712
1777
 
1713
1778
  //# sourceMappingURL=index.js.map