Package-level declarations

Types

Link copied to clipboard
class BackorderCostCalculator @JvmOverloads constructor(parent: ModelElement, backlog: BackLogPolicyAbstract, params: CostParams, name: String? = null) : ModelElement, CostCalculator

Per-IHP-backlog cost calculator: observes one BackLogPolicyAbstract and populates the continuous-rate CostLine.Backorder line.

Link copied to clipboard
class BuilderCostCalculator @JvmOverloads constructor(parent: ModelElement, builder: DemandLoadBuilder, ownerTier: NodeTier, params: CostParams, name: String? = null) : ModelElement, CostCalculator

Per-builder cost calculator: observes one DemandLoadBuilder and produces the CostLine.ShipmentBuilderHolding line item, summing per-(builder, item) on-hand carrying cost.

Link copied to clipboard

Observables from a DemandLoadBuilder. Drives the shipment-builder holding-cost line per-(node, item) when the builder was constructed with itemTypes non-empty (the MultiEchelonNetwork wires this automatically).

Link copied to clipboard
data class BuilderCostObservablesData(val builder: DemandLoadBuilder, val perItemUnitsOnHand: Map<ItemType, Double>, val totalLoadsShipped: Double) : BuilderCostObservables

Concrete builder-observables snapshot. perItemUnitsOnHand captures the per-item TW averages for every item the builder is tracking; unitsOnHandAvg looks up by item (returning null for untracked items).

Link copied to clipboard
interface CostCalculator

A cost calculator observes one source ModelElement and produces one or more line-item Responses populated at the source's REPLICATION_ENDED notification.

Link copied to clipboard
interface CostFormulation

A cost formulation is a container of CostCalculators plus the rollup Responses (per line, per tier, grand total) that summarize them at every replication's end.

Link copied to clipboard
sealed class CostLine(val displayName: String)

Identifier for a single line item produced by a CostFormulation. Used as a key in CostCalculator.lineResponses and as the index into CostFormulation.byLineResponse for per-line rollup queries.

Link copied to clipboard
data class CostParams(val carryingRate: Double = 0.1, val backorderRate: Double = 0.0, val orderingCost: Double = 5.5, val unloadingCost: Double = 30.0, val loadingCost: Double = 40.0, val shippingCost: Double = 15.0, val stockoutCost: Double = 0.0, val lostSaleCost: Double = 0.0, val unitShortageCost: Double = 0.0, val esLoadingCost: Double = 40.0)

Parameter bundle for a DefaultMultiEchelonCostFormulation. All rate values are denominated in 1 / (modeler-chosen time unit) — the framework performs no time-unit conversion and makes no presumption about what the modeler's rate basis is. The emitted cost-line Responses are therefore reported in the modeler's chosen time unit (a carryingRate of 0.10/year produces a holding cost in $/year; 0.10/day produces it in $/day).

Link copied to clipboard
open class DefaultMultiEchelonCostFormulation @JvmOverloads constructor(network: MultiEchelonNetwork, val params: CostParams = CostParams(), name: String? = null, paramsResolver: (NetworkNodeIfc?) -> CostParams? = null) : ModelElement, CostFormulation

Standard cost formulation for a MultiEchelonNetwork. Walks the network at construction time and instantiates one CostCalculator per source kind: per inventory, per backlog, per outbound edge (inbound and outbound), per load builder, plus one for the ES.

Link copied to clipboard

Per-edge observables from a carrier. An edge is identified by its supplier (the network node owning the carrier or, for the ES, the network itself) and its customer (the DemandSenderIfc destination of shipments on this edge).

Link copied to clipboard
data class EdgeCostObservablesData(val supplier: NetworkNodeIfc?, val customer: DemandSenderIfc, val shipmentCount: Double, val totalLoadWeight: Double, val totalLoadCube: Double) : EdgeCostObservables
Link copied to clipboard
class EdgeInboundCostCalculator @JvmOverloads constructor(parent: ModelElement, carrier: TimeBasedDemandCarrier, destination: DemandSenderIfc, destinationTier: NodeTier, params: CostParams, name: String? = null) : ModelElement, CostCalculator

Per-edge inbound cost calculator: observes the supplier's outbound carrier and produces the CostLine.Unloading line item for one specific destination edge.

Link copied to clipboard
class EdgeOutboundCostCalculator @JvmOverloads constructor(parent: ModelElement, carrier: TimeBasedDemandCarrier, destination: DemandSenderIfc, supplierTier: NodeTier, params: CostParams, name: String? = null) : ModelElement, CostCalculator

Per-edge outbound cost calculator: observes one carrier (the outbound carrier of an IHP or CD) and produces the CostLine.Loading and CostLine.Shipping line items for one specific destination edge.

Link copied to clipboard
class ESCostCalculator @JvmOverloads constructor(parent: ModelElement, esCarrier: TimeBasedDemandCarrier, destinations: List<DemandSenderIfc>, params: CostParams, name: String? = null) : ModelElement, CostCalculator

External-supplier loading-cost calculator: observes the network's ES outbound carrier and produces the CostLine.ESLoading line item, priced at CostParams.esLoadingCost per shipment.

Link copied to clipboard

External-supplier-tier observables. Single field for now; structured as an interface so future ES-only metrics (e.g., supplier-availability statistics) can be added without changing cost-calculator signatures.

Link copied to clipboard
data class ESCostObservablesData(val totalShipmentCount: Double) : ESCostObservables
Link copied to clipboard
class InventoryCostCalculator @JvmOverloads constructor(parent: ModelElement, inv: Inventory, params: CostParams, name: String? = null) : ModelElement, CostCalculator

Per-(IHP, item) cost calculator: observes one Inventory and populates six line-item Responses at the inventory's REPLICATION_ENDED notification. Source-owned data drives every line; the calculator performs pure multiplication on stable within-replication statistics with no framework-side time-unit conversion (see docs/supply-chain-cost-redesign.md §2 "Note on warmup handling").

Link copied to clipboard

Typed snapshot contracts for cost calculators. Each interface represents the data a cost calculator's ModelElementObserver.replicationEnded callback needs from one source ModelElement, captured at the moment that source's within-replication statistics are stable (immediately after the source's own replicationEnded() runs).

Link copied to clipboard
data class InventoryCostObservablesData(val item: ItemType, val avgOnHand: Double, val avgOnOrder: Double, val avgBacklog: Double, val orderCount: Double, val totalUnitsOrdered: Double, val stockoutCount: Double, val lostSaleCount: Double, val totalUnitsShort: Double) : InventoryCostObservables

Concrete snapshot of an Inventory's cost observables at the moment of construction. Snapshot semantics: every field is read eagerly so the object is immutable and safe to retain after the replication ends.

Link copied to clipboard
class NetworkEdgeInboundCostCalculator @JvmOverloads constructor(parent: ModelElement, networkCarrier: TimeBasedNetworkDemandCarrier, filler: DemandFillerIfc, destination: DemandSenderIfc, destinationTier: NodeTier, params: CostParams, name: String? = null) : ModelElement, CostCalculator

NetworkTimeBased-strategy variant of EdgeInboundCostCalculator: observes a shared TimeBasedNetworkDemandCarrier and produces CostLine.Unloading for one specific (filler, destination) edge.

Link copied to clipboard
class NetworkEdgeOutboundCostCalculator @JvmOverloads constructor(parent: ModelElement, networkCarrier: TimeBasedNetworkDemandCarrier, filler: DemandFillerIfc, destination: DemandSenderIfc, supplierTier: NodeTier, params: CostParams, name: String? = null) : ModelElement, CostCalculator

NetworkTimeBased-strategy variant of EdgeOutboundCostCalculator: observes a shared TimeBasedNetworkDemandCarrier and produces CostLine.Loading + CostLine.Shipping for one specific (filler, destination) edge.

Link copied to clipboard
class NetworkESCostCalculator @JvmOverloads constructor(parent: ModelElement, networkCarrier: TimeBasedNetworkDemandCarrier, esFiller: DemandFillerIfc, destinations: List<DemandSenderIfc>, params: CostParams, name: String? = null) : ModelElement, CostCalculator

NetworkTimeBased-strategy variant of ESCostCalculator: observes a shared TimeBasedNetworkDemandCarrier and produces CostLine.ESLoading, summing shipments across every ES → node edge.

Link copied to clipboard
sealed class NodeTier(val displayName: String)

Identifier for a tier of the multi-echelon network. Used as the index into CostFormulation.byTierResponse for per-tier rollup queries. Each line-item Response a calculator produces is attributable to exactly one tier, determined by the source kind.

Link copied to clipboard
open class PerNodeIHPCostFormulation @JvmOverloads constructor(network: MultiEchelonNetwork, val defaultParams: CostParams = CostParams(), val overrides: Map<String, CostParams> = emptyMap(), name: String? = null) : DefaultMultiEchelonCostFormulation

A DefaultMultiEchelonCostFormulation whose cost rates vary by node. Every calculator uses the CostParams override registered for its owning node (keyed by node name), falling back to defaultParams for nodes without an override and for the external supplier's own outbound.

Functions

Link copied to clipboard

Capture an InventoryCostObservables snapshot of this inventory's current within-replication state. Intended to be called from a cost calculator's ModelElementObserver.replicationEnded(this) callback, when KSL guarantees the within-replication statistics are stable for the post-warmup window.

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.