Beispiel #1
0
        public DeterministicFAState_Subset AddState()
        {
            int id = States.Count;
            DeterministicFAState_Subset toReturn = new DeterministicFAState_Subset(States.Count);

            States.Add(id, toReturn);
            return(toReturn);
        }
Beispiel #2
0
        public DeterministicFAState_Subset AddInitialState()
        {
            DeterministicFAState_Subset toReturn = new DeterministicFAState_Subset(0);

            States.Add(0, toReturn);
            InitialState = toReturn;
            return(toReturn);
        }
 public DeterministicFAState_Subset AddInitialState()
 {
     DeterministicFAState_Subset toReturn = new DeterministicFAState_Subset(0);
     States.Add(0, toReturn);
     InitialState = toReturn;
     return toReturn;
 }
 /// <summary>
 /// return true iff deterministic
 /// </summary>
 /// <param name="evt"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public void AddTransition(string evt, DeterministicFAState_Subset target)
 {
     Post.Add(evt, target);
 }
 public void AddTransition(DeterministicFAState_Subset source, string evt, DeterministicFAState_Subset target)
 {
     source.AddTransition(evt, target);
 }
 public DeterministicFAState_Subset AddState()
 {
     int id = States.Count;
     DeterministicFAState_Subset toReturn = new DeterministicFAState_Subset(States.Count);
     States.Add(id, toReturn);
     return toReturn;
 }
Beispiel #7
0
 public TupleSub(MDPConfiguration imp, DeterministicFAState_Subset spec, MDPState mdp)
 {
     ImplState = imp;
     SpecState = spec;
     MDPState = mdp;
 }
Beispiel #8
0
        public DeterministicAutomata_Subset DeterminizeSubset()
        {
            Dictionary <string, DeterministicFAState_Subset> Visited = new Dictionary <string, DeterministicFAState_Subset>(Ultility.Ultility.MC_INITIAL_SIZE);
            HashSet <NormalizedFAState> VisitedNormalizedState       = new HashSet <NormalizedFAState>();
            Stack <NormalizedFAState>   pending = new Stack <NormalizedFAState>(1024);

            NormalizedFAState current = (new NormalizedFAState(InitialState)).TauReachable();

            VisitedNormalizedState.Add(current);
            pending.Push(current);

            DeterministicAutomata_Subset toReturn = new DeterministicAutomata_Subset();

            Visited.Add(current.GetID(), toReturn.AddInitialState());

            while (pending.Count > 0)
            {
                current = pending.Pop();
                DeterministicFAState_Subset currentState = Visited[current.GetID()];

                Dictionary <string, HashSet <FAState> > nexts = new Dictionary <string, HashSet <FAState> >();

                foreach (FAState state in current.States)
                {
                    foreach (KeyValuePair <string, HashSet <FAState> > pair in state.Post)
                    {
                        if (pair.Key != Constants.TAU)
                        {
                            HashSet <FAState> states;
                            if (!nexts.TryGetValue(pair.Key, out states))
                            {
                                states = new HashSet <FAState>();
                                nexts.Add(pair.Key, states);
                            }

                            foreach (FAState faState in pair.Value)
                            {
                                states.Add(faState);
                            }
                        }
                    }
                }

                foreach (KeyValuePair <string, HashSet <FAState> > keyValuePair in nexts)
                {
                    NormalizedFAState next     = new NormalizedFAState(keyValuePair.Value);
                    NormalizedFAState newState = next.TauReachable();

                    //foreach (NormalizedFAState state in )
                    //{
                    //    if(newState.States.IsProperSupersetOf(state.States))
                    //    {
                    //        newState.sub.Add(state);
                    //    }
                    //}

                    DeterministicFAState_Subset target;
                    if (!Visited.TryGetValue(newState.GetID(), out target))
                    {
                        VisitedNormalizedState.Add(newState);
                        target = toReturn.AddState();
                        Visited.Add(newState.GetID(), target);
                        //foreach(var deterministicFaState in Visited)
                        //{

                        //}
                        pending.Push(newState);
                    }

                    toReturn.AddTransition(currentState, keyValuePair.Key, target);

                    foreach (var nstate in VisitedNormalizedState)
                    {
                        if (newState.States.IsProperSupersetOf(nstate.States))
                        {
                            Visited[newState.GetID()].Sub.Add(Visited[nstate.GetID()]);
                        }
                        else if (newState.States.IsProperSubsetOf(nstate.States))
                        {
                            Visited[nstate.GetID()].Sub.Add(Visited[newState.GetID()]);
                        }
                    }
                }
            }

            return(toReturn);
        }
Beispiel #9
0
 /// <summary>
 /// return true iff deterministic
 /// </summary>
 /// <param name="evt"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public void AddTransition(string evt, DeterministicFAState_Subset target)
 {
     Post.Add(evt, target);
 }
Beispiel #10
0
 public void AddTransition(DeterministicFAState_Subset source, string evt, DeterministicFAState_Subset target)
 {
     source.AddTransition(evt, target);
 }