TransitionRecord

class TransitionRecord(val elementName: String, val replicationId: Int, val epochIndex: Int, val time: Double, val tau: Double, val state: DoubleArray, val action: DoubleArray, val proposedAction: DoubleArray? = null, val leverUnavailable: BooleanArray? = null, val reward: Double, val successorState: DoubleArray, val terminated: Boolean, val truncated: Boolean, val source: TerminationSource? = null, val reason: String = "", val provenance: EpochProvenance = EpochProvenance.IMMEDIATE)(source)

§4.8.3. The atom of recorded experience.

It lives here, with the element that PRODUCES it, rather than in ksl.modeling.decision.capture, which consumes it. ManagedPolicyIfc.onTransition takes one, and a policy interface cannot depend on the capture package without inverting the layering of E.1.

action is what was written to the levers, which is not always what the rule asked for. Under CLAMP_THEN_REJECT a request outside a lever's bounds is repaired before it is applied, and a lever whose feasible set is empty takes its declared neutral (§4.4.6.3). In both cases the rule's own vector is kept in proposedAction, and action carries the values that actually moved the model. The alternative — recording the request — makes the action column something that did not cause the reward column beside it, which is wrong in exactly the case a learner most needs right and gives no sign that it is wrong.

Not a data class, deliberately. A generated equals compares array properties by reference, so two records with identical contents are unequal and a Set keeps both, while the generated hashCode content-hashes the same arrays — the two halves disagree about what identity means. Comparison, deduplication and value assertions all need content equality, so both are written out below.

Constructors

Link copied to clipboard
constructor(elementName: String, replicationId: Int, epochIndex: Int, time: Double, tau: Double, state: DoubleArray, action: DoubleArray, proposedAction: DoubleArray? = null, leverUnavailable: BooleanArray? = null, reward: Double, successorState: DoubleArray, terminated: Boolean, truncated: Boolean, source: TerminationSource? = null, reason: String = "", provenance: EpochProvenance = EpochProvenance.IMMEDIATE)

Properties

Link copied to clipboard

What was WRITTEN to the levers, in declaration order.

Link copied to clipboard

Which element produced the row. A sink instance can serve several decision elements (§4.1.9) — captureTo { sink } over a captured variable is the ordinary idiom — and without this their rows interleave with nothing to tell them apart.

Link copied to clipboard
Link copied to clipboard

Per lever, in declaration order: was its feasible set empty at the decision, so that it took its declared neutral rather than anything the rule chose (§4.4.6.3)? Null when every lever had something to choose from. This is what distinguishes the rule chose to do nothing from the rule had nothing to choose.

Link copied to clipboard

What the policy returned, iff it differs from action. Null means it got what it asked for.

Link copied to clipboard

Where state was read: at the caller's call site, or in the element's own deferred event.

Link copied to clipboard

Why the decision at the START of this interval was taken — the label its caller supplied.

Link copied to clipboard
Link copied to clipboard

Accrued over the interval, with COST terms already negated (§4.2.5).

Link copied to clipboard

WHY it ended, not just that it did (§4.6.3).

Link copied to clipboard

The observation vector the policy was given, in declaration order.

Link copied to clipboard

The observation vector given at the next decision.

Link copied to clipboard
val tau: Double

The interval's duration. Never zero — a zero-length transition is discarded (§4.10.2.1).

Link copied to clipboard
Link copied to clipboard

The successor observation's time: the END of the interval this row covers.

Link copied to clipboard
Link copied to clipboard

True iff the rule's request was repaired or overridden before it was applied.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String