示例#1
0
        /// <summary>
        /// Check whether scc is strong fairness.
        /// [ REFS: , DEREFS: ]
        /// </summary>
        /// <param name="scc"></param>
        /// <param name="intersection"></param>
        /// <param name="modelBDD"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        private bool IsWeakFairness(CUDDNode scc, AutomataBDD intersection, AutomataBDD modelBDD, Model model)
        {
            CUDD.CUDD.Ref(intersection.transitionBDD);
            CUDD.CUDD.Ref(scc, scc);
            List <CUDDNode> transitionInSCC = CUDD.CUDD.Function.And(CUDD.CUDD.Function.And(intersection.transitionBDD, scc), model.SwapRowColVars(scc));

            CUDDNode eventHappened = model.GetEventRowInTransition(transitionInSCC);

            //-----------------------------------
            CUDD.CUDD.Ref(modelBDD.transitionBDD);
            CUDD.CUDD.Ref(scc);
            List <CUDDNode> transitionFromSCC = CUDD.CUDD.Function.And(modelBDD.transitionBDD, scc);

            CUDD.CUDD.Ref(transitionFromSCC);
            CUDDNode eventEnabled = model.GetEventRowInTransition(transitionFromSCC);

            //Get all the combination of state in scc and event
            CUDD.CUDD.Ref(scc, eventEnabled);
            CUDDNode complementTransitionFromSCC = CUDD.CUDD.Function.And(scc, model.SwapRowColVars(eventEnabled));

            //
            CUDDVars varsTemp = new CUDDVars();

            varsTemp.AddVars(model.AllColVars);
            varsTemp.RemoveVars(model.GetEventColVars());
            //Get the source state (in scc) and event
            transitionFromSCC = CUDD.CUDD.Abstract.ThereExists(transitionFromSCC, varsTemp);

            complementTransitionFromSCC = CUDD.CUDD.Function.Different(complementTransitionFromSCC, CUDD.CUDD.Function.Or(transitionFromSCC));

            CUDDNode eventNotAllEnabled = model.GetEventRowInTransition(new List <CUDDNode> {
                complementTransitionFromSCC
            });

            CUDDNode eventAllEnabled = CUDD.CUDD.Function.Different(eventEnabled, eventNotAllEnabled);

            bool isWeakFairness = CUDD.CUDD.IsSubSet(eventHappened, eventAllEnabled);

            if (isWeakFairness)
            {
                //Must assign this.eventMushHappen to eventHappened to make sure that all enabled events will happen.
                //In some case though the eventAllEnable is empty but if this.evenMustHappen = eventAllEnable, the scc is not restricted
                //and a small part of this scc is explored, so in this small part, the eventAllEnable may be not empty.
                CUDD.CUDD.Ref(eventHappened);
                CUDD.CUDD.Deref(this.eventMustHappen);
                this.eventMustHappen = eventHappened;

                CUDD.CUDD.Ref(scc);
                CUDD.CUDD.Deref(this.scc);
                this.scc = scc;
            }

            //
            CUDD.CUDD.Deref(eventHappened, eventAllEnabled);

            return(isWeakFairness);
        }
示例#2
0
        /// <summary>
        /// Get the column variable value (after transition) from BDD configuration. This value must be added with Lowerbound value. See the Variable Expression
        /// implementation
        /// [ REFS: '', DEREFS: '']
        /// </summary>
        public int GetColVarValue(CUDDNode currentStateDD, string variableName)
        {
            CUDDVars notSelectedVariables = new CUDDVars();

            notSelectedVariables.AddVars(this.AllColVars);
            notSelectedVariables.RemoveVars(this.GetColVars(variableName));

            CUDD.Ref(currentStateDD);
            CUDDNode selectedEventDD = CUDD.Abstract.ThereExists(currentStateDD, notSelectedVariables);
            int      selectedEvent   = CUDD.MinTermToInt(selectedEventDD, this.GetColVars(variableName));

            CUDD.Deref(selectedEventDD);

            //
            selectedEvent += this.GetVarLowerBound(variableName);
            return(selectedEvent);
        }
示例#3
0
        /// <summary>
        /// Only find event from period[1]
        /// </summary>
        /// <param name="period"></param>
        /// <returns></returns>
        private CUDDNode GetEventInStates(Model model)
        {
            CUDDNode result = CUDD.CUDD.Constant(0);

            if (period.Count > 1)
            {
                CUDDVars temp = new CUDDVars();
                temp.AddVars(model.AllRowVars);
                temp.RemoveVars(model.GetEventRowVars());

                for (int i = 1; i < period.Count; i++)
                {
                    CUDD.CUDD.Ref(period[i]);
                    result = CUDD.CUDD.Function.Or(result, CUDD.CUDD.Abstract.ThereExists(period[i], temp));
                }
            }

            return(result);
        }