public override TAction DecideAction(MDPPerception <TState> perception) { if (!(utilityFunction.HasUtilityFor(perception.GetState()))) { // if // perceptionState // is // new utilityFunction.SetUtility(perception.GetState(), perception.GetReward()); MDP.SetReward(perception.GetState(), perception.GetReward()); } if (!(PreviousState == null)) { stateCount.IncrementFor(PreviousState); utilityFunction = this.UpdateUtilityFunction(1.0); } if (MDP.IsTerminalState(CurrentState)) { PreviousState = null; PreviousAction = null; //TODO: make sure that 0 is appropriate value for what used to be null in java previousReward = 0; } else { PreviousState = CurrentState; PreviousAction = policy.GetAction(CurrentState); previousReward = CurrentReward; } return(PreviousAction); }
private void IncrementStateActionCount(TState state, TAction action) { Pair <TState, TAction> stateActionPair = new Pair <TState, TAction>( state, action); stateActionCount.IncrementFor(stateActionPair); }
public int CountOccurances(int n) { foreach (SudokuCell key in sudoku.cellColl) { if (sudoku.TruePossibilities(key).Contains(n)) { frequencyCounter.IncrementFor(n); } } return(frequencyCounter.GetCount(n)); }