Ejemplo n.º 1
0
    public int EvaluateAction(List <RewardMemory> rMemory, float threshold, int minSamples, List <ActionBase> availableActions)
    {
        if (rMemory.Count < minSamples)
        {
            Debug.Log("Initial Random Actions");
            return(UnityEngine.Random.Range(0, availableActions.Count));
        }

        else
        {
            RewardMemory lastmemory = rMemory[rMemory.Count - 1];

            if (lastmemory.reward > threshold)
            {
                return(lastmemory.action);

                Debug.Log("Action Selected");
            }
            Debug.Log("Action Below Threshold");
            return(UnityEngine.Random.Range(0, availableActions.Count));
        }
    }
Ejemplo n.º 2
0
    public int EvaluateAction(List <RewardMemory> rMemory, float threshold, int minSamples)
    {
        if (rMemory.Count < minSamples)
        {
            Debug.Log("Initial Random Actions");
            return(Mathf.RoundToInt(Random.RandomRange(0f, 2f)));
        }

        else
        {
            Vector3      currentPos = CLAB.transform.position;
            Vector3      currentRot = CLAB.transform.eulerAngles;
            RewardMemory lastmemory = rMemory[rMemory.Count - 1];

            if (lastmemory.reward > threshold)
            {
                return(lastmemory.action);

                Debug.Log("Action Selected");
            }
            Debug.Log("Action Below Threshold");
            return(Mathf.RoundToInt(Random.RandomRange(0f, 2f)));
        }
    }