{
  "scope": "Original small deterministic tabular MDP; actual2000trainingepisodes, not a maze reproduction, policy benchmark, or finite-run convergence theorem.",
  "versions": {
    "python": "3.10.12",
    "dependencies": "standard library only"
  },
  "settings": {
    "nonterminal_states": [
      0,
      1,
      2
    ],
    "goal": 3,
    "trap": 4,
    "actions": {
      "L": 0,
      "R": 1
    },
    "gamma": 0.9,
    "alpha": 0.2,
    "epsilon": 0.2,
    "seed": 7,
    "episodes": 2000,
    "collector_max_steps": 20,
    "start_state_every_episode": 0,
    "initial_q": "all six entries zero",
    "tie_break": "lowest action ID",
    "epsilon_branch": "uniform over both actions",
    "update": "Q(s,a) += alpha*(r + gamma*maxQ(next) - Q(s,a)); no continuation for true terminals",
    "truncation": "time limit resets collector only; bootstrap from observed next state retained"
  },
  "model_for_reader_and_oracle_only": [
    {
      "state": 0,
      "action": 0,
      "next_state": 4,
      "reward": -1.0,
      "terminated": true
    },
    {
      "state": 0,
      "action": 1,
      "next_state": 1,
      "reward": -0.1,
      "terminated": false
    },
    {
      "state": 1,
      "action": 0,
      "next_state": 0,
      "reward": -0.1,
      "terminated": false
    },
    {
      "state": 1,
      "action": 1,
      "next_state": 2,
      "reward": -0.1,
      "terminated": false
    },
    {
      "state": 2,
      "action": 0,
      "next_state": 1,
      "reward": -0.1,
      "terminated": false
    },
    {
      "state": 2,
      "action": 1,
      "next_state": 3,
      "reward": 1.0,
      "terminated": true
    }
  ],
  "training": {
    "episode_endings": {
      "goal": 1753,
      "trap": 247,
      "truncated": 0
    },
    "total_observed_transitions": 6318,
    "state_action_visit_counts_L_R": [
      [
        247,
        1968
      ],
      [
        215,
        1944
      ],
      [
        191,
        1753
      ]
    ],
    "mean_episode_length": 3.159,
    "mean_undiscounted_episode_return": 0.5371,
    "first_episode_transitions": [
      {
        "episode_0_based": 0,
        "step_1_based": 1,
        "truncated": false,
        "state": 0,
        "action": 0,
        "reward": -1.0,
        "next_state": 4,
        "terminated": true,
        "old_q": 0.0,
        "bootstrap_max_q": 0.0,
        "target": -1.0,
        "td_error": -1.0,
        "new_q": -0.2
      }
    ],
    "first_terminal_updates": {
      "goal": [
        {
          "episode_0_based": 3,
          "step_1_based": 11,
          "truncated": false,
          "state": 2,
          "action": 1,
          "reward": 1.0,
          "next_state": 3,
          "terminated": true,
          "old_q": 0.0,
          "bootstrap_max_q": 0.0,
          "target": 1.0,
          "td_error": 1.0,
          "new_q": 0.2
        },
        {
          "episode_0_based": 6,
          "step_1_based": 5,
          "truncated": false,
          "state": 2,
          "action": 1,
          "reward": 1.0,
          "next_state": 3,
          "terminated": true,
          "old_q": 0.2,
          "bootstrap_max_q": 0.0,
          "target": 1.0,
          "td_error": 0.8,
          "new_q": 0.36000000000000004
        },
        {
          "episode_0_based": 8,
          "step_1_based": 5,
          "truncated": false,
          "state": 2,
          "action": 1,
          "reward": 1.0,
          "next_state": 3,
          "terminated": true,
          "old_q": 0.36000000000000004,
          "bootstrap_max_q": 0.0,
          "target": 1.0,
          "td_error": 0.6399999999999999,
          "new_q": 0.488
        }
      ],
      "trap": [
        {
          "episode_0_based": 0,
          "step_1_based": 1,
          "truncated": false,
          "state": 0,
          "action": 0,
          "reward": -1.0,
          "next_state": 4,
          "terminated": true,
          "old_q": 0.0,
          "bootstrap_max_q": 0.0,
          "target": -1.0,
          "td_error": -1.0,
          "new_q": -0.2
        },
        {
          "episode_0_based": 1,
          "step_1_based": 1,
          "truncated": false,
          "state": 0,
          "action": 0,
          "reward": -1.0,
          "next_state": 4,
          "terminated": true,
          "old_q": -0.2,
          "bootstrap_max_q": 0.0,
          "target": -1.0,
          "td_error": -0.8,
          "new_q": -0.36000000000000004
        },
        {
          "episode_0_based": 2,
          "step_1_based": 1,
          "truncated": false,
          "state": 0,
          "action": 0,
          "reward": -1.0,
          "next_state": 4,
          "terminated": true,
          "old_q": -0.36000000000000004,
          "bootstrap_max_q": 0.0,
          "target": -1.0,
          "td_error": -0.6399999999999999,
          "new_q": -0.488
        }
      ]
    },
    "first_observed_truncation_updates": []
  },
  "learned_q_L_R": [
    [
      -0.9999999999999998,
      0.6199999999999994
    ],
    [
      0.4579999999999994,
      0.7999999999999996
    ],
    [
      0.6199999999999994,
      0.9999999999999998
    ]
  ],
  "model_oracle": {
    "q_L_R": [
      [
        -1.0,
        0.6200000000000001
      ],
      [
        0.4580000000000002,
        0.8
      ],
      [
        0.6200000000000001,
        1.0
      ]
    ],
    "synchronous_sweeps": 5,
    "optimal_v": [
      0.6200000000000001,
      0.8,
      1.0
    ],
    "max_learned_abs_error": 7.771561172376096e-16,
    "role": "Known transition model only used AFTER training for evaluation, never learner update/choice"
  },
  "greedy_evaluation_no_learning_no_exploration": {
    "trajectory": [
      {
        "state": 0,
        "action": 1,
        "reward": -0.1,
        "next_state": 1,
        "terminated": false
      },
      {
        "state": 1,
        "action": 1,
        "reward": -0.1,
        "next_state": 2,
        "terminated": false
      },
      {
        "state": 2,
        "action": 1,
        "reward": 1.0,
        "next_state": 3,
        "terminated": true
      }
    ],
    "undiscounted_return": 0.8,
    "discounted_return": 0.62,
    "terminated": true,
    "truncated": false
  },
  "controlled_truncation_example_not_training": {
    "description": "At time limit after 0R->1, next state1 is not terminal; continue bootstrapping",
    "correct_update": {
      "state": 0,
      "action": 1,
      "reward": -0.1,
      "next_state": 1,
      "terminated": false,
      "old_q": 0.6200000000000001,
      "bootstrap_max_q": 0.8,
      "target": 0.6200000000000001,
      "td_error": 0.0,
      "new_q": 0.6200000000000001
    },
    "wrong_target_if_truncation_mistaken_for_terminal": -0.1
  },
  "behavior_vs_target_arithmetic_not_sarsa_training": {
    "transition": {
      "state": 0,
      "action": 1,
      "reward": -0.1,
      "next_state": 1
    },
    "next_state_q_values": [
      0.4580000000000002,
      0.8
    ],
    "epsilon_behavior_probabilities_L_R": [
      0.1,
      0.9
    ],
    "q_learning_target_using_max": 0.6200000000000001,
    "sarsa_target_if_next_behavior_action_is_L": 0.31220000000000014,
    "expected_behavior_target_for_comparison_only": 0.5892200000000002
  },
  "limits": [
    "Learner receives only observed state/action/reward/nextstate/terminated tuples, not the model.",
    "Fixed2000episodes and alpha.2 do not satisfy the decreasing-step-size convergence theorem in general.",
    "All six pairs were visited in this run; finite positive visits are not infinite exploration.",
    "Goal/trap terminal value is zero; terminal Q rows are not stored or read.",
    "Collector truncation is exogenous, not a finite-horizon MDP terminal or a learned reset transition.",
    "If time remaining changed the actual task objective, it would need to be included in the state.",
    "Greedy evaluation freezes Q and removes epsilon exploration; it differs from training behavior.",
    "An epsilon random branch may choose the greedy action; action probabilities are .9/.1 with unique best.",
    "Oracle uses known deterministic transitions; it is a separate model-based reference, not model-free training.",
    "Single seed, hand-designed rewards, no heldout tuning, stochastic environment, function approximation or real-world lift."
  ]
}
