This implementation of a 'greedy' action selection policy will mean whichever action has the highest expected value will be taken.

# S3 method for greedy
rl_action_simulate(policy = "greedy", values, ...)

Arguments

policy

Defines the action selection policy as "greedy"; argument included in this method to support S3 Generics.

values

A numeric vector containing the current value estimates of each action.

...

Additional arguments passed to or from other methods.

Value

A number representing which action will be taken.

Examples


action <- numeric(100)
for (trial in seq_along(action)) {
  action[trial] <- rl_action_simulate(
    policy = "greedy",
    values = c(0.2, 0.25, 0.15, 0.8)
  )
}

# All of the actions were to choose the highest value option
all(action == 4)
#> [1] TRUE