Closed davidenitti closed 9 years ago
The easiest solution to fix this is to replace the definition of Maze() from
random Cell Maze(Integer x,Integer y,Timestep t) ~
if t == @0 then
if x==0 & y==0 then
free
else
Categorical({free -> 0.6, wall -> 0.4})
else Maze(x,y,prev(t))
;
to
random Cell Maze(Integer x,Integer y) ~
if x==0 & y==0 then
free
else
Categorical({free -> 0.6, wall -> 0.4})
;
The difference is that in the previous case, Maze() is a temporal random variable while in the latter case, Maze() is a static variable.
In the current implementation of Particle Filtering, we will only contain the information for the last two timesteps. Note that some positions of Maze() might not be sampled in time 1, or time 2. So when you trace back from time 3, all the information in time 1 or time 0 has been deleted.
thanks for the reply, but your proposed solution does not work: now it seems that the same maze cell is sampled at every step, even if it was already sampled. Instead a cell has to be constant over time. Thus the maze cell at time t+1 has to be equal to the maze cell at time t.
It actually works. You can try it. It produces the result of 0.25.
In particle filtering, all the random variables without an argument of timestep will be always reserved in every time step. They will not be cleared or resampled. In each time step you will have the same variable since they have nothing to do with timestep. That's why they are called static variables here. We are only removing temporal variables.
If you really want to make random var Maze() temporal variables, for now, the only way is to query it in each time step to ensure that it will be sampled before being removed.
my mistake, I forgot to remove the time. thanks!
It works, but if I want to query a cell maze at each step I get the same result. The maze belief should change according to the evidence, even when the maze is static. If I try to query several time e.g., maze(1,1) I get always the same result.
It is true, always the same result.
If you query the static variable, the result is always the posterior distribution, namely the distribution given all the data (or saying, the posterior at the final timestep, always).
If you would like to observe how the posterior distribution varies, perhaps the only way is to firstly include a timestep argument in the definition of Maze() and then query all the necessary cells of Maze() at each timestep. In this case you will probably write dozens of queries. Yes, it is really a little bit annoying. We will try to come up with some new syntax for this.
I need to compare my language with (D)BLOG for a paper. I wrote a Wumpus (temporal) example and I get different results using BLOG and DBLOG. My language and BLOG gives around 0.25 for a given query DBLOG gives around 0.44 (even with 100000 particles) for the same query. Is this a bug?
query Agentx(@3)==0 & Agenty(@3)==0; BLOG call: ./blog -r example/wumpus1.dblog -n 10000 DBLOG call: ./blog -r -e blog.engine.ParticleFilter example/wumpus1.dblog -n 10000
the program is this: