private List <int> GetValues(MapsVertex vertex, MapsAgent agent)
        {
            Dictionary <Predicate, TraceVariable> agentsVars = TraceVariable.GetVariablesDict(agent.GetID());
            List <int>          values     = new List <int>();
            HashSet <Predicate> predicates = GetCorrespondingAgentState(vertex, agent).m_lPredicates;

            foreach (Predicate p in agentsVars.Keys)
            {
                if (predicates.Contains(p))
                {
                    values.Add(0); //0 == true
                }
                else
                {
                    values.Add(1); //1 == false
                }
            }
            return(values);
        }
예제 #2
0
        private List <int> GetVals(Predicate predicate, Agent agent, int value, Dictionary <Predicate, int> publicEffects)
        {
            int oppositeVal = 1;

            if (value == 1)
            {
                oppositeVal = 0;
            }

            List <int> vals = new List <int>();
            Dictionary <Predicate, TraceVariable> agentsVars = TraceVariable.GetVariablesDict(agent.getID());
            bool found = false;

            if (predicate == null)
            {
                found = true;
            }
            foreach (Predicate p in agentsVars.Keys)
            {
                if (predicate != null && p.Equals(predicate))
                {
                    vals.Add(value);
                    found = true;
                }
                else
                {
                    if (publicEffects.ContainsKey(p))
                    {
                        vals.Add(publicEffects[p]);
                    }
                    else
                    {
                        vals.Add(oppositeVal); //opposite -- dont care about them
                    }
                }
            }
            if (!found)
            {
                throw new Exception("Variable not found");
            }

            return(vals);
        }