Run interaction between agent and environment for specified number of steps or episodes.

interact(env, agent, n.steps = Inf, n.episodes = Inf,
  max.steps.per.episode = Inf, learn = TRUE, visualize = FALSE)

Arguments

env

[Environment] Reinforcement learning environment created by makeEnvironment.

agent

[Agent] Agent created by makeAgent.

n.steps

[integer(1)] Number of steps to run.

n.episodes

[integer(1)] Number of episodes to run.

max.steps.per.episode

[integer(1)] Maximal number of steps allowed per episode.

learn

[logical(1)] Should the agent learn?

visualize

[logical(1)] Visualize the interaction between agent and environment?

Value

[list] Return and number of steps per episode.

Examples

env = makeEnvironment("windy.gridworld") agent = makeAgent("softmax", "table", "qlearning") interact(env, agent, n.episodes = 10L)
#> Episode 1 finished after 872 steps with a return of -872
#> Episode 2 finished after 489 steps with a return of -489
#> Episode 3 finished after 571 steps with a return of -571
#> Episode 4 finished after 4708 steps with a return of -4708
#> Episode 5 finished after 806 steps with a return of -806
#> Episode 6 finished after 603 steps with a return of -603
#> Episode 7 finished after 108 steps with a return of -108
#> Episode 8 finished after 237 steps with a return of -237
#> Episode 9 finished after 164 steps with a return of -164
#> Episode 10 finished after 338 steps with a return of -338
#> $returns #> [1] -872 -489 -571 -4708 -806 -603 -108 -237 -164 -338 #> #> $steps #> [1] 872 489 571 4708 806 603 108 237 164 338 #>