kumulant

Snapshotable

interface Snapshotable<S>(source)

State surface for any bandit whose state can be checkpointed, replicated, and merged with a sibling's. Orthogonal to the action surface; every bandit family has its own natural S:

The pattern: workers run the same bandit configuration in parallel, periodically call snapshot, ship snapshots to a coordinator, the coordinator runs its own bandit and folds each worker's snapshot in via merge. Because the merge unit is the snapshot (not a live bandit), the worker is free to terminate after each report.

Inheritors

Functions

Link copied to clipboard
abstract fun create(random: Random): Snapshotable<S>

Spawn a fresh bandit with the same configuration; state resets to the prior seed. The random source is replaced; pass the source you want the new bandit to use for exploration (which is independent of merging in another snapshot's state).

Link copied to clipboard
abstract fun merge(other: S)

Fold another replica's other state into this bandit. Most families merge exactly via the underlying stat's parallel-merge formula; SGD- based contextual bandits merge approximately. Each concrete bandit's KDoc documents its merge semantics.

Link copied to clipboard
abstract fun snapshot(): S

Materialise the current state as a serialisable snapshot. Reads are non-mutating; call as often as needed without affecting decisions. Same snapshot consistency rules as com.eignex.kumulant.core.Stat.read ; under com.eignex.kumulant.core.Concurrency.Relaxed coupled cells may drift by ULPs.

create

abstract fun create(random: Random): Snapshotable<S>(source)

Spawn a fresh bandit with the same configuration; state resets to the prior seed. The random source is replaced; pass the source you want the new bandit to use for exploration (which is independent of merging in another snapshot's state).

Useful when a worker accepts a stream of snapshots to apply sequentially: create(random).also { it.merge(snapshot) }.

merge

abstract fun merge(other: S)(source)

Fold another replica's other state into this bandit. Most families merge exactly via the underlying stat's parallel-merge formula; SGD- based contextual bandits merge approximately. Each concrete bandit's KDoc documents its merge semantics.

snapshot

abstract fun snapshot(): S(source)

Materialise the current state as a serialisable snapshot. Reads are non-mutating; call as often as needed without affecting decisions. Same snapshot consistency rules as com.eignex.kumulant.core.Stat.read ; under com.eignex.kumulant.core.Concurrency.Relaxed coupled cells may drift by ULPs.