// Use this for initialization void Start() { CLAB = gameObject; expert = CLAB.GetComponent <Expert>(); kga = CLAB.GetComponent <KGA>(); learner = CLAB.GetComponent <Learner>(); memory = expert.memory; eMemory = kga.ememory; rMemory = expert.rMemory; expert.AddToMemory(CLAB); }
void FixedUpdate() { int bestAction = expert.EvaluateAction(rMemory, threshold, samples); int lastAction = learner.CallAction(bestAction); expert.AddToMemory(CLAB); float predictionError = expert.PredictionError(memory, CLAB, lastAction); //Debug.Log("prediction Error" + predictionError); kga.AddToErrorMemory(predictionError); float meanError = kga.MeanError(eMemory, samples); //Debug.Log("mean Error" + meanError); float metaError = kga.MetaM(eMemory, samples, offset); //Debug.Log("meta Error" + meanError); float reward = kga.Reward(meanError, metaError); Debug.Log("reward" + reward * 10); expert.AddToRewardMemory(CLAB, reward * 10, lastAction); }