Hi everybody!
I am new to Julia, POMDPs, and Pluto… and I am using all three to try and simulate a POMDP problem. I know that I am probably making some mistakes in my POMDP, but my immediate error is:
UndefVarError: i
not defined
I am curious as to why I receive this error when ‘i’ is defined within the same Pluto cell.
I also receive warnings (image posted below) about the other POMDP variables s, r_total, d, b as well.
Nowhere in my code are any of these variables defined globally.
I appreciate any insight that can help me to solve this challenge.
So far I have tried different browsers, including using incognito mode, and still receive this error.
If I comment out ‘i’, and all parts of the code that rely on ‘i’, then the next error I receive is "UndefVarError: ‘b’ not defined so I think that this points to scope of these variables defined within the begin / end block of the cell, and the scope within the while loop.
begin
up = DiscreteUpdater(pomdp);
b0 = uniform_belief(pomdp);
s = rand(initialstate(pomdp));
b = initialize_belief(up, b0);
r_total = 0.0;
d = 1.0;
i = 0 # index of current bin
while (!isterminal(pomdp, s)) && (i < 60)
determine_observations(i,1)
a = action(policy, b)
s, o, r = @gen(:sp,:o,:r)(pomdp, s, a)
r_total += d*r
d *= discount(pomdp)
b = update(up, b, a, o)
i += 1
end
end