Demand Load Builder
Holds incoming demands in a queue and packages them into SupplyChainModel.DemandLoads. Automatic load formation is driven by loadFormingOption; the ALWAYS default forms a single-demand load per arriving demand.
Custom strategies hook in via loadFormingRule (replaces the built-in option) and loadFormedListener (fires after each automatically formed load).
Optional per-item on-hand tracking: when itemTypes is non-empty, the builder creates one TWResponse per item type and tracks the time-weighted average number of units of that item sitting in the demand queue. Read each via unitsOnHandResponse; consumed by the network cost model to compute shipmentBuildingHoldingCost. When itemTypes is empty (the default), no per-item TWResponses are created and the cost line stays at 0 — opt-in.
RULE-mode caveat: a custom DemandLoadFormingRuleIfc that removes demands from demandQueue directly (rather than via formLoadByCount / formLoadByWeight / formLoadByCube / formLoadAlways) will not decrement the per-item TWResponses, leaving them stale. RULE-mode users who care about shipmentBuildingHoldingCost accounting must use the built-in form helpers or maintain their own stats. Documented limitation, not a guard.
Parameters
model that owns the created SupplyChainModel.DemandLoads
parent model element; defaults to supplyChainModel
optional model-element name
item types this builder may carry; required for per-item on-hand TWResponse tracking. Pre-create them at construction time because KSL forbids adding stats elements once the simulation is running.
See sc.transportlayer.DemandLoadBuilder
Constructors
Types
Properties
Read-only view of the waiting-demand queue.
Optional fire-on-form callback.
Optional user-supplied rule. Setting a non-null rule switches loadFormingOption to LoadFormingOption.RULE; setting null reverts to LoadFormingOption.NONE (Java parity).
Read-only view of the formed-load queue.
Read-only view of the loads-formed Counter.
Read-only view of total cube waiting in the demand queue.
Read-only view of total weight waiting in the demand queue.
Item types this builder is tracking on-hand units for.
Functions
Form a load using the current loadFormingOption.
Form a load using the supplied option.
Form a load from the first numDemands entries in the demand queue, when at least that many are present.
Form a load by accumulating demands whose total cube stays within [minCube, maxCube].
Form a load by accumulating demands whose total weight stays within [minWeight, maxWeight].
Accept demand into the waiting queue and try to form a load (unless loadFormingOption is LoadFormingOption.NONE).
Update the cube limits used by LoadFormingOption.CUBE.
Discipline applied to demandQueue at the start of each replication.
Discipline applied to loadQueue at the start of each replication.
Update the weight limits used by LoadFormingOption.WEIGHT.
Capture a BuilderCostObservables snapshot from this builder. Loops over DemandLoadBuilder.trackedItemTypes and reads each item's TW-average units-on-hand; returns an empty per-item map when the builder was constructed without an itemTypes list.