0.8p(x2)+ 0.1p(x1)+ 0.1p(x3) = p(x4)
Gain information, loses information
Entropy -Σp(xi)log p(x)
BELiEF = PROBABility
sense = product followed by normalization
move = convolution(=addition)
formal definition
0 <= p(x) <= 1
p(x1) = 0.2
p(x2) = 0.8
bayes rule
x = grid cell, z = measurement
p(x|z) = p(z|x)p(x)/ p(z)
motion - total probability
p(xit) = Σj P(xg t-1)・p(xi|xj)
p(x)=0.2 p(¬x)=0.8
p(x)=0.2 p(y)=0.2 p(x,y) = 0.04
p(x)=0.2 p(y|x)=0.6 p(y|¬x)=0.6 p(y)=0.6
[python]
colors = [['green', 'green', 'green'],
['green', 'red', 'green'],
['green', 'green', 'green']]
measurements = ['red', 'red']
motions = [[0, 0], [0, 1]]
sensor_right = 1.0
p_move = 1.0
[/python]
def localize(colors, measurements, motions, sensor_right, p_move): print = 1.0 / float(len(colors)) / float(len(colors[0])) p = [[pinit for row in range(len(colors[0]))] for col in range(len(colors))] return p sensor_wrong = 1.0 – sensor_right p_stay = 1.0 – p_move def show(p): rows = [‘[‘ + ‘,’.join(map(lambda x: ‘{0:.5f’.format(x), r))+’]’ for r in p] print ‘[‘ + ‘,\n ‘.join(rows) + ‘]’ colors = [[‘R’,’G’,’G’,’R’,’R’], [‘R’,’R’,’G’,’R’,’R’], [‘R’,’R’,’G’,’G’,’R’], [‘R’,’R’,’R’,’R’,’R’]] measurements = [‘G’,’G’,’G’,’G’,’G’] motions = [[0,0],[0,1],[1,0],[1,0],[0,1]] p = localize(colors,measurements,motions,sensor_right = 0.7, p_move = 0.8) show(p)