Closed haniees closed 3 years ago
I think the line "nothing = identity"
should be "nothing" = "identity"
.
Thanks for the quick response. I fixed that and still get the same error.
Please post a complete code example that produces the error.
Here is the entire code:
Total <- POMDP( name = "Total", discount = 0.99, horizon = c(a = 1, b = 1, c =1, d = 1), states = c("1", "2", "3", "4", "5"), actions = c("physio", "Gait", "cardiovascular", "nothing"), observations = c("1", "2", "3", "4"), start = "uniform", transition_prob = list( a = list( "Physio" = rbind(c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2)), "Gait" = rbind(c(0,0.4,0.2,0.2,0.2), c(0,0,0.6,0.2,0.2), c(0,0.2,0,0.6,0.2), c(0,0.2,0.2,0,0.6), c(0,0.2,0.2,0.6,0)), "cardiovascular" = rbind(c(0.8,0,0.2,0,0), c(0,0.8,0.2,0,0), c(0.2,0,0.8,0,0), c(0,0.2,0,0.8,0), c(0,0.2,0,0,0.8)), "nothing" = "identity"), b = list( "Physio" = rbind(c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2)), "Gait" = rbind(c(0.4,0,0.2,0.2,0.2), c(0,0.4,0.2,0.2,0.2), c(0,0.2,0.4,0.2,0.2), c(0,0.2,0.2,0.4,0.2), c(0,0.2,0.2,0.2,0.4)), "cardiovascular" = rbind(c(0.6,0.2,0.2,0,0), c(0.2,0.6,0.2,0,0), c(0.2,0.2,0.6,0,0), c(0,0.2,0.2,0.6,0), c(0,0.2,0.2,0,0.6)), "nothing" = "identity"), c = list( "Physio" = rbind(c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2)), "Gait" = rbind(c(0,0,0.8,0.2,0), c(0,0,0,0.8,0.2), c(0,0,0.8,0.,0.2), c(0,0,0,0.8,0.2), c(0,0,0,0,1)), "cardiovascular" = rbind(c(0,0,0.2,0.8,0), c(0,0,0.2,0,0.8), c(0,0,0.8,0,0.2), c(0,0,0.2,0.6,0.2), c(0,0.2,0.2,0,0.6)), "nothing" = "identity"), d = list( "Physio" = rbind(c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2)), "Gait" = rbind(c(0,00.6,0,0.2,0.2), c(0,0,0.3,0.5,0.2), c(0,0.3,0.5,0.,0.2), c(0,0,0,0.8,0.2), c(0,1,0,0,0)), "cardiovascular" = rbind(c(0,0,0.3,0.5,0.2), c(0,0,0.3,0,0.7), c(0,0,3,0,0.7), c(0,0,0.2,0.6,0.2), c(0,0.2,0.2,0,0.6)), "nothing" = "identity")),
observation_prob = list( "Physio" = "uniform", "Gait" = "uniform", "cardiovascular" = "uniform", "nothing" = "identity"),
reward = rbind(
R_("physio", "1", v = 22.5),
R_("physio", "2", v = 67.5),
R_("physio", "3", v = 112.5),
R_("physio", "4", v = 157.5),
R_("physio", "5", v = 202.5),
R_("Gait", "1", v = 22.5),
R_("Gait", "2", v = 67.5),
R_("Gait", "3", v = 112.5),
R_("Gait", "4", v = 157.5),
R_("Gait", "5", v = 202.5),
R_("cardiovascular", "1", v = 22.5),
R_("cardiovascular", "2", v = 67.5),
R_("cardiovascular", "3", v = 112.5),
R_("cardiovascular", "4", v = 157.5),
R_("cardiovascular", "5", v = 202.5),
R_("nothing", "1", v = 22.5),
R_("nothing", "2", v = 67.5),
R_("nothing", "3", v = 112.5),
R_("nothing", "4", v = 157.5),
R_("nothing", "5", v = 202.5)
),
max = TRUE,
) Total solve_POMDP(model = Total, discount = 0.99, method = "enum")
I found out that the solver does not allow digits as labels (it confuses them with an index number), so you cannot use "1" ("s1" would be fine). Also, you use sometimes uppercase and sometimes lowercase ("physio" vs. "Physio"). "identity" is not valid for observation probabilities. You have a typo where you specify 3 instead of 0.3.
I will work on the error messages in the package to make debugging easier.
Thanks for your help. The code is running without errors now.
Great!
Hello,
Here is my code for the transition probability part. I got an error which I do not know what is the problem. I really appreciate if you help me with that. I am new to R actually using this package is the only reason I am using it. Thank you in advance. This is my transition probability for 4 different episodes: transition_prob = list( a = list( "Physio" = rbind(c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2)), "Gait" = rbind(c(0,0.4,0.2,0.2,0.2), c(0,0,0.6,0.2,0.2), c(0,0.2,0,0.6,0.2), c(0,0.2,0.2,0,0.6), c(0,0.2,0.2,0.6,0)), "cardiovascular" = rbind(c(0.8,0,0.2,0,0), c(0,0.8,0.2,0,0), c(0.2,0,0.8,0,0), c(0,0.2,0,0.8,0), c(0,0.2,0,0,0.8)), "nothing = identity"), b = list( "Physio" = rbind(c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2)), "Gait" = rbind(c(0.4,0,0.2,0.2,0.2), c(0,0.4,0.2,0.2,0.2), c(0,0.2,0.4,0.2,0.2), c(0,0.2,0.2,0.4,0.2), c(0,0.2,0.2,0.2,0.4)), "cardiovascular" = rbind(c(0.6,0.2,0.2,0,0), c(0.2,0.6,0.2,0,0), c(0.2,0.2,0.6,0,0), c(0,0.2,0.2,0.6,0), c(0,0.2,0.2,0,0.6)), "nothing = identity"), c = list( "Physio" = rbind(c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2)), "Gait" = rbind(c(0,0,0.8,0.2,0), c(0,0,0,0.8,0.2), c(0,0,0.8,0.,0.2), c(0,0,0,0.8,0.2), c(0,0,0,0,1)), "cardiovascular" = rbind(c(0,0,0.2,0.8,0), c(0,0,0.2,0,0.8), c(0,0,0.8,0,0.2), c(0,0,0.2,0.6,0.2), c(0,0.2,0.2,0,0.6)), "nothing = identity"), d = list( "Physio" = rbind(c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2), c(0.2,0.2,0.2,0.2,0.2)), "Gait" = rbind(c(0,00.6,0,0.2,0.2), c(0,0,0.3,0.5,0.2), c(0,0.3,0.5,0.,0.2), c(0,0,0,0.8,0.2), c(0,1,0,0,0)), "cardiovascular" = rbind(c(0,0,0.3,0.5,0.2), c(0,0,0.3,0,0.7), c(0,0,3,0,0.7), c(0,0,0.2,0.6,0.2), c(0,0.2,0.2,0,0.6)), "nothing = identity")), And here is the error: Error in format_fixed(transition_prob[[a]], digits) : formating not implemented for NULL
Thanks again.