001    package aima.probability.reasoning;
002    
003    import aima.probability.RandomVariable;
004    
005    /**
006     * @author Ravi Mohan
007     * 
008     */
009    
010    public class HMMAgent {
011            private HiddenMarkovModel hmm;
012    
013            private RandomVariable belief;
014    
015            public HMMAgent(HiddenMarkovModel hmm) {
016                    this.hmm = hmm;
017                    this.belief = hmm.prior().duplicate();
018            }
019    
020            public RandomVariable belief() {
021                    return belief;
022            }
023    
024            public void act(String action) {
025                    belief = hmm.predict(belief, action);
026            }
027    
028            public void waitWithoutActing() {
029                    act(HmmConstants.DO_NOTHING);
030            }
031    
032            public void perceive(String perception) {
033    
034                    belief = hmm.perceptionUpdate(belief, perception);
035    
036            }
037    
038    }