Exemple #1
0
        public MDPStat BuildQuotientMDP(VerificationOutput VerificationOutput)
        {
            //return this;

            MDPStat toReturn = new MDPStat(Precision, MAX_DIFFERENCE);

            //todo change to set
            List <KeyValuePair <string, string> > BoundaryOneTransition = new List <KeyValuePair <string, string> >();

            //todo change to set
            List <DistributionStat> ProbTransitions = new List <DistributionStat>();

            Dictionary <string, List <DistributionStat> > GlobalProbTransitions = new Dictionary <string, List <DistributionStat> >();

            StringDictionary <bool> visited = new StringDictionary <bool>(States.Count);
            List <KeyValuePair <HashSet <string>, MDPStateStat> > sccs = new List <KeyValuePair <HashSet <string>, MDPStateStat> >();

            Dictionary <string, int> preorder = new Dictionary <string, int>();
            Dictionary <string, int> lowlink  = new Dictionary <string, int>();
            //HashSet<string> scc_found = new HashSet<string>();
            Stack <MDPStateStat> TaskStack = new Stack <MDPStateStat>();

            //Dictionary<string, List<string>> OutgoingTransitionTable = new Dictionary<string, List<string>>();
            Stack <MDPStateStat> stepStack = new Stack <MDPStateStat>(1024);

            visited.Add(InitState.ID, false);
            TaskStack.Push(InitState);

            //# Preorder counter
            int preor = 0;

            do
            {
                while (TaskStack.Count > 0)
                {
                    MDPStateStat pair = TaskStack.Peek();
                    string       v    = pair.ID;

                    if (visited.GetContainsKey(v) && visited.GetContainsKey(v))
                    {
                        TaskStack.Pop();
                        continue;
                    }

                    if (!preorder.ContainsKey(v))
                    {
                        preorder.Add(v, preor);
                        preor++;
                    }

                    bool done = true;

                    List <DistributionStat> list         = pair.Distributions;
                    List <MDPStateStat>     nonProbTrans = new List <MDPStateStat>();
                    List <DistributionStat> ProbTrans    = new List <DistributionStat>();

                    for (int i = 0; i < list.Count; i++)
                    {
                        if (list[i].IsTrivial())
                        {
                            nonProbTrans.Add(list[i].States[0].Value);
                        }
                        else
                        {
                            ProbTrans.Add(list[i]);
                        }
                    }

                    if (ProbTrans.Count > 0 && !GlobalProbTransitions.ContainsKey(v))
                    {
                        GlobalProbTransitions.Add(v, ProbTrans);
                        ProbTransitions.AddRange(ProbTrans);
                    }

                    for (int k = nonProbTrans.Count - 1; k >= 0; k--)
                    {
                        MDPStateStat step = nonProbTrans[k];
                        string       tmp  = step.ID;

                        if (visited.ContainsKey(tmp))
                        {
                            //if this node is still not visited
                            if (!preorder.ContainsKey(tmp))
                            {
                                //only put the first one to the work list stack.
                                //if there are more than one node to be visited,
                                //simply ignore them and keep its event step in the list.
                                if (done)
                                {
                                    TaskStack.Push(step);
                                    done = false;
                                }
                            }
                        }
                        else
                        {
                            visited.Add(tmp, false);
                            //OutgoingTransitionTable.Add(tmp, new List<string>(8));

                            //only put the first one into the stack.
                            if (done)
                            {
                                TaskStack.Push(step);
                                done = false;
                            }
                        }
                    }

                    if (done)
                    {
                        int lowlinkV  = preorder[v];
                        int preorderV = preorder[v];

                        bool selfLoop = false;
                        for (int j = 0; j < nonProbTrans.Count; j++)
                        {
                            string w = nonProbTrans[j].ID;

                            if (w == v)
                            {
                                selfLoop = true;
                            }

                            if (!visited.GetContainsKey(w))
                            {
                                if (preorder[w] > preorderV)
                                {
                                    lowlinkV = Math.Min(lowlinkV, lowlink[w]);
                                }
                                else
                                {
                                    lowlinkV = Math.Min(lowlinkV, preorder[w]);
                                }
                            }
                            else //in this case, there is a tau transition leading to an SCC; must add the transition into the toReturn automaton
                            {
                                BoundaryOneTransition.Add(new KeyValuePair <string, string>(v, w));
                            }
                        }

                        lowlink[v] = lowlinkV;

                        TaskStack.Pop();

                        HashSet <string> scc = new HashSet <string>();

                        if (lowlinkV == preorderV)
                        {
                            scc.Add(v);
                            visited.SetValue(v, true);

                            while (stepStack.Count > 0 && preorder[stepStack.Peek().ID] > preorderV)
                            {
                                string s = stepStack.Pop().ID;

                                scc.Add(s);
                                visited.SetValue(s, true);
                            }

                            MDPStateStat newstate = new MDPStateStat(toReturn.States.Count.ToString());
                            if (scc.Count > 1 || (scc.Count == 1 && selfLoop))
                            {
                                newstate.AddDistribution(new DistributionStat(Constants.TAU, newstate)); //add self loop: sun jun
                            }
                            sccs.Add(new KeyValuePair <HashSet <string>, MDPStateStat>(scc, newstate));

                            toReturn.AddState(newstate);

                            if (scc.Contains(InitState.ID))
                            {
                                toReturn.SetInit(newstate);
                            }

                            foreach (MDPStateStat state in TargetStates)
                            {
                                if (scc.Contains(state.ID))
                                {
                                    toReturn.AddTargetStates(newstate);
                                }
                            }
                        }
                        else
                        {
                            stepStack.Push(pair);
                        }
                    }
                }

                if (ProbTransitions.Count > 0)
                {
                    foreach (DistributionStat step in ProbTransitions)
                    {
                        foreach (KeyValuePair <double, MDPStateStat> pair in step.States)
                        {
                            string stateID = pair.Value.ID;
                            if (!visited.ContainsKey(stateID))
                            {
                                TaskStack.Push(pair.Value);
                                visited.Add(stateID, false);
                            }
                        }
                    }
                    ProbTransitions.Clear();
                }
            } while (TaskStack.Count > 0);


            foreach (KeyValuePair <string, string> pair in BoundaryOneTransition)
            {
                MDPStateStat source = null;
                MDPStateStat target = null;

                foreach (KeyValuePair <HashSet <string>, MDPStateStat> sccstate in sccs)
                {
                    if (sccstate.Key.Contains(pair.Key))
                    {
                        source = sccstate.Value;
                    }

                    if (sccstate.Key.Contains(pair.Value))
                    {
                        target = sccstate.Value;
                    }
                }

                toReturn.AddDistribution(source.ID, new DistributionStat(Constants.TAU, target));
                VerificationOutput.ReducedMDPTransitions++;
            }

            foreach (KeyValuePair <string, List <DistributionStat> > pair in GlobalProbTransitions)
            {
                MDPStateStat source = null;

                foreach (KeyValuePair <HashSet <string>, MDPStateStat> sccstate in sccs)
                {
                    if (sccstate.Key.Contains(pair.Key))
                    {
                        source = sccstate.Value;
                        break;
                    }
                }

                foreach (DistributionStat distribution in pair.Value)
                {
                    DistributionStat disNew = new DistributionStat(distribution.Event);
                    foreach (KeyValuePair <double, MDPStateStat> state in distribution.States)
                    {
                        foreach (KeyValuePair <HashSet <string>, MDPStateStat> sccstate in sccs)
                        {
                            if (sccstate.Key.Contains(state.Value.ID))
                            {
                                disNew.AddProbStatePair(state.Key, sccstate.Value);
                                VerificationOutput.ReducedMDPTransitions++;
                                break;
                            }
                        }
                    }

                    toReturn.AddDistribution(source.ID, disNew);
                }
            }
            VerificationOutput.ReducedMDPStates = toReturn.States.Count;
            return(toReturn);
        }
Exemple #2
0
        public MDPStat BuildQuotientMDPBisimulation(VerificationOutput VerificationOutput)
        {
            MDPStat toReturn = new MDPStat(Precision, MAX_DIFFERENCE);

            //calculate the nonsafe states, whose maximal prob is not 0
            Stack<MDPStateStat> NonSafe = new Stack<MDPStateStat>(TargetStates);
            Stack<MDPStateStat> helper = new Stack<MDPStateStat>(TargetStates);

            //backward checking from target states
            while (helper.Count != 0)
            {
                MDPStateStat t = helper.Pop();
                foreach (MDPStateStat s in t.Pre)
                {
                    bool addState = false;

                    //check each distribution; as long as s has a post state in NonSafe, then s should be added.
                    foreach (DistributionStat distribution in s.Distributions)
                    {
                        foreach (KeyValuePair<double, MDPStateStat> pair in distribution.States)
                        {
                            if (NonSafe.Contains(pair.Value))
                            {
                                addState = true;
                                //s.Distributions.Remove(distribution);
                                break;
                            }
                        }

                        if (addState)
                        {
                            break;
                        }
                    }

                    if (addState && !NonSafe.Contains(s))
                    {
                        helper.Push(s);
                        NonSafe.Push(s);
                    }

                }
            }

            //note here remaining doesn't include the target states and initial states
            HashSet<MDPStateStat> remaining = new HashSet<MDPStateStat>();
            foreach (MDPStateStat mdpState in NonSafe)
            {
                if (!TargetStates.Contains(mdpState) && InitState != mdpState)
                {
                    remaining.Add(mdpState);
                }
            }

            //add Initial
            MDPStateStat Initial = new MDPStateStat(InitState.ID);
            toReturn.AddState(Initial);
            toReturn.SetInit(Initial);

            //add target
            MDPStateStat Target = new MDPStateStat("target");
            toReturn.AddState(Target);
            toReturn.AddTargetStates(Target);

            //add safe
            MDPStateStat Safe = new MDPStateStat("safe");
            toReturn.AddState(Safe);

            //add remaining
            //MDPStateStat Remaining = new MDPStateStat("remaining");
            //toReturn.AddState(Remaining);

            //add selfloop at Target.
            //Target.AddDistribution(new DistributionStat(Constants.TAU, Target));

            //add selfloop at Safe.
            //Safe.AddDistribution(new DistributionStat(Constants.TAU, Safe));

            //add the group distributions in Remaining

            List<HashSet<MDPStateStat>> SeperatingRemaining = new List<HashSet<MDPStateStat>>();

            SeperatingRemaining.Add(remaining);

            bool refinement = true;
            while (refinement)
            {
                refinement = false;

                for (int i = 0; i < SeperatingRemaining.Count; i++)
                {
                    HashSet<MDPStateStat> mdpStates = SeperatingRemaining[i];

                    if (mdpStates.Count > 1)
                    {
                        Dictionary<string, HashSet<MDPStateStat>> groups = SeperateGroup(SeperatingRemaining, mdpStates, Initial, Target, Safe);

                        if (groups.Count > 1)
                        {
                            SeperatingRemaining.RemoveAt(i--);

                            foreach (KeyValuePair<string, HashSet<MDPStateStat>> keyValuePair in groups)
                            {
                                SeperatingRemaining.Add(keyValuePair.Value);
                            }

                            refinement = true;
                        }
                    }
                }
                //List<HashSet<MDPStateStat>> NewSeperating = new List<HashSet<MDPStateStat>>();

                //foreach (HashSet<MDPStateStat> mdpStates in SeperatingRemaining)
                //{

                //    if (mdpStates.Count > 1)
                //        {
                //            int counter = 0;

                //            foreach (HashSet<MDPStateStat> grouped in SeperateGroup(SeperatingRemaining, mdpStates, Initial, Target, Safe).Values)
                //            {
                //                counter++;
                //                NewSeperating.Add(grouped);
                //            }

                //            if (counter > 1)
                //            {
                //                refinement = true;
                //            }

                //        }
                //        else
                //        {
                //            NewSeperating.Add(mdpStates);
                //        }
                //    }

                ////todo: reduce the loop number
                //SeperatingRemaining = NewSeperating;

            }

            //add distributions after all the refinement
            foreach (HashSet<MDPStateStat> mdpStates in SeperatingRemaining)
            {
                MDPStateStat Grouped = StateFromHashset(mdpStates);
                //MDPStateStat Grouped = mdpStates[0];
                toReturn.AddState(new MDPStateStat(Grouped.ID));
                //FinalgroupedDistribution(SeperatingRemaining, mdpStates, Target, Safe, toReturn);
            }

            foreach (HashSet<MDPStateStat> mdpStates in SeperatingRemaining)
            {
                FinalgroupedDistribution(SeperatingRemaining, mdpStates, Target, Safe, toReturn);
            }

            //note: add initial state's distributions after refinement
            FinalgroupedDistribution(SeperatingRemaining, InitState, Target, Safe, toReturn);
            return toReturn;
        }
Exemple #3
0
        public MDPStat BuildQuotientMDPBisimulation(VerificationOutput VerificationOutput)
        {
            MDPStat toReturn = new MDPStat(Precision, MAX_DIFFERENCE);

            //calculate the nonsafe states, whose maximal prob is not 0
            Stack <MDPStateStat> NonSafe = new Stack <MDPStateStat>(TargetStates);
            Stack <MDPStateStat> helper  = new Stack <MDPStateStat>(TargetStates);

            //backward checking from target states
            while (helper.Count != 0)
            {
                MDPStateStat t = helper.Pop();
                foreach (MDPStateStat s in t.Pre)
                {
                    bool addState = false;

                    //check each distribution; as long as s has a post state in NonSafe, then s should be added.
                    foreach (DistributionStat distribution in s.Distributions)
                    {
                        foreach (KeyValuePair <double, MDPStateStat> pair in distribution.States)
                        {
                            if (NonSafe.Contains(pair.Value))
                            {
                                addState = true;
                                //s.Distributions.Remove(distribution);
                                break;
                            }
                        }

                        if (addState)
                        {
                            break;
                        }
                    }

                    if (addState && !NonSafe.Contains(s))
                    {
                        helper.Push(s);
                        NonSafe.Push(s);
                    }
                }
            }

            //note here remaining doesn't include the target states and initial states
            HashSet <MDPStateStat> remaining = new HashSet <MDPStateStat>();

            foreach (MDPStateStat mdpState in NonSafe)
            {
                if (!TargetStates.Contains(mdpState) && InitState != mdpState)
                {
                    remaining.Add(mdpState);
                }
            }

            //add Initial
            MDPStateStat Initial = new MDPStateStat(InitState.ID);

            toReturn.AddState(Initial);
            toReturn.SetInit(Initial);

            //add target
            MDPStateStat Target = new MDPStateStat("target");

            toReturn.AddState(Target);
            toReturn.AddTargetStates(Target);

            //add safe
            MDPStateStat Safe = new MDPStateStat("safe");

            toReturn.AddState(Safe);

            //add remaining
            //MDPStateStat Remaining = new MDPStateStat("remaining");
            //toReturn.AddState(Remaining);

            //add selfloop at Target.
            //Target.AddDistribution(new DistributionStat(Constants.TAU, Target));

            //add selfloop at Safe.
            //Safe.AddDistribution(new DistributionStat(Constants.TAU, Safe));

            //add the group distributions in Remaining

            List <HashSet <MDPStateStat> > SeperatingRemaining = new List <HashSet <MDPStateStat> >();

            SeperatingRemaining.Add(remaining);

            bool refinement = true;

            while (refinement)
            {
                refinement = false;

                for (int i = 0; i < SeperatingRemaining.Count; i++)
                {
                    HashSet <MDPStateStat> mdpStates = SeperatingRemaining[i];

                    if (mdpStates.Count > 1)
                    {
                        Dictionary <string, HashSet <MDPStateStat> > groups = SeperateGroup(SeperatingRemaining, mdpStates, Initial, Target, Safe);

                        if (groups.Count > 1)
                        {
                            SeperatingRemaining.RemoveAt(i--);

                            foreach (KeyValuePair <string, HashSet <MDPStateStat> > keyValuePair in groups)
                            {
                                SeperatingRemaining.Add(keyValuePair.Value);
                            }

                            refinement = true;
                        }
                    }
                }
                //List<HashSet<MDPStateStat>> NewSeperating = new List<HashSet<MDPStateStat>>();

                //foreach (HashSet<MDPStateStat> mdpStates in SeperatingRemaining)
                //{

                //    if (mdpStates.Count > 1)
                //        {
                //            int counter = 0;

                //            foreach (HashSet<MDPStateStat> grouped in SeperateGroup(SeperatingRemaining, mdpStates, Initial, Target, Safe).Values)
                //            {
                //                counter++;
                //                NewSeperating.Add(grouped);
                //            }

                //            if (counter > 1)
                //            {
                //                refinement = true;
                //            }

                //        }
                //        else
                //        {
                //            NewSeperating.Add(mdpStates);
                //        }
                //    }


                ////todo: reduce the loop number
                //SeperatingRemaining = NewSeperating;
            }


            //add distributions after all the refinement
            foreach (HashSet <MDPStateStat> mdpStates in SeperatingRemaining)
            {
                MDPStateStat Grouped = StateFromHashset(mdpStates);
                //MDPStateStat Grouped = mdpStates[0];
                toReturn.AddState(new MDPStateStat(Grouped.ID));
                //FinalgroupedDistribution(SeperatingRemaining, mdpStates, Target, Safe, toReturn);
            }

            foreach (HashSet <MDPStateStat> mdpStates in SeperatingRemaining)
            {
                FinalgroupedDistribution(SeperatingRemaining, mdpStates, Target, Safe, toReturn);
            }

            //note: add initial state's distributions after refinement
            FinalgroupedDistribution(SeperatingRemaining, InitState, Target, Safe, toReturn);
            return(toReturn);
        }
Exemple #4
0
        public MDPStat BuildQuotientMDP(VerificationOutput VerificationOutput)
        {
            //return this;

            MDPStat toReturn = new MDPStat(Precision, MAX_DIFFERENCE);

            //todo change to set
            List<KeyValuePair<string, string>> BoundaryOneTransition = new List<KeyValuePair<string, string>>();

            //todo change to set
            List<DistributionStat> ProbTransitions = new List<DistributionStat>();

            Dictionary<string, List<DistributionStat>> GlobalProbTransitions = new Dictionary<string, List<DistributionStat>>();

            StringDictionary<bool> visited = new StringDictionary<bool>(States.Count);
            List<KeyValuePair<HashSet<string>, MDPStateStat>> sccs = new List<KeyValuePair<HashSet<string>, MDPStateStat>>();

            Dictionary<string, int> preorder = new Dictionary<string, int>();
            Dictionary<string, int> lowlink = new Dictionary<string, int>();
            //HashSet<string> scc_found = new HashSet<string>();
            Stack<MDPStateStat> TaskStack = new Stack<MDPStateStat>();

            //Dictionary<string, List<string>> OutgoingTransitionTable = new Dictionary<string, List<string>>();
            Stack<MDPStateStat> stepStack = new Stack<MDPStateStat>(1024);

            visited.Add(InitState.ID, false);
            TaskStack.Push(InitState);

            //# Preorder counter
            int preor = 0;

            do
            {
                while (TaskStack.Count > 0)
                {
                    MDPStateStat pair = TaskStack.Peek();
                    string v = pair.ID;

                    if (visited.GetContainsKey(v) && visited.GetContainsKey(v))
                    {
                        TaskStack.Pop();
                        continue;
                    }

                    if (!preorder.ContainsKey(v))
                    {
                        preorder.Add(v, preor);
                        preor++;
                    }

                    bool done = true;

                    List<DistributionStat> list = pair.Distributions;
                    List<MDPStateStat> nonProbTrans = new List<MDPStateStat>();
                    List<DistributionStat> ProbTrans = new List<DistributionStat>();

                    for (int i = 0; i < list.Count; i++)
                    {
                        if (list[i].IsTrivial())
                        {
                            nonProbTrans.Add(list[i].States[0].Value);
                        }
                        else
                        {
                            ProbTrans.Add(list[i]);
                        }
                    }

                    if (ProbTrans.Count > 0 && !GlobalProbTransitions.ContainsKey(v))
                    {
                        GlobalProbTransitions.Add(v, ProbTrans);
                        ProbTransitions.AddRange(ProbTrans);
                    }

                    for (int k = nonProbTrans.Count - 1; k >= 0; k--)
                    {
                        MDPStateStat step = nonProbTrans[k];
                        string tmp = step.ID;

                        if (visited.ContainsKey(tmp))
                        {
                            //if this node is still not visited
                            if (!preorder.ContainsKey(tmp))
                            {
                                //only put the first one to the work list stack.
                                //if there are more than one node to be visited,
                                //simply ignore them and keep its event step in the list.
                                if (done)
                                {
                                    TaskStack.Push(step);
                                    done = false;
                                }
                            }
                        }
                        else
                        {
                            visited.Add(tmp, false);
                            //OutgoingTransitionTable.Add(tmp, new List<string>(8));

                            //only put the first one into the stack.
                            if (done)
                            {
                                TaskStack.Push(step);
                                done = false;
                            }
                        }
                    }

                    if (done)
                    {
                        int lowlinkV = preorder[v];
                        int preorderV = preorder[v];

                        bool selfLoop = false;
                        for (int j = 0; j < nonProbTrans.Count; j++)
                        {
                            string w = nonProbTrans[j].ID;

                            if (w == v)
                            {
                                selfLoop = true;
                            }

                            if (!visited.GetContainsKey(w))
                            {
                                if (preorder[w] > preorderV)
                                {
                                    lowlinkV = Math.Min(lowlinkV, lowlink[w]);
                                }
                                else
                                {
                                    lowlinkV = Math.Min(lowlinkV, preorder[w]);
                                }
                            }
                            else //in this case, there is a tau transition leading to an SCC; must add the transition into the toReturn automaton
                            {
                                BoundaryOneTransition.Add(new KeyValuePair<string, string>(v, w));
                            }
                        }

                        lowlink[v] = lowlinkV;

                        TaskStack.Pop();

                        HashSet<string> scc = new HashSet<string>();

                        if (lowlinkV == preorderV)
                        {
                            scc.Add(v);
                            visited.SetValue(v, true);

                            while (stepStack.Count > 0 && preorder[stepStack.Peek().ID] > preorderV)
                            {
                                string s = stepStack.Pop().ID;

                                scc.Add(s);
                                visited.SetValue(s, true);
                            }

                            MDPStateStat newstate = new MDPStateStat(toReturn.States.Count.ToString());
                            if (scc.Count > 1 || (scc.Count == 1 && selfLoop))
                            {
                                newstate.AddDistribution(new DistributionStat(Constants.TAU, newstate)); //add self loop: sun jun
                            }
                            sccs.Add(new KeyValuePair<HashSet<string>, MDPStateStat>(scc, newstate));

                            toReturn.AddState(newstate);

                            if (scc.Contains(InitState.ID))
                            {
                                toReturn.SetInit(newstate);
                            }

                            foreach (MDPStateStat state in TargetStates)
                            {
                                if (scc.Contains(state.ID))
                                {
                                    toReturn.AddTargetStates(newstate);
                                }
                            }
                        }
                        else
                        {
                            stepStack.Push(pair);
                        }
                    }
                }

                if (ProbTransitions.Count > 0)
                {
                    foreach (DistributionStat step in ProbTransitions)
                    {
                        foreach (KeyValuePair<double, MDPStateStat> pair in step.States)
                        {
                            string stateID = pair.Value.ID;
                            if (!visited.ContainsKey(stateID))
                            {
                                TaskStack.Push(pair.Value);
                                visited.Add(stateID, false);
                            }
                        }
                    }
                    ProbTransitions.Clear();
                }
            } while (TaskStack.Count > 0);

            foreach (KeyValuePair<string, string> pair in BoundaryOneTransition)
            {
                MDPStateStat source = null;
                MDPStateStat target = null;

                foreach (KeyValuePair<HashSet<string>, MDPStateStat> sccstate in sccs)
                {
                    if (sccstate.Key.Contains(pair.Key))
                    {
                        source = sccstate.Value;
                    }

                    if (sccstate.Key.Contains(pair.Value))
                    {
                        target = sccstate.Value;
                    }
                }

                toReturn.AddDistribution(source.ID, new DistributionStat(Constants.TAU, target));
                VerificationOutput.ReducedMDPTransitions++;

            }

            foreach (KeyValuePair<string, List<DistributionStat>> pair in GlobalProbTransitions)
            {
                MDPStateStat source = null;

                foreach (KeyValuePair<HashSet<string>, MDPStateStat> sccstate in sccs)
                {
                    if (sccstate.Key.Contains(pair.Key))
                    {
                        source = sccstate.Value;
                        break;
                    }
                }

                foreach (DistributionStat distribution in pair.Value)
                {
                    DistributionStat disNew = new DistributionStat(distribution.Event);
                    foreach (KeyValuePair<double, MDPStateStat> state in distribution.States)
                    {
                        foreach (KeyValuePair<HashSet<string>, MDPStateStat> sccstate in sccs)
                        {
                            if (sccstate.Key.Contains(state.Value.ID))
                            {
                                disNew.AddProbStatePair(state.Key, sccstate.Value);
                                VerificationOutput.ReducedMDPTransitions++;
                                break;
                            }
                        }
                    }

                    toReturn.AddDistribution(source.ID, disNew);
                }
            }
            VerificationOutput.ReducedMDPStates = toReturn.States.Count;
            return toReturn;
        }