001    package aima.probability.decision;
002    
003    import java.util.Hashtable;
004    import java.util.Set;
005    
006    /**
007     * @author Ravi Mohan
008     * 
009     */
010    
011    public class MDPPolicy<STATE_TYPE, ACTION_TYPE> {
012            Hashtable<STATE_TYPE, ACTION_TYPE> stateToAction;
013    
014            public MDPPolicy() {
015                    stateToAction = new Hashtable<STATE_TYPE, ACTION_TYPE>();
016            }
017    
018            public ACTION_TYPE getAction(STATE_TYPE state) {
019                    return stateToAction.get(state);
020            }
021    
022            public void setAction(STATE_TYPE state, ACTION_TYPE action) {
023                    stateToAction.put(state, action);
024            }
025    
026            @Override
027            public String toString() {
028                    return stateToAction.toString();
029            }
030    
031            public Set<STATE_TYPE> states() {
032    
033                    return stateToAction.keySet();
034            }
035    
036    }