void AI.Update <Agent>(Agent agent) { State currentState = environment.GetStateOf(agent); InitState(currentState); AIAction nextAction = policy.ChooseAction(currentState, ActionValueFunction); double reward = environment.TakeActionInState(currentState, nextAction); State nextState = environment.GetStateOf(agent); UpdateActionValueFunction(currentState, nextState, nextAction, reward); }
public StepDetails GetStepDetails <Agent>(Agent agent) { StepDetails stepDetails; stepDetails.currentState = environment.GetStateOf(agent); InitState(stepDetails.currentState); stepDetails.action = policy.ChooseAction(stepDetails.currentState, ActionValueFunction); stepDetails.reward = environment.TakeActionInState(stepDetails.currentState, stepDetails.action); stepDetails.nextState = environment.GetStateOf(agent); return(stepDetails); }