/// <summary> /// Implement the Q Learning update rule using experience replay /// </summary> private void UpdateKnowledge() { var mini_batch = GenerateMiniBatch(); var trainingData = new List <Tuple <State, double[]> >(); var actions = Enum.GetValues(typeof(ActionType)).Cast <ActionType>(); foreach (var experience in mini_batch) { var targetValues = new Dictionary <ActionType, double>(); var estimatedValues = Q[experience.From]; foreach (var action in actions) { targetValues[action] = QUpdate(experience, action, estimatedValues[action]); } trainingData.Add(new Tuple <State, double[]>(experience.From, targetValues.Values.ToArray())); } Q.Train(trainingData); OnTrainingComplete?.Invoke(this, new OnTrainingCompleteArgs()); }
public async Task __DoneTraining__() { OnTrainingComplete?.Invoke(); }
public void __DoneTraining__() { OnTrainingComplete?.Invoke(); }