示例#1
0
        /// <summary>
        /// Return strongly connected components
        /// Does not include Event variable
        /// this.transitionsNoEvents is the transtion from reachble states
        /// From Feasible algorithm in the article "LTL Symbolic MC"
        /// [ REFS: 'result', DEREFS:]
        /// </summary>
        /// <param name="model"></param>
        /// <param name="initState"></param>
        /// <param name="finalState"></param>
        /// <returns></returns>
        private CUDDNode SCCHull(Model model, CUDDNode initState, CUDDNode finalState)
        {
            CUDDNode old = CUDD.Constant(0);

            CUDD.Ref(initState);
            CUDDNode New = model.SuccessorsStart(initState, this.transitionsNoEvents);

            //Limit transition to transition of reachable states
            CUDD.Ref(New);
            transitionsNoEvents = CUDD.Function.And(transitionsNoEvents, New);

            //Pruning step: remove states whose succeessors are not belong to that set
            while (!New.Equals(old))
            {
                CUDD.Deref(old);
                CUDD.Ref(New);
                old = New;

                //final state as justice requirement
                //new = (new and J) x R*
                CUDD.Ref(finalState);
                New = model.SuccessorsStart(CUDD.Function.And(New, finalState), this.transitionsNoEvents);

                //while new is not comprised of the set of all successors of new states
                while (true)
                {
                    CUDD.Ref(New, New);
                    CUDDNode temp = CUDD.Function.And(New, model.Successors(New, this.transitionsNoEvents));

                    if (temp.Equals(New))
                    {
                        CUDD.Deref(temp);
                        break;
                    }
                    else
                    {
                        CUDD.Deref(New);
                        New = temp;
                    }
                }

            }

            return New;
        }