hmm state_dist for in range( )hmm advance(hmm state_dist exercise the representation assumes that there are list of boolean observations extend the representation so that the each observation variable can have multiple discrete values you need to choose representation for the modeland change the algorithm localization the localization example in the book is controlled hmmwhere there is given action at each time and the transition depends on the action in this classthe transition is set to none initiallyand needs to be provided with an action to determine the transition probability problocalization py -controlled hmm and localization example from probhmm import hmmvefilterhmm from display import displayable import matplotlib pyplot as plt from matplotlib widgets import buttoncheckbuttons class hmm_controlled(hmm)""" controlled hmmwhere the transition probability depends on the action instead of the transition probabilityit has function act trans from action to transition probability any algorithms need to select the transition probability according to the action ""def __init__(selfstatesobsvarspobsact transindist)self act trans act trans hmm __init__(selfstatesobsvarspobsnoneindist local_states list(range( )door_positions { , , , def prob_door(loc)return if loc in door_positions else local_obs {'door':[prob_door(ifor in range( )]act trans {'right'[[ if next =current else if next =(current+ )% else if next =(current+ )% else for next in range( )for current in range( )]'left'[[ if next =current else if next =(current- )% else if next =(current- )% else for next in range( )for current in range( )]version june