示例#1
0
        public void ProccessActions()
        {
            if(_start==null || _resault==null)
                return;

            ModelConfiguration mc = new ModelConfiguration(_start);

            for (int i = 0; i < _actions.Count; i++)
            {
                mc = mc*_actions[i];
            }
            _resault.CopyFrom(mc);
        }
示例#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);
        }
示例#3
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;
        }
示例#4
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);
        }
示例#5
0
 public ModelConfiguration CreateNewModel(string name)
 {
     ModelConfiguration modelConfiguration = new ModelConfiguration(name);
     _models.Add(name, modelConfiguration);
     return modelConfiguration;
 }
示例#6
0
 public ModelConfiguration(ModelConfiguration model)
 {
     CopyFrom(model);
 }
示例#7
0
        public void CopyFrom(ModelConfiguration modelConfiguration)
        {
            Name = modelConfiguration.Name;
            EpisState[] StateArray = new EpisState[modelConfiguration.States.Count];
            EpisTransitionPair[] TransArray = new EpisTransitionPair[modelConfiguration.TransitionRelation.Count];

            modelConfiguration.States.CopyTo(StateArray);
            modelConfiguration.TransitionRelation.CopyTo(TransArray);

            States = StateArray.ToList();
            TransitionRelation = TransArray.ToList();
        }
示例#8
0
 public ModelConfiguration(ModelConfiguration model)
 {
     CopyFrom(model);
 }