Esempio n. 1
0
        public static ModelConfiguration operator *(ModelConfiguration model, ActionModel action)
        {
            ModelConfiguration toret = new ModelConfiguration(model.Name + "_" + action.Name);

            List <EAState>     newStates = new List <EAState>();
            List <EAStatePair> newTrans  = new List <EAStatePair>();

            foreach (var aState in action.ActionStates)
            {
                foreach (var eState in model.States)
                {
                    if (eState.SatisfiesFormula(aState.Precondition))
                    {
                        newStates.Add(new EAState(eState, aState));
                    }
                }
            }

            foreach (var a in newStates)
            {
                foreach (var b in newStates)
                {
                    AssossiativeSet <Agent> episTaged    = model.GetTagedAgentOfTransitionBetween(a.ModelState, b.ModelState);
                    AssossiativeSet <Agent> actionTaged  = action.GetTagedAgentOfTransitionBetween(a.ActionState, b.ActionState);
                    AssossiativeSet <Agent> intersection = episTaged.IntersectWith(actionTaged);
                    if (!intersection.IsEmpty)
                    {
                        EAStatePair newTransPair = new EAStatePair(a, b);
                        newTransPair.TagedAgents = intersection;
                        newTrans.Add(newTransPair);

                        toret.AddState(a.ModelState);
                        toret.AddState(b.ModelState);

                        toret.AddTransition(a.ModelState, b.ModelState, intersection, true);
                    }
                }
            }

            return(toret);
        }
Esempio n. 2
0
        public static ModelConfiguration operator *(ModelConfiguration model, ActionModel action)
        {
            ModelConfiguration toret = new ModelConfiguration(model.Name+"_"+action.Name);

            List<EAState> newStates = new List<EAState>();
            List<EAStatePair> newTrans = new List<EAStatePair>();

            foreach (var aState in action.ActionStates)
            {
                foreach (var eState in model.States)
                {
                    if(eState.SatisfiesFormula(aState.Precondition))
                        newStates.Add(new EAState(eState , aState));
                }
            }

            foreach (var a in newStates)
            {
                foreach (var b in newStates)
                {
                    AssossiativeSet<Agent> episTaged = model.GetTagedAgentOfTransitionBetween(a.ModelState, b.ModelState);
                    AssossiativeSet<Agent> actionTaged = action.GetTagedAgentOfTransitionBetween(a.ActionState, b.ActionState);
                    AssossiativeSet<Agent> intersection = episTaged.IntersectWith(actionTaged);
                    if (!intersection.IsEmpty)
                    {
                        EAStatePair newTransPair = new EAStatePair(a,b);
                        newTransPair.TagedAgents = intersection;
                        newTrans.Add(newTransPair);

                        toret.AddState(a.ModelState);
                        toret.AddState(b.ModelState);

                        toret.AddTransition(a.ModelState, b.ModelState, intersection , true);
                    }
                }
            }

            return toret;
        }
Esempio n. 3
0
        public ModelConfiguration GeneratRawModelConfiguration(string name)
        {
            ModelConfiguration modelConfiguration = new ModelConfiguration(name);
            int stateCount = (int)Math.Pow(2, _atomics.Count);

            bool[] positivity = InitializeSingleValueArray(_atomics.Count, false);
            for (int i = 0; i < stateCount; i++)
            {
                EpisState toAdd = new EpisState(_atomics.Values.ToArray(), positivity);
                modelConfiguration.AddState(toAdd);
                IncreamentBinarySeq(ref positivity);
            }
            foreach (var s1 in modelConfiguration.States)
            {
                foreach (var s2 in modelConfiguration.States)
                {
                    EpisTransitionPair trans = new EpisTransitionPair(s1, s2);
                    trans.TagedAgents = new AssossiativeSet <Agent>(_agents.Values);
                    modelConfiguration.TransitionRelation.Add(trans);
                }
            }

            return(modelConfiguration);
        }