def main():
    no_of_arms = 10
    no_of_steps = 1000
    epsilon = 0.1
    no_of_runs = 2000
    arms = np.random.normal(0, 1, no_of_arms)
    S = 1
    A = [([True] * no_of_arms)]
    R = [NormalReward(m, 1) for m in arms]
    p = [[[1] for _ in range(no_of_arms)]]
    bandit = MDP(S, A, R, p)
    optimal_action = np.argmax(arms)
    np.random.seed(1)
    Q = ([([0] * no_of_arms)] * no_of_runs)
    N = ([([0] * no_of_arms)] * no_of_runs)
    mean_rewards = ([0] * no_of_steps)
    for j in range(no_of_steps):
        for i in range(no_of_runs):
            action = epsilon_greedy(no_of_arms, epsilon, Q[i], N[i])
            (_, reward) = bandit.step(0, action)
            mean_rewards[j] += reward
            N[i][action] += 1
            Q[i][action] += ((1 / N[i][action]) * (reward - Q[i][action]))
        mean_rewards[j] /= no_of_runs
def main():
    no_of_arms = 10
    no_of_steps = 1000
    epsilon = 0.1
    no_of_runs = 2000
    arms = np.random.normal(0, 1, no_of_arms)
    S = 1
    A = [([True] * no_of_arms)]
    R = [NormalReward(m, 1) for m in arms]
    p = [[[1] for _ in range(no_of_arms)]]
    bandit = MDP(S, A, R, p)
    optimal_action = np.argmax(arms)
    np.random.seed(1)
    Q = ([([0] * no_of_arms)] * no_of_runs)
    N = ([([0] * no_of_arms)] * no_of_runs)
    mean_rewards = ([0] * no_of_steps)
    for j in range(no_of_steps):
        for i in range(no_of_runs):
            action = epsilon_greedy(no_of_arms, epsilon, Q[i], N[i])
            (_, reward) = bandit.step(0, action)
            mean_rewards[j] += reward
            N[i][action] += 1
            Q[i][action] += ((1 / N[i][action]) * (reward - Q[i][action]))
        mean_rewards[j] /= no_of_runs