Decide() 공개 추상적인 메소드

public abstract Decide ( StateController controller ) : bool
controller StateController
리턴 bool
예제 #1
0
 private void ResetTimerDecision(StateController controller)
 {
     if (resetDecision.Decide(controller) == true)
     {
         timerDecision.ResetTimer();
     }
 }
예제 #2
0
    //The UpdateState is called every frame
    public void UpdateState(DayFSM FSM)
    {
        if (!isPhysic)
        {
            //Go through all registered actions
            foreach (Action action in actions)
            {
                #region Warnings
                //Some warnings
                if (action == null)
                {
                    Debug.LogWarning("Carefull, you have setup an empty action !! check this state again : " + this);
                }
                #endregion

                action.Act(FSM);
            }
        }

        //Check if there is a Decision for Force Stay in state or if ForceStayInState is true
        if (ForceStayInState == null || ForceStayInState.Decide(FSM))
        {
            CheckTransitions(FSM);
        }
    }
예제 #3
0
    /// Uses the Decision Component to decide that action to take
    public void DecideAction(Dictionary <Agent, AgentInfo> agentInfo)
    {
        if (coord != null)
        {
            coord.GiveBrainInfo(brain, agentInfo);
        }

        if (decision == null)
        {
            throw new UnityAgentsException("The Brain is set to Heuristic, but no decision script attached to it");
        }

        foreach (Agent agent in agentInfo.Keys)
        {
            agent.UpdateVectorAction(decision.Decide(
                                         agentInfo[agent].stackedVectorObservation,
                                         agentInfo[agent].visualObservations,
                                         agentInfo[agent].reward,
                                         agentInfo[agent].done,
                                         agentInfo[agent].memories));
        }

        foreach (Agent agent in agentInfo.Keys)
        {
            agent.UpdateMemoriesAction(decision.MakeMemory(
                                           agentInfo[agent].stackedVectorObservation,
                                           agentInfo[agent].visualObservations,
                                           agentInfo[agent].reward,
                                           agentInfo[agent].done,
                                           agentInfo[agent].memories));
        }
    }
예제 #4
0
 public State CheckTransitions(State current, AIController aI)
 {
     if (decision.Decide(aI))
     {
         return(trueState);
     }
     else
     {
         return(falseState);
     }
 }
예제 #5
0
    private void CheckTransitions(StateController controller)
    {
        // initialize empty string
        result = "";
        for (int j = 0; j < transition.decisions.Length; j++)
        {
            Decision decision = transition.decisions[j];
            decisionSucceded = decision.Decide(controller);
            // if true, value = "1", else value = "false", then concatenate it to the result, result is in binary string
            value   = decisionSucceded ? "1" : "0";
            result += value;
        }
        //Debug.Log("result:"+result);

        // convert result to integer, which is the index for the states list in transition
        index = Convert.ToInt32(result, 2);

        // transit to the corresponding state
        controller.TransitionToState(transition.states[index]);
    }
예제 #6
0
    /// Uses the Decision Component to decide that action to take
    public void DecideAction()
    {
        if (decision == null)
        {
            throw new UnityAgentsException("The Brain is set to Heuristic, but no decision script attached to it");
        }

        Dictionary <int, float[]>        actions      = new Dictionary <int, float[]>();
        Dictionary <int, float[]>        new_memories = new Dictionary <int, float[]>();
        Dictionary <int, List <float> >  states       = brain.CollectStates();
        Dictionary <int, List <Camera> > observations = brain.CollectObservations();
        Dictionary <int, float>          rewards      = brain.CollectRewards();
        Dictionary <int, bool>           dones        = brain.CollectDones();
        Dictionary <int, float[]>        old_memories = brain.CollectMemories();

        foreach (KeyValuePair <int, Agent> idAgent in brain.agents)
        {
            actions.Add(idAgent.Key, decision.Decide(
                            states[idAgent.Key],
                            observations[idAgent.Key],
                            rewards[idAgent.Key],
                            dones[idAgent.Key],
                            old_memories[idAgent.Key]));
        }

        foreach (KeyValuePair <int, Agent> idAgent in brain.agents)
        {
            new_memories.Add(idAgent.Key, decision.MakeMemory(
                                 states[idAgent.Key],
                                 observations[idAgent.Key],
                                 rewards[idAgent.Key],
                                 dones[idAgent.Key],
                                 old_memories[idAgent.Key]));
        }
        brain.SendActions(actions);
        brain.SendMemories(new_memories);
    }
예제 #7
0
 private int Eval(Decision node, int input)
 {
     return(node.Decide(input));
 }
예제 #8
0
파일: AND.cs 프로젝트: itbonds/KiCoScripts
 public override bool Decide(Controller controller)
 {
     return(left.Decide(controller) && right.Decide(controller));
 }
예제 #9
0
 public override bool Decide(Controller controller)
 {
     return(!decision.Decide(controller));
 }