Package-level declarations

Types

Link copied to clipboard

A write that failed partway through applying a plan.

Link copied to clipboard
fun interface ActionSearch

How a rule searches ActionSet for its best member. Model-independent, which is why it belongs to the library: the loop is the same for every value-function and cost-function policy ever written, and only the scoring differs.

Link copied to clipboard
interface ActionSet

The feasible action set 𝒳(s) as an OBJECT rather than as scattered members of the decision context (§4.4.6.5).

Link copied to clipboard

An action that could not be applied: outside a lever's bounds, non-integral on an integer domain, NaN, the wrong arity, or violating a joint constraint.

Link copied to clipboard
class AmbiguousLeverException(ownerName: String, val candidates: List<String>) : RuntimeException

Thrown by leverFor/rewardFor when the owner backs more than one declared lever or term.

Link copied to clipboard
class BindingException(val unresolved: String, val available: List<String>, val hint: String? = null) : RuntimeException

A declared name that does not resolve against the element it was given to.

Link copied to clipboard

§4.3.1 — name resolution for one element's surface. Built only by DecisionElementBuilder.

Link copied to clipboard
interface DecisionContext

Everything a rule may know at a decision instant.

Link copied to clipboard

§4.10.1 and §4.10.2. Declared through decisionElement; never constructed directly.

Link copied to clipboard
Link copied to clipboard

Score every action. Requires a finite ActionSet.size.

Link copied to clipboard

A constant action. Arity is checked against the declaration at assignment.

Link copied to clipboard
class GridSearch(pointsPerLever: Int = 11) : ActionSearch

Score a regular grid over each lever's feasible range, keeping only feasible points. The fallback when the set is continuous or too large to walk.

Link copied to clipboard
annotation class KSLDecisionDsl
Link copied to clipboard

A value function that improves from observed experience.

Link copied to clipboard
data class LeverInfo(val name: String, val domain: LeverDomain, val kind: LeverKind, val modelLowerLimit: Double, val modelUpperLimit: Double, val supportsCurrentValue: Boolean, val batchGroup: String? = null, val levels: List<String>? = null, val unit: String? = null)

The descriptive half of a lever. Holding one cannot write anything (§4.3.1.1).

Link copied to clipboard
data class LeverRef

The identity of a declared lever. A lever is (target, limits, domain, write), so its identity is its own — not that of the element it writes, which may back several levers. Pure data: holding one confers no access to anything.

Link copied to clipboard
abstract class LookaheadPolicy(val search: ActionSearch = ExhaustiveSearch) : ShapeAwarePolicyIfc

The skeleton shared by every policy that chooses among available actions rather than constructing one directly: value-function approximations, and cost-function approximations that score candidates.

Link copied to clipboard

A policy with a lifecycle: per-replication state to reset, or a resource to release.

Link copied to clipboard

An attempt to narrow a lever outside what the model declares, or to non-integral bounds on an integer domain.

Link copied to clipboard
sealed interface Neutral<in T>

Every lever declares what doing nothing means. This is the repair §8.2.3 specifies, and it is a required argument rather than an optional one.

Link copied to clipboard

Do nothing — every lever takes its declared neutral value. The Level-2 compatibility baseline of §6.2.

Link copied to clipboard
class NotDeclarableYetException(val form: String, val milestone: String, val section: String) : RuntimeException

A form the DSL accepts and the library does not yet carry (G.9 row 11).

Link copied to clipboard
class PeriodicDecisionElement @JvmOverloads constructor(parent: ModelElement, interval: Double, name: String? = null, firstAtTimeZero: Boolean = false, reason: String = "periodic", reviewPriority: Int = KSLEvent.MEDIUM_LOW_PRIORITY, elementName: String? = null, declaration: DecisionElementBuilder.() -> Unit) : ModelElement

A decision element reviewed on a fixed period, declared and scheduled in one construction.

Link copied to clipboard
fun interface PolicyIfc

§4.5 — the policy seam and the context a rule is given at a decision instant.

Link copied to clipboard
class PolicyScheduledEventException(val elementName: String, val policyLabel: String, val eventsScheduled: Long) : IllegalStateException

Thrown when a policy schedules an event during the call that asked it for an action.

Link copied to clipboard
class ReentrantDecisionException(val elementName: String, val reason: String) : IllegalStateException

S§C.11.1 — thrown when decide is entered while a decision is already in progress.

Link copied to clipboard

A reward term whose declared accumulation kind does not match what its source actually offers — a TIME_INTEGRAL declared against a plain Response, say.

Link copied to clipboard
data class RewardRef

The identity of a declared reward term. A term is (source, kind, rate, sense), so its identity is its own — one source may back several terms at different rates or senses.

Link copied to clipboard

Read-only view of a Response, TWResponse, or Counter used as a reward source.

Link copied to clipboard

Moved here from the implementations package, because it is not one.

Link copied to clipboard
class RunawayDecisionRequestException(val elementName: String, val time: Double, val drains: Int, val stillPending: List<String>) : IllegalStateException

D11 — thrown when deferred requests keep arriving during the decisions that answer them.

Link copied to clipboard
@Serializable
data class RunProvenance(val modelName: String, val experimentName: String, val elementName: String, val policyLabel: String, val descriptor: DecisionSurfaceDescriptor)

What produced a set of transitions: which model, which experiment, which element, which rule — and the descriptor that gives the rows their meaning.

Link copied to clipboard
class SampledSearch(candidates: Int = 200, uniform: GetValueIfc) : ActionSearch

Score candidates actions drawn at random from the set.

Link copied to clipboard

Implement when a rule requires something of the declared shape, or must BUILD something from it — a discretization grid, a table sized to the action vector, a network's input layer.

Link copied to clipboard
class StaleDecisionContextException(val elementName: String, val member: String, val decisionsSince: Long) : IllegalStateException

Thrown when a DecisionContext is read outside the action call that supplied it.

Link copied to clipboard
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)

§4.8.3. The atom of recorded experience.

Link copied to clipboard

§4.8.2. A write-only consumer with a per-experiment lifetime.

Link copied to clipboard
data class UnitCoverage(val observationsDeclared: Int, val observations: Int, val leversDeclared: Int, val levers: Int, val constraintsChecked: Int, val constraintsPartlyChecked: Int, val constraints: Int)

How much of a decision surface's units were declared, and how much of the checking that makes possible actually ran (§4.2.4, G.9 row 7).

Link copied to clipboard
fun interface ValueApproximationIfc

An approximation of downstream value, evaluated at a post-decision state — the V̄ of approximate dynamic programming (§4.5.5).

Properties

Link copied to clipboard
const val MAX_DRAINS_PER_INSTANT: Int = 1000

How many drains one instant may take before a self-retriggering request is called a runaway.

Functions

Link copied to clipboard

Entry point, shaped like ModelElement.queueingNetwork (§4.1.2.1).