@mark1russell7/stack-endurance 0.8.19 → 0.8.21
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 +21 -1
- package/build/add-on.d.ts +1 -1
- package/build/add-on.js +1 -1
- package/build/index.d.ts +39 -7
- package/build/index.d.ts.map +1 -1
- package/build/index.js +7 -7
- package/build/index.js.map +1 -1
- package/build/{join-Du2gsJJ6.js → join-CM_zwI78.js} +288 -61
- package/build/join-CM_zwI78.js.map +1 -0
- package/build/{layer-BCQy77mt.d.ts → layer-DuGjz7Cl.d.ts} +27 -2
- package/build/layer-DuGjz7Cl.d.ts.map +1 -0
- package/build/layer-a3Fr70Uh.js.map +1 -1
- package/build/schema.d.ts +1 -1
- package/build/schema.d.ts.map +1 -1
- package/build/schema.js +3 -1
- package/build/schema.js.map +1 -1
- package/package.json +1 -1
- package/build/join-Du2gsJJ6.js.map +0 -1
- package/build/layer-BCQy77mt.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -55,6 +55,26 @@ A converter can have a `season`. It has a window of sow days in each year (`from
|
|
|
55
55
|
- `jointDays` gives the largest common first stop. With `atHorizon`, the plan holds the horizon.
|
|
56
56
|
- Since 0.8.19, a draw of `enduranceOf` with a shared device and a season gets the programs of `bestEndurance` for itself alone (M2-grow-share-sweep). Its stocks, harvest lots and device-days are those that the higher draws leave. It has no field `spoiled`.
|
|
57
57
|
|
|
58
|
+
## Power from the sun: a source with shares in each month
|
|
59
|
+
|
|
60
|
+
A converter with a limit `perDay` more than 0 can take nothing. It is a source, for example a solar panel. A converter can also have `monthly`: 12 shares from 0 to 1, January first. In a day of month `m`, the converter has `devices` times `monthly[m]` device-days. Thus a panel with `perDay` 1500 and a share of 0.2 in January gives 300 runs in a day of January. Since 0.8.20 (M2-solar).
|
|
61
|
+
|
|
62
|
+
- The energy of a day that no draw takes is lost, unless a store of its resource has a `capacity`. Then the store takes a charge (the next section).
|
|
63
|
+
- A take uses a source first, before the stores and the other converters. The runs of a source in a day are lost when no draw uses them.
|
|
64
|
+
- A layer with a source or with shares goes in segments to the horizon, as a layer with a season. A segment also ends at the start of each month. A source can feed a draw with no end, thus the horizon is the upper limit of its days.
|
|
65
|
+
- After a stop, a draw can hold again from the start of a month with more device-days. `again` gives these spans.
|
|
66
|
+
- A higher draw keeps the largest part of the device-days that it uses in a month, for each month of a lower draw. This is the safe side.
|
|
67
|
+
- The converters of one device have the same shares. A converter with shares has a limit `perDay` and no season. The gate refuses the other cases (`endurance-monthly`).
|
|
68
|
+
|
|
69
|
+
### A battery: a store with a capacity
|
|
70
|
+
|
|
71
|
+
A store can have a `capacity`: the most amount that it holds. A source that gives the resource of the store charges it with the runs that no draw takes on their day. Example: a battery of 6000 Wh takes the energy of a sunny day, and gives it back on a dark day. Since 0.8.21 (M2-solar-charge).
|
|
72
|
+
|
|
73
|
+
- `bestEndurance` and `jointDays` give the charge in each segment of the days. In a segment, the takes are not more than the level at the start of the segment. Also the level at the start plus the charge is not more than the capacity. Thus each order of the takes and the charges in the segment is a plan. This is the safe side.
|
|
74
|
+
- The sweep of `enduranceOf` takes one draw at a time, and it gives no charge. There a store with a capacity is a store with no charge. The follow-up M2-solar-charge-sweep adds the charge to the sweep.
|
|
75
|
+
- Only a source charges a store. A maker with inputs gives no charge, because its inputs keep to the day of the take.
|
|
76
|
+
- The stores of one resource all have a capacity, or none has one. A store with a capacity has no due date, and its capacity is not less than its amount. The gate refuses the other cases (`endurance-capacity`).
|
|
77
|
+
|
|
58
78
|
## The rule of shortfall
|
|
59
79
|
|
|
60
80
|
- For one draw in one case, the shortfall is `E[max(0, D - T)] * users`. `T` is the endurance of the draw. `D` is the duration of the stop of its supply.
|
|
@@ -232,4 +252,4 @@ In the sample, the rice needs 2 L of water for each kg. The drinking water holds
|
|
|
232
252
|
|
|
233
253
|
## The gate
|
|
234
254
|
|
|
235
|
-
`checkEndurance(layer, stack)` gives the faults of a layer. `ENDURANCE_CODES` lists the codes. The gate finds two records with one key, and an unknown level, resource or part. It also finds a value out of range, a bad date, an empty converter and a bad survival curve. Converters that make a resource from itself are a cycle, and the gate refuses them. Two counts of devices for one device are a fault (`endurance-devices`). A device with a limited converter and a converter with no limit is a warning (`endurance-device-mix`), because the converter with no limit uses no device-days. A draw with no way to get its need is a warning, and a cut with no curve is a warning. A bad season is a fault (`endurance-season`). A converter with a season is not part of a cycle, because its harvest comes after its sowing.
|
|
255
|
+
`checkEndurance(layer, stack)` gives the faults of a layer. `ENDURANCE_CODES` lists the codes. The gate finds two records with one key, and an unknown level, resource or part. It also finds a value out of range, a bad date, an empty converter and a bad survival curve. Converters that make a resource from itself are a cycle, and the gate refuses them. Two counts of devices for one device are a fault (`endurance-devices`). A device with a limited converter and a converter with no limit is a warning (`endurance-device-mix`), because the converter with no limit uses no device-days. A draw with no way to get its need is a warning, and a cut with no curve is a warning. A bad season is a fault (`endurance-season`). Bad shares `monthly` are a fault (`endurance-monthly`). A converter that takes nothing is a fault, but for a source with a limit `perDay` more than 0. A converter with a season is not part of a cycle, because its harvest comes after its sowing.
|
package/build/add-on.d.ts
CHANGED
package/build/add-on.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as checkEndurance, t as joinEndurance } from "./join-
|
|
1
|
+
import { r as checkEndurance, t as joinEndurance } from "./join-CM_zwI78.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
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { _ as Season, a as DirectUse, c as ENDURANCE_SCHEMA, d as Gift, f as Harvest, g as Resource, h as Prior, i as CutBound, l as Endurance, m as MonthDay, n as Converter, o as Draw, p as IsoDate, r as Cut, s as DrawEndurance, t as CaseCuts, u as EnduranceLayer, v as Store, y as Survival } from "./layer-
|
|
1
|
+
import { _ as Season, a as DirectUse, c as ENDURANCE_SCHEMA, d as Gift, f as Harvest, g as Resource, h as Prior, i as CutBound, l as Endurance, m as MonthDay, n as Converter, o as Draw, p as IsoDate, r as Cut, s as DrawEndurance, t as CaseCuts, u as EnduranceLayer, v as Store, y as Survival } from "./layer-DuGjz7Cl.js";
|
|
2
2
|
import { CutBound as CutBound$1, Fault, LayerParse, LayerPiece, PathOptions, Stack, curveFault, survivalAt } from "@mark1russell7/system-stack";
|
|
3
|
+
/**
|
|
4
|
+
* This function tells if a converter is a source (M2-solar): it takes nothing, and it has a limit `perDay` more than 0.
|
|
5
|
+
* Its runs of a day are lost when no draw uses them. Thus a take uses a source before a store.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isSource(converter: Converter): boolean;
|
|
3
8
|
/** The options of the queries of a case. */
|
|
4
9
|
export interface CaseOptions {
|
|
5
10
|
/** The date of the query. A store whose due date is on this date or before it gives nothing. */
|
|
@@ -9,13 +14,14 @@ export interface CaseOptions {
|
|
|
9
14
|
/** The `id` of more parts that are down, with the cuts of the case. */
|
|
10
15
|
readonly down?: readonly string[] | undefined;
|
|
11
16
|
/**
|
|
12
|
-
* The first day of the event, for the sow days of each converter with a season (M2-grow)
|
|
17
|
+
* The first day of the event, for the sow days of each converter with a season (M2-grow) and the months of the shares
|
|
18
|
+
* `monthly` (M2-solar). The default is `at`. The
|
|
13
19
|
* stores are the stores at `at`. Thus a query can move the event in the year and keep the stores.
|
|
14
20
|
*/
|
|
15
21
|
readonly start?: IsoDate | undefined;
|
|
16
22
|
/**
|
|
17
|
-
* The horizon in days, more than 0. A layer with no converter with a season
|
|
18
|
-
* such a converter, the query reads the sowings up to the horizon, and a draw holds the horizon at most. The default
|
|
23
|
+
* The horizon in days, more than 0. A layer with no converter with a season, shares `monthly` or a source does not use
|
|
24
|
+
* it in `enduranceOf`. With such a converter, the query reads the sowings up to the horizon, and a draw holds the horizon at most. The default
|
|
19
25
|
* is `SEASON_HORIZON_DAYS`.
|
|
20
26
|
*/
|
|
21
27
|
readonly horizon?: number | undefined;
|
|
@@ -27,6 +33,17 @@ export declare const SEASON_HORIZON_DAYS = 730;
|
|
|
27
33
|
* With a stack, it also gives each part that stops.
|
|
28
34
|
*/
|
|
29
35
|
export declare function caseStopped(caseCuts: CaseCuts, options: Pick<CaseOptions, "stack" | "down">): Set<string>;
|
|
36
|
+
/** This function gives the month of the day `day` after the start, 0 for January (M2-solar). It throws a `RangeError` for a bad date. */
|
|
37
|
+
export declare function monthOf(start: IsoDate, day: number): number;
|
|
38
|
+
/**
|
|
39
|
+
* This function gives the days from the start to the first day of each month, in increasing order (M2-solar). Each
|
|
40
|
+
* day is more than 0 and less than the horizon. It throws a `RangeError` for a date that is not `YYYY-MM-DD`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function monthEdges(start: IsoDate, horizon: number): number[];
|
|
43
|
+
/** This function gives the shares `monthly` of each device key of the converters with a limit and shares (M2-solar). */
|
|
44
|
+
export declare function monthlyShares(converters: Iterable<Converter>): Map<string, readonly number[]>;
|
|
45
|
+
/** This function gives the share of the device-days of a key in a month: its share `monthly`, or 1. */
|
|
46
|
+
export declare function shareOf(shares: ReadonlyMap<string, readonly number[]>, key: string, month: number): number;
|
|
30
47
|
/**
|
|
31
48
|
* This function gives the amount of each resource in the stores at a date, by the code of the resource.
|
|
32
49
|
*
|
|
@@ -69,13 +86,19 @@ export interface SeasonSupply {
|
|
|
69
86
|
readonly lots: readonly HarvestLot[];
|
|
70
87
|
/** The horizon in days (`horizon` of the options, default `SEASON_HORIZON_DAYS`). */
|
|
71
88
|
readonly horizon: number;
|
|
89
|
+
/** The first day of the event (`start` of the options, or `at`). The shares `monthly` read the month of each day from it (M2-solar). */
|
|
90
|
+
readonly start: IsoDate;
|
|
72
91
|
}
|
|
73
92
|
/**
|
|
74
93
|
* This function gives the supply of a case with a season (M2-grow-share). `enduranceOf`, `bestEndurance` and `jointDays`
|
|
75
94
|
* use it, so they read the same sowings. It throws a `RangeError` for a horizon that is not more than 0, or a date that is not `YYYY-MM-DD`.
|
|
76
95
|
*/
|
|
77
96
|
export declare function seasonSupply(layer: EnduranceLayer, stoppedParts: ReadonlySet<string>, options: CaseOptions): SeasonSupply;
|
|
78
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* This function tells if a layer has a converter with a season, with shares `monthly` or a source (M2-solar) that can run
|
|
99
|
+
* in a case. Such a layer needs the queries in segments of days to a horizon. A harvest, a spoil day and the start of a
|
|
100
|
+
* month end a segment. A source can feed a draw with no end, thus the horizon is the upper limit of its days.
|
|
101
|
+
*/
|
|
79
102
|
export declare function hasSeason(layer: EnduranceLayer, stoppedParts: ReadonlySet<string>): boolean;
|
|
80
103
|
/**
|
|
81
104
|
* This function gives the days that each draw holds when a case stops its supply, and the resources that are used up then.
|
|
@@ -105,6 +128,9 @@ export declare function hasSeason(layer: EnduranceLayer, stoppedParts: ReadonlyS
|
|
|
105
128
|
* A lower draw gets the stocks that the higher draws leave, the earliest stocks first taken. This is the safe side.
|
|
106
129
|
* - A draw with a shared device and a season gets the programs of `bestEndurance` for itself alone (M2-grow-share-sweep). Its stocks,
|
|
107
130
|
* its harvest lots and its device-days are those that the higher draws leave. It has no field `spoiled`.
|
|
131
|
+
* - A source (M2-solar) takes nothing and has a limit `perDay`. A take uses it first: its runs of a day are lost when no
|
|
132
|
+
* draw uses them. With shares `monthly`, the device-days of a day are the devices times the share of its month. Each
|
|
133
|
+
* span also ends at the start of a month, and a draw can hold again from the start of a month.
|
|
108
134
|
*
|
|
109
135
|
* The function is pure, but for an internal count of the tries of its fits for the tests. It throws a `RangeError` for a date that is not `YYYY-MM-DD`. The gate `checkEndurance` examines the layer before.
|
|
110
136
|
*
|
|
@@ -614,7 +640,8 @@ export declare function caseOutlook(layer: EnduranceLayer, caseCuts: CaseCuts, o
|
|
|
614
640
|
* - `endurance-part-unknown`: a supply, a device, the part of a store or a cut is not a part of the base stack.
|
|
615
641
|
* - `endurance-range`: an amount, a rate, a count or a factor is not a finite number of 0 or more. Or a reach is not from 0 to 1.
|
|
616
642
|
* - `endurance-date`: a date is not a date `YYYY-MM-DD`.
|
|
617
|
-
* - `endurance-converter-empty`: a converter takes nothing, or it gives an amount of 0.
|
|
643
|
+
* - `endurance-converter-empty`: a converter takes nothing and has no limit `perDay` more than 0, or it gives an amount of 0.
|
|
644
|
+
* A converter with a limit can take nothing: it is a source, for example a solar panel. Since 0.8.20 (M2-solar).
|
|
618
645
|
* - `endurance-curve`: a survival curve does not start at `[0, 1]`, or it does not end at a chance of 0.
|
|
619
646
|
* Or its days do not increase, or its chance increases.
|
|
620
647
|
* - `endurance-bound`: the bound of a cut is not a value of `CUT_BOUNDS` of the core. Since 0.8.4.
|
|
@@ -628,8 +655,13 @@ export declare function caseOutlook(layer: EnduranceLayer, caseCuts: CaseCuts, o
|
|
|
628
655
|
* - `endurance-season`: the season of a converter has a day that is not `MM-DD`. Or its delay or its shelf life is not more than 0.
|
|
629
656
|
* Or its count of sowings is not a finite number of 0 or more. Or the converter with a season gives a need, or it has
|
|
630
657
|
* `perDay` or `devices`. Since 0.8.16 (M2-grow).
|
|
658
|
+
* - `endurance-monthly`: the shares `monthly` of a converter are not 12 numbers from 0 to 1. Or the converter has
|
|
659
|
+
* `monthly` and no `perDay`, or a season. Or two converters of one device have different shares. Since 0.8.20 (M2-solar).
|
|
660
|
+
* - `endurance-capacity`: the capacity of a store is not a finite number more than 0, or it is less than the amount.
|
|
661
|
+
* Or a store with a capacity has a due date. Or a resource has a store with a capacity and a store with no capacity.
|
|
662
|
+
* Since 0.8.21 (M2-solar-charge).
|
|
631
663
|
*/
|
|
632
|
-
export declare const ENDURANCE_CODES: readonly ["endurance-twice", "endurance-level-unknown", "endurance-resource-unknown", "endurance-part-unknown", "endurance-range", "endurance-date", "endurance-converter-empty", "endurance-curve", "endurance-bound", "endurance-prior-case", "endurance-cycle", "endurance-devices", "endurance-device-mix", "endurance-no-way", "endurance-cut-no-curve", "endurance-season"];
|
|
664
|
+
export declare const ENDURANCE_CODES: readonly ["endurance-twice", "endurance-level-unknown", "endurance-resource-unknown", "endurance-part-unknown", "endurance-range", "endurance-date", "endurance-converter-empty", "endurance-curve", "endurance-bound", "endurance-prior-case", "endurance-cycle", "endurance-devices", "endurance-device-mix", "endurance-no-way", "endurance-cut-no-curve", "endurance-season", "endurance-monthly", "endurance-capacity"];
|
|
633
665
|
/** A code of `ENDURANCE_CODES`. */
|
|
634
666
|
export type EnduranceCode = (typeof ENDURANCE_CODES)[number];
|
|
635
667
|
/** A fault of the gate of an endurance layer. */
|
package/build/index.d.ts.map
CHANGED
|
@@ -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":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["CutBound"],"sources":["../src/converter.ts","../src/endurance.ts","../src/joint.ts","../src/best.ts","../src/shortfall.ts","../src/check.ts","../src/join.ts","../src/sample.ts"],"mappings":";;;;;;wBAegB,SAAS,WAAW;;iBCJnB;;WAEN,IAAI;;WAEJ,QAAQ;;WAER;;;;;;WAMA,QAAQ;;;;;;WAMR;;;qBAIE;;;;;wBAMG,YAAY,UAAU,UAAU,SAAS,KAAK,iCAAiC;;wBAiB/E,QAAQ,OAAO,SAAS;;;;;wBASxB,WAAW,OAAO,SAAS;;wBAc3B,cAAc,YAAY,SAAS,aAAa;;wBAOhD,QAAQ,QAAQ,wCAAwC,aAAa;;;;;;;wBAarE,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;;;;;;;;wBAmMxB,QAAQ,QAAQ,KAAK,wBAAwB,OAAO,SAAS;;iBAkG5D;WACN;WACA;WACA;WACA;;;iBAIM;;WAEN,OAAO;WACP,U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,OAAO,gBAAgB,QAAQ,QAAQ;;wBAwNtD,kBAAkB,iBAAiB;;;;;;;;;;;;;;;;;wBCnSnC,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 { A as
|
|
2
|
+
import { A as deviceUse, C as fixStops, D as storeCapacities, E as seasonPlan, F as addTo, I as dense, L as exact, M as fewestRow, N as reachOf, O as Program, P as valueAt, R as isSource, S as firstStop, T as seasonJoint, _ as seasonSupply, a as hasEnduranceError, b as storeAmounts, c as caseStopped, d as giftNeed, f as giftResource, g as monthlyShares, h as monthOf, i as curveFault, j as drawBlock, k as caseParts, l as drawDemand, m as monthEdges, n as ENDURANCE_CODES, o as SEASON_HORIZON_DAYS, p as hasSeason, r as checkEndurance, s as caseDraws, t as joinEndurance, u as enduranceOf, v as shareOf, w as seasonBest, x as fewestOpen, y as sowDays } from "./join-CM_zwI78.js";
|
|
3
3
|
import { DEFAULT_MAX_SETS, STACK_SCHEMA, dateOfDay, dayNumber, 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";
|
|
@@ -64,7 +64,7 @@ function jointDays(layer, caseCuts, options, needs) {
|
|
|
64
64
|
const parts = caseParts(layer, stoppedParts, stock, planned);
|
|
65
65
|
if (supply !== void 0) {
|
|
66
66
|
const devices = new Map([...deviceUse([...parts.cooks, ...parts.makers].map((converter) => [converter, 0])).limits].map(([key, limit]) => [key, limit.devices]));
|
|
67
|
-
const { atHorizon, ...joint } = seasonJoint(seasonPlan(supply, parts, caseCuts, plan, devices), new Set(layer.stores.map((store) => store.resource)));
|
|
67
|
+
const { atHorizon, ...joint } = seasonJoint(seasonPlan(supply, parts, caseCuts, plan, devices, storeCapacities(layer, stoppedParts)), new Set(layer.stores.map((store) => store.resource)));
|
|
68
68
|
return {
|
|
69
69
|
...base,
|
|
70
70
|
...joint,
|
|
@@ -305,7 +305,7 @@ function bestSeason(layer, caseCuts, options, stoppedParts) {
|
|
|
305
305
|
const draws = caseDraws(layer, caseCuts, stoppedParts);
|
|
306
306
|
const parts = caseParts(layer, stoppedParts, supply.stock, new Set(draws.map((draw) => draw.need)));
|
|
307
307
|
const devices = new Map([...deviceUse([...parts.cooks, ...parts.makers].map((converter) => [converter, 0])).limits].map(([key, limit]) => [key, limit.devices]));
|
|
308
|
-
const plan = seasonPlan(supply, parts, caseCuts, draws, devices);
|
|
308
|
+
const plan = seasonPlan(supply, parts, caseCuts, draws, devices, storeCapacities(layer, stoppedParts));
|
|
309
309
|
const harvests = supply.harvests.length === 0 ? {} : { harvests: supply.harvests };
|
|
310
310
|
if (draws.length === 0) return {
|
|
311
311
|
case: caseCuts.case,
|
|
@@ -970,7 +970,7 @@ function caseShortfall(layer, caseCuts, endurance, options = {}) {
|
|
|
970
970
|
/** The shares, with the default first. */
|
|
971
971
|
const SHARES = ["take", "best"];
|
|
972
972
|
/** This function gives the share of the options. The default is `take`. */
|
|
973
|
-
function shareOf(options) {
|
|
973
|
+
function shareOf$1(options) {
|
|
974
974
|
const share = options.share ?? "take";
|
|
975
975
|
if (!SHARES.includes(share)) throw new RangeError(`The share ${String(options.share)} is not ${SHARES.join(" or ")}.`);
|
|
976
976
|
return share;
|
|
@@ -1001,7 +1001,7 @@ const YEAR_STARTS = 12;
|
|
|
1001
1001
|
function yearShortfall(layer, place, options) {
|
|
1002
1002
|
horizonOf(options);
|
|
1003
1003
|
budgetsOf(options);
|
|
1004
|
-
const share = shareOf(options);
|
|
1004
|
+
const share = shareOf$1(options);
|
|
1005
1005
|
const dates = startDates(layer, options);
|
|
1006
1006
|
const levels = zeroLevels(layer);
|
|
1007
1007
|
const independent = zeroLevels(layer);
|
|
@@ -1142,7 +1142,7 @@ function addDays(days, shortfall, count) {
|
|
|
1142
1142
|
function caseOutlook(layer, caseCuts, options) {
|
|
1143
1143
|
const horizon = horizonOf(options);
|
|
1144
1144
|
budgetsOf(options);
|
|
1145
|
-
const share = shareOf(options);
|
|
1145
|
+
const share = shareOf$1(options);
|
|
1146
1146
|
const endurance = shareEndurance(layer, caseCuts, options, share);
|
|
1147
1147
|
const stopped = caseDraws(layer, caseCuts, caseStopped(caseCuts, options));
|
|
1148
1148
|
const stoppedNeeds = new Set(stopped.map((draw) => draw.need));
|
|
@@ -1442,6 +1442,6 @@ const SAMPLE_ENDURANCE = {
|
|
|
1442
1442
|
asOf: "2025-12-01"
|
|
1443
1443
|
}]
|
|
1444
1444
|
};
|
|
1445
|
-
export { ENDURANCE_CODES, ENDURANCE_SCHEMA, INDEPENDENT_MAX_WORK, INDEPENDENT_TOLERANCE, MINIMAL_STOP_CUTS, SAMPLE_ENDURANCE, SAMPLE_ENDURANCE_STACK, SEASON_HORIZON_DAYS, SHARES, YEAR_STARTS, bestEndurance, caseDraws, caseOutlook, caseShortfall, caseStopped, checkEndurance, curveFault, drawDemand, enduranceOf, eventStop, giftNeed, giftResource, hasEnduranceError, hasSeason, heldTail, independentStop, joinEndurance, jointDays, longestStop, minimalStops, seasonSupply, sowDays, stopCurves, storeAmounts, survivalAt, survivalQuantile, tailDays, upperStop, yearChance, yearRate, yearShortfall };
|
|
1445
|
+
export { ENDURANCE_CODES, ENDURANCE_SCHEMA, INDEPENDENT_MAX_WORK, INDEPENDENT_TOLERANCE, MINIMAL_STOP_CUTS, SAMPLE_ENDURANCE, SAMPLE_ENDURANCE_STACK, SEASON_HORIZON_DAYS, SHARES, YEAR_STARTS, bestEndurance, caseDraws, caseOutlook, caseShortfall, caseStopped, checkEndurance, curveFault, drawDemand, enduranceOf, eventStop, giftNeed, giftResource, hasEnduranceError, hasSeason, heldTail, independentStop, isSource, joinEndurance, jointDays, longestStop, minimalStops, monthEdges, monthOf, monthlyShares, seasonSupply, shareOf, sowDays, stopCurves, storeAmounts, survivalAt, survivalQuantile, tailDays, upperStop, yearChance, yearRate, yearShortfall };
|
|
1446
1446
|
|
|
1447
1447
|
//# sourceMappingURL=index.js.map
|