rl_action_simulate.greedy: Simulate an Action with a 'Greedy' Choice Policy

View source: R/func_rl_simulate_action.R

rl_action_simulate.greedyR Documentation

Simulate an Action with a 'Greedy' Choice Policy

Description

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

Usage

## S3 method for class '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)

jdtrat/rlsims documentation built on March 26, 2022, 6:17 p.m.