Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="a">Label</param>
        /// <param name="B">Block</param>
        private static void OneRound(int a, Block B)
        {
            HashSet <int> remove = B.remove[a];

            B.remove[a] = new HashSet <int>();

            List <int> bPrev = B.states;

            Split(remove);

            //Find set of block D is a subset of Remove, line 15
            List <Block> removeList = new List <Block>();

            tmp = new bool[lts.numStates];
            for (int i = 0; i < lts.numStates; i++)
            {
                tmp[i] = false;
            }

            //tmp[x] if x in remove
            foreach (var x in remove)
            {
                tmp[x] = true;
            }


            //line 15
            foreach (var d in partition)
            {
                bool notChildOfRemove = false;
                foreach (var s in d.states)
                {
                    if (!tmp[s])
                    {
                        notChildOfRemove = true;
                        break;
                    }
                }

                if (!notChildOfRemove)
                {
                    removeList.Add(d);
                }
            }


            //line 14

            //later from state y, we will find the block containing this state
            //this block may contain some state and be used many time.
            //tmp makes sure that each block C is looped 1 time
            tmp = new bool[partition.Count];
            for (int i = 0; i < partition.Count; i++)
            {
                tmp[i] = true;
            }

            foreach (var x in bPrev)
            {
                //state y has transition a to x (in B)
                foreach (var y in lts.dataPre[a][x])
                {
                    //Now C \intersect delta1(a, B) \notempty
                    Block c = GetBlock(y);
                    if (tmp[c.index])
                    {
                        tmp[c.index] = false;

                        foreach (var d in removeList)
                        {
                            if (c.index == d.index)
                            {
                                throw new Exception();
                            }

                            //line 17
                            if (relation.GetRelation(c.index, d.index))
                            {
                                relation.SetRelation(c.index, d.index, false);

                                for (int b = 0; b < lts.numSymbols; b++)
                                {
                                    HashSet <int> vStates = new HashSet <int>();
                                    foreach (var dstate in d.states)
                                    {
                                        foreach (var v in lts.Pre(dstate, b))
                                        {
                                            if (!vStates.Contains(v))
                                            {
                                                vStates.Add(v);

                                                c.relCount.Decr(b, v);

                                                if (c.relCount.IsZero(b, v))
                                                {
                                                    if (c.remove[b].Count == 0)
                                                    {
                                                        NewTask(b, c);
                                                    }

                                                    c.remove[b].Add(v);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }