BuilderCostCalculator

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

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

Formula:

Σ_(items the builder is tracking) avgUnitsOnHand(item) × item.unitCost × carryingRate

avgUnitsOnHand(item) is sourced from the builder's per-item on-hand TWResponse (created at builder construction when itemTypes is non-empty — Phase-3 follow-up #3 work). Builders constructed without itemTypes (the default) have an empty trackedItemTypes set and emit 0.0.

Tier attribution is supplied at construction time because a builder lives on a carrier, which lives on a network node, which could be an IHP or a CD. The formulation's buildCalculators walk knows the owning node and passes the matching tier.

Parameters

parent

the ModelElement parent

builder

the load builder this calculator observes

ownerTier

tier of the network node that owns the builder's carrier

params

cost-rate parameters

Constructors

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

Properties

Link copied to clipboard
open override val lineResponses: Map<CostLine, ResponseCIfc>

The line-item Responses this calculator produces, keyed by CostLine. A calculator may produce a Response for every line its source can express; values for unproduced lines are absent from the map rather than zero.

Link copied to clipboard
open override val source: ModelElement

The single source ModelElement this calculator observes.

Link copied to clipboard
open override val tier: NodeTier

Tier this calculator's source belongs to. Used by CostFormulation.byTierResponse to partition rollups across IHP / CD / ES. A calculator that attributes to multiple tiers (rare) returns null and is excluded from per-tier rollups.