reversal_bandit_sim (faber_tweann v2.4.0)
View SourceReversal bandit: a lifetime-LEARNING benchmark (learning to learn).
Where tmaze_sim / multi_cue_tmaze_sim test MEMORY within one episode (hold a cue you were shown), this tests LEARNING across an episode (discover, from reward, a mapping you were never shown, and re-discover it when it changes). Two arms; one is "good". The agent is told NOTHING about which -- its only signal is the reward it receives after each choice. Partway through the lifetime the good arm SWAPS, so no fixed policy wins: the agent must learn which arm pays, then RE-learn after the reversal.
Sensor (vl 1): a constant [1.0] -- there is no cue to remember; the information lives entirely in the reward stream. Actuator (vl 1): Output of zero or more chooses arm 0, below zero chooses arm 1. Reward / modulator: +1.0 if the chosen arm is currently good, -1.0 otherwise. The SAME value is the fitness contribution AND the neuromodulator a reward-gated plasticity rule uses to adapt (see network_evaluator:evaluate_with_neuromod/4).
Why it is the right instrument: with the good arm hidden and reversing, a FIXED network emits a constant action and is right only half the time across a balanced set of instances -- a lifetime reward sum near 0 (chance). An agent that reads the reward and adapts its weights within the lifetime reaches near +Lifetime, losing only the few exploratory trials at the start and just after the reversal. Storage (a recurrent state) can only compete if the reward is fed as an INPUT; here it is not, so this scape isolates reward-GATED plasticity as the learning mechanism.
Fully deterministic given its init params [GoodArm, ReversalAt, Lifetime], so a runner can enumerate a fixed set of instances (common random numbers) and average -- no fitness noise. The probabilistic variant (which also admits a storage competitor) is a separate scape.