DecisionElementBuilder

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Which runs first when an epoch coincides with this element's warm-up (§4.6.4). build() checks myEpochPriority against the element's warmUpPriority and rejects a combination that contradicts what is declared here.

Link copied to clipboard

Functions

Link copied to clipboard
fun atMost(vararg levers: LeverRef, total: Double)
fun atMost(vararg levers: LeverRef, envelope: Double, total: () -> Double)
Link copied to clipboard
fun batchLever(vararg levers: LeverRef, applyAll: (DoubleArray) -> Unit)

§4.4.5 — declare that a group of already-declared levers must be written as one act.

Link copied to clipboard
fun budget(vararg levers: LeverRef, total: Double)

fun budget(vararg levers: LeverRef, envelope: Double, total: () -> Double)

A budget that is itself a state (§4.4.6.1) — "ship no more than is on hand". The descriptor records envelope as the declared total and flags the constraint state-dependent, because a serialized descriptor cannot carry a lambda.

Link copied to clipboard

Where this element's transitions go (§4.8.2). The factory is called once per experiment, at beforeExperiment(), with the provenance a row needs to be written without a live Model — which is what lets a sink be tested standalone or write from another thread. The sink it returns is opened and closed for you, per experiment.

Link copied to clipboard
fun <T : ModelElement> lever(owner: T, levels: List<String>, neutral: Neutral<T>, alias: String? = null, unit: String? = null, bounds: T.() -> ClosedFloatingPointRange<Double>? = null, set: T.(Double) -> Unit): LeverRef
fun <T : ModelElement> lever(owner: T, limits: ClosedFloatingPointRange<Double>, neutral: Neutral<T>, alias: String? = null, unit: String? = null, bounds: T.() -> ClosedFloatingPointRange<Double>? = null, set: T.(Double) -> Unit): LeverRef
fun <T : ModelElement> lever(owner: T, limits: IntRange, neutral: Neutral<T>, alias: String? = null, unit: String? = null, bounds: T.() -> ClosedFloatingPointRange<Double>? = null, set: T.(Double) -> Unit): LeverRef
Link copied to clipboard
fun maxEpochs(n: Int)

A cap on decisions per episode. Must be positive: maxEpochs(0) ends the episode at the first epoch before any decision is taken, so the run completes, reports an estimand of zero, and contains no decisions — with nothing to say it went wrong.

Link copied to clipboard
fun observe(source: ResponseIfc, unit: String? = null)
fun observe(name: String, unit: String? = null, source: GetValueIfc)
fun observe(source: ResponseIfc, alias: String, unit: String? = null)
Link copied to clipboard
fun reward(source: CounterCIfc, rate: Double, sense: RewardSense = RewardSense.COST, alias: String? = null, kind: RewardKind? = null): RewardRef

As above, for a Counter — whose accumulation is its value (§4.2.5).

fun reward(source: ResponseCIfc, rate: Double, sense: RewardSense = RewardSense.COST, alias: String? = null, kind: RewardKind? = null): RewardRef

Declare a reward term: a rate times an accumulated quantity, differenced between epochs (§4.2.5).

Link copied to clipboard
fun terminalWhen(condition: () -> Boolean)