override public bool addStateTransition(State from, State to, int input, int reward) { HashSet <Transition> temp; // fresh init of state -> transition table for a row if (!transitions.TryGetValue(from, out temp)) { // we need to deepcopy the transition object because transitiond and Q hold different reward values Transition T = new Transition(to, input, reward); Transition QT = new DataTypes.Transition(T); temp = new HashSet <Transition>(); HashSet <Transition> qtemp = new HashSet <Transition>(); temp.Add(T); qtemp.Add(QT); transitions.Add(from, temp); Q.Add(from, qtemp); return(false); } else { Transition T = new DataTypes.Transition(to, input, reward); transitions[from].Add(T); Q[from].Add(new Transition(T)); return(true); } }
public Transition(Transition T) { destination = T.getDestination(); input = T.input; reward = T.reward; }