Probabilistic agent traversing a 4x4 grid world with joint probability distribution
<p>Iâm trying to solve a probabilistic agent for a simple board game from the book A Modern Approach to AI, but am having some trouble with the basic math and mostly the full joint distribution, so Iâm asking for some pointers.</p>

<p>The board is 4x4 squares
There is 1 monster and 2 pits somewhere on the board
The monster and pits give out a stench/breeze in its adjacent squares giving the agent clues if there are pits/monsters nearby</p>

<p>Rooms written as tuples of their coordinate on the grid: (x,y) from 1-4</p>

<p>For example:</p>

<p>Rooms (1, 1), (1, 2), (2, 1) is visited and we found 
breezes in rooms (1, 2) and (2, 1)</p>

<p>This tells me that there could be pits in either room adjacent to (1, 2) and (2, 1)</p>

<p>P is Probability of a pit
This variable is uniformly distributed over the 4x4 grid (16 rooms) in the beginning so we get a probability of 0.2 that there is a Pit or a Monster per square</p>

<p>B is whether there is a breeze or stench in the visited rooms (which means the probability of it being a pit next to them is higher</p>

<p>The full joint distribution should then be P(P11, â¦, P44, B11, B12, B21)</p>

<p>The product rule gives us that </p>

<p>P(P11, â¦, P44, B11, B12, B21) =</p>

<p>P(B11, B12, B21 | P11, â¦, P44) P(P11, â¦, P44)</p>

<p><a href="http://i.stack.imgur.com/U2jmg.png" rel="nofollow">Product Rule on Full Joint Distribution</a></p>

<p>So far so good, but it is here that I canât seem to take the next step.</p>

<p>The second term I have since its evenly distributed probability of 0.2 over the rooms.
But for the first term there should be 1 if the rooms with breeze (B21 and B12) is adjacent to a pit/monster. But what are the numbers for B? And how do I get that? </p>

<p>The AIMA book states: âThe first term is the conditional probability distribution of a breeze configuration, given a pit configuration; its values are 1 if the breezes are adjacent to the pits and 0 otherwiseâ</p>

<p>Iâm been struggling with this for days and making no headway. Any help would be appreciated.</p>

<p>The Bxy values are indicators of whether or not a breeze was observed in a cell xy. They're formally defined as:</p>

<p>Bxy = 1 if and only if a breeze was observed in (x, y),<br>
Bxy = 0 otherwise</p>

<p>So, in your example situation, we already know that<br>
B11 = 0, B12 = 1, B21 = 1</p>

<p>Similarly, the variables P11, P12, ..., P44 are also binary variables, where Pxy = 1 if and only if there is a pit in the cell (x, y).</p>

<p>Now to have a look at that first term, which I believe is what your question is about, the thing that you didn't understand:</p>

<p><strong>P</strong>(B11, B12, B21 | P11, ..., P44)</p>

<p>This is the conditional probability distribution of making the observations (B11, B12, B21) given that there are pits located in the cells (x, y) where Pxy = 1.</p>

<p>In the example situation, you are able to fill in the values for B11, B12, and B21. You know that B11 = 0, and B12 = B21 = 1 (because that's what was observed). You don't know in which locations the pits are, so you cannot directly fill in the Pxy values specifically for your situation. However, you <em>can</em> fill in those values for any arbitrary situation you can think of.</p>

<p>You can say "ok, let's assume there is only a pit in location (1, 3)". Then we have P13 = 1, and all other Pxy = 0. For such a specific situation, it is also possible to compute the probability of that specific situation happening (which would be 0, because you can't observe a breeze in (2, 1) if there's only a pit in (1, 3)). </p>

<p>If you repeat this for all possible situations you can imagine, you can combine the results to get more interesting answers, such as the probability of there being a pit in a certain location, given the observations you made. That's what the text further down is about though, and I believe that's no longer what your question was about.</p>

python artificial-intelligence probability agent