@mark1russell7/stack-endurance 0.8.16 → 0.8.18
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 +8 -3
- package/build/add-on.d.ts +1 -1
- package/build/add-on.js +1 -1
- package/build/index.d.ts +40 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +478 -7
- package/build/index.js.map +1 -1
- package/build/{join-D-KCebAf.js → join-D4KzcbbY.js} +134 -41
- package/build/join-D4KzcbbY.js.map +1 -0
- package/build/{layer-CNAZnao7.d.ts → layer-BCQy77mt.d.ts} +21 -4
- package/build/layer-BCQy77mt.d.ts.map +1 -0
- package/build/layer-a3Fr70Uh.js.map +1 -1
- package/build/schema.d.ts +1 -1
- package/build/schema.js +2 -1
- package/build/schema.js.map +1 -1
- package/package.json +1 -1
- package/build/join-D-KCebAf.js.map +0 -1
- package/build/layer-CNAZnao7.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -43,12 +43,17 @@ With a base stack, a cut also stops each part that cannot work without the cut p
|
|
|
43
43
|
A converter can have a `season`. It has a window of sow days in each year (`from` and `to` as `MM-DD`). It also has a delay to the harvest (`delayDays`) and the runs of each sowing (`runs`). For example, a bed of potatoes takes seed, and gives potatoes 100 days after its sow day. Since 0.8.16.
|
|
44
44
|
|
|
45
45
|
- The sow day of a year is the first day of its window on the start of the event or after it. A window can go across the end of the year.
|
|
46
|
-
- Each sowing takes the inputs of its runs from the stores
|
|
47
|
-
- The harvest adds the runs times the gift to the stock of its resource on its day.
|
|
46
|
+
- Each sowing takes the inputs of its runs before the first draw. It takes from the stores, and from each harvest that is ready on its sow day. Thus a sowing of year 2 can take seed from the harvest of year 1 (since 0.8.17). When the seed is short, the sowing has fewer runs.
|
|
47
|
+
- The harvest adds the runs times the gift to the stock of its resource on its day. With `shelfDays`, the rest of the harvest spoils `shelfDays` after its day (since 0.8.17). The field `spoiled` of a draw gives the amount that spoils before the draw takes it.
|
|
48
|
+
- Each sowing and each draw takes first expiring first out: first the harvest that spoils first, then the oldest lot. A store has no spoil day. With no `shelfDays`, a draw thus takes the stores first, then each harvest in the order of its day.
|
|
49
|
+
- A converter with a season is not a maker of a take, and it has no `perDay` or `devices`.
|
|
48
50
|
- The query reads the sowings up to the horizon (`horizon` of `enduranceOf`, default `SEASON_HORIZON_DAYS` = 730). `start` moves the event in the year, and the stores stay the stores at `at`.
|
|
49
51
|
- `days` is the first stop of a draw. `again` gives the spans after it in which a harvest feeds the draw. `harvests` lists each sowing with its runs and its amount.
|
|
50
52
|
- The shortfall leaves out the fed spans (`heldTail`). For a layer with a season, `yearShortfall` gives the mean over `starts` start dates in the year (default `YEAR_STARTS` = 12). An event can start on any day.
|
|
51
|
-
- `bestEndurance` and `jointDays`
|
|
53
|
+
- Since 0.8.18, `bestEndurance` and `jointDays` read the harvests. The days go in segments that end at each harvest day, at each spoil day and at the horizon. A segment takes only the lots that are ready and not spoiled in all of it.
|
|
54
|
+
- In `bestEndurance`, `days` is the first stop of each draw, with the same share by level and leximin. A last program gives the most fed days after the stops to each level (`again`). Two draws that use one limited device after their stops take turns on it. This is the safe side.
|
|
55
|
+
- `jointDays` gives the largest common first stop. With `atHorizon`, the plan holds the horizon.
|
|
56
|
+
- `enduranceOf` still refuses a draw with a shared device and a season (M2-grow-share-sweep).
|
|
52
57
|
|
|
53
58
|
## The rule of shortfall
|
|
54
59
|
|
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-D4KzcbbY.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,4 +1,4 @@
|
|
|
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-BCQy77mt.js";
|
|
2
2
|
import { CutBound as CutBound$1, Fault, LayerParse, LayerPiece, PathOptions, Stack, curveFault, survivalAt } from "@mark1russell7/system-stack";
|
|
3
3
|
/** The options of the queries of a case. */
|
|
4
4
|
export interface CaseOptions {
|
|
@@ -53,6 +53,28 @@ export declare function giftResource(converter: Converter): string | undefined;
|
|
|
53
53
|
* @throws RangeError when the start is not `YYYY-MM-DD`, or the horizon is not more than 0.
|
|
54
54
|
*/
|
|
55
55
|
export declare function sowDays(season: Pick<Season, "from" | "to">, start: IsoDate, horizon: number): number[];
|
|
56
|
+
/** A lot of a harvest that the draws can take: its resource, its day, its spoil day (Infinity for none) and its amount. */
|
|
57
|
+
export interface HarvestLot {
|
|
58
|
+
readonly resource: string;
|
|
59
|
+
readonly day: number;
|
|
60
|
+
readonly spoils: number;
|
|
61
|
+
readonly amount: number;
|
|
62
|
+
}
|
|
63
|
+
/** The supply of a case with a season: the stocks after the sowings, the sowings, and the lots of the harvests before the horizon. */
|
|
64
|
+
export interface SeasonSupply {
|
|
65
|
+
/** The stock of each resource of the stores at `at`, less the inputs of the sowings. */
|
|
66
|
+
readonly stock: Map<string, number>;
|
|
67
|
+
readonly harvests: Harvest[];
|
|
68
|
+
/** The rest of each harvest after the later sowings, in the order of its day. Each lot has a day before the horizon and an amount more than 0. */
|
|
69
|
+
readonly lots: readonly HarvestLot[];
|
|
70
|
+
/** The horizon in days (`horizon` of the options, default `SEASON_HORIZON_DAYS`). */
|
|
71
|
+
readonly horizon: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* This function gives the supply of a case with a season (M2-grow-share). `enduranceOf`, `bestEndurance` and `jointDays`
|
|
75
|
+
* 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
|
+
*/
|
|
77
|
+
export declare function seasonSupply(layer: EnduranceLayer, stoppedParts: ReadonlySet<string>, options: CaseOptions): SeasonSupply;
|
|
56
78
|
/** This function tells if a layer has a converter with a season that can run in a case. */
|
|
57
79
|
export declare function hasSeason(layer: EnduranceLayer, stoppedParts: ReadonlySet<string>): boolean;
|
|
58
80
|
/**
|
|
@@ -123,6 +145,8 @@ export interface JointDays {
|
|
|
123
145
|
* The list is empty when `days` is `Infinity` or 0. Else it has each converter of the plan with a limit of 0.
|
|
124
146
|
*/
|
|
125
147
|
readonly capped: readonly string[];
|
|
148
|
+
/** True when a layer with a season holds the plan to the horizon (M2-grow-share). `days` is then the horizon. */
|
|
149
|
+
readonly atHorizon?: true | undefined;
|
|
126
150
|
}
|
|
127
151
|
/**
|
|
128
152
|
* This function gives the joint days of a set of draws. These are the largest count of days `d` at which each draw holds `d` days.
|
|
@@ -145,12 +169,15 @@ export interface JointDays {
|
|
|
145
169
|
*
|
|
146
170
|
* The program uses exact rationals, so the result has no error of the method. Only the change back to a number rounds.
|
|
147
171
|
*
|
|
172
|
+
* With a converter with a season, `days` is the largest common first stop of the plan (M2-grow-share). The sowings, the lots and
|
|
173
|
+
* the segments are those of `bestEndurance`. The plan holds the horizon at most (default `SEASON_HORIZON_DAYS`), with `atHorizon`.
|
|
174
|
+
*
|
|
148
175
|
* @param layer - The endurance layer
|
|
149
176
|
* @param caseCuts - The case
|
|
150
177
|
* @param options - The date, and the stack or the parts that are also down
|
|
151
178
|
* @param needs - The codes of the needs of the draws of the set
|
|
152
179
|
* @returns The joint days, the takes of each draw, the binding resources and the runs of each converter
|
|
153
|
-
* @throws {RangeError} A code of `needs` is not the need of a draw of the layer, or a date is not `YYYY-MM-DD`. Or a
|
|
180
|
+
* @throws {RangeError} A code of `needs` is not the need of a draw of the layer, or a date is not `YYYY-MM-DD`. Or the horizon of a layer with a season is not more than 0.
|
|
154
181
|
*/
|
|
155
182
|
export declare function jointDays(layer: EnduranceLayer, caseCuts: CaseCuts, options: CaseOptions, needs: readonly string[]): JointDays;
|
|
156
183
|
/** The options of `bestEndurance`: the options of a case, and a horizon. */
|
|
@@ -189,11 +216,20 @@ export interface BestOptions extends CaseOptions {
|
|
|
189
216
|
* The programs use exact rationals, so the result has no error of the method. Only the change back to a number rounds.
|
|
190
217
|
* The fewest days of the first level are the joint days (`jointDays`) of the draws of that level.
|
|
191
218
|
*
|
|
219
|
+
* A layer with a converter with a season has the programs of a season (M2-grow-share):
|
|
220
|
+
* - The sowings take their inputs before the draws, as in `enduranceOf`. Each harvest is a lot from its day, and its rest spoils on its spoil day.
|
|
221
|
+
* - The days go in segments that end at each harvest day, at each spoil day and at the horizon (default `SEASON_HORIZON_DAYS`). A segment takes only
|
|
222
|
+
* the lots that are ready and not spoiled in all of it.
|
|
223
|
+
* - `days` is the first stop of each draw, with the same leximin share. The days to a stop are not linear, so each step tries the segments in order.
|
|
224
|
+
* - After the stops, a last program gives the most fed days to each level in order. `again` gives the spans in which a later harvest feeds a draw.
|
|
225
|
+
* In such a span, the runs share the device-days of the whole segment that the stops leave.
|
|
226
|
+
* - The result has the field `harvests`. It has no field `spoiled`: the share of a lot between the draws has no spoil of one draw.
|
|
227
|
+
*
|
|
192
228
|
* @param layer - The endurance layer
|
|
193
229
|
* @param caseCuts - The case
|
|
194
230
|
* @param options - The date, the stack or the parts that are also down, and the horizon
|
|
195
231
|
* @returns The endurance of each draw whose supply stops
|
|
196
|
-
* @throws {RangeError} A date is not `YYYY-MM-DD`, or the horizon is not more than 0.
|
|
232
|
+
* @throws {RangeError} A date is not `YYYY-MM-DD`, or the horizon is not more than 0.
|
|
197
233
|
*/
|
|
198
234
|
export declare function bestEndurance(layer: EnduranceLayer, caseCuts: CaseCuts, options: BestOptions): Endurance;
|
|
199
235
|
/**
|
|
@@ -588,7 +624,7 @@ export declare function caseOutlook(layer: EnduranceLayer, caseCuts: CaseCuts, o
|
|
|
588
624
|
* converter with no limit uses no device-days, so its runs do not reduce the runs of the limited converter.
|
|
589
625
|
* - `endurance-no-way` (warning): a draw has no direct use and no converter, so it holds 0 days when its supply stops.
|
|
590
626
|
* - `endurance-cut-no-curve` (warning): a cut has no curve of its duration. The draws whose stop it can be part of are no read in the shortfall.
|
|
591
|
-
* - `endurance-season`: the season of a converter has a day that is not `MM-DD
|
|
627
|
+
* - `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.
|
|
592
628
|
* 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
|
|
593
629
|
* `perDay` or `devices`. Since 0.8.16 (M2-grow).
|
|
594
630
|
*/
|
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":";;;iBAUiB;;WAEN,IAAI;;WAEJ,QAAQ;;WAER;;;;;WAKA,QAAQ;;;;;;WAMR;;;qBAIE;;;;;wBAMG,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;;;;;;;;wBAyKxB,QAAQ,QAAQ,KAAK,wBAAwB,OAAO,SAAS;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","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