
State value function V^pi (Geron Ch 18, morie.fn grvpi)
Source:R/geron_train_native.R
morie_geron_state_value_function.RdSolves (I - gamma P_pi) V = r_pi exactly; no iteration, no
convergence error. state is 0-based.
Examples
P <- array(0, c(2, 2, 2))
P[1, , ] <- rbind(c(0.9, 0.1), c(0.2, 0.8))
P[2, , ] <- rbind(c(0.5, 0.5), c(0.1, 0.9))
R <- array(1, c(2, 2, 2))
R[2, , ] <- 0.2
pi <- rbind(c(0.5, 0.5), c(0.5, 0.5))
morie_geron_state_value_function(0L, pi, P, R, gamma = 0.9)
#> $value
#> [1] 5.819355
#>
#> $values
#> [1] 5.819355 4.787097
#>
#> $state
#> [1] 0
#>
#> $estimate
#> [1] 5.819355
#>
#> $n
#> [1] 2
#>