예제 #1
0
        /**
         * Perform quotienting using bisimulation
         * @param dra the DRA to be optimized
         * @param printColoring print colorings on std::cerr?
         * @param detailedStates save detailed information on the interals in the state?
         * @param printStats print statistics on std::cerr?
         * @return shared_ptr to the quotiented DRA
         */
        public DRA optimizeBisimulation(DRA dra)
        {
            bool printColoring  = false;
            bool detailedStates = false;
            bool printStats     = false;

            //if (!dra.isCompact()) {dra.makeCompact();}

            List <int> states = new List <int>(dra.size());

            for (int i = 0; i < dra.size(); i++)
            {
                //states[i] = i;
                states.Add(i);
            }

            AcceptanceSignatureContainer  accsig_container = new AcceptanceSignatureContainer(dra);
            AcceptanceSignatureComparator accsig_comp      = new AcceptanceSignatureComparator(accsig_container);


            Coloring coloring = new Coloring(dra, detailedStates);
            // generate initial coloring by running with the
            // different acceptance signature
            Coloring new_coloring = generateColoring(states, coloring, accsig_comp);

            //delete coloring;
            coloring = new_coloring;

            int old_size          = dra.size();
            int initial_partition = coloring.countColors();

            int oldColors;

            do
            {
                oldColors = coloring.countColors();

                ColoredStateComparator cnc = new ColoredStateComparator(coloring, dra);

                Coloring new_coloring_temp = generateColoring(states, coloring, cnc);
                //delete coloring;
                coloring = new_coloring_temp;
            } while (oldColors != coloring.countColors());

            //if (printColoring) {
            //  std::cerr << *coloring << std::endl;
            //}

            DRA dra_new = generateDRAfromColoring(dra, coloring, detailedStates);
            //delete coloring;

            int new_size = dra_new.size();

            //if (printStats) {
            //  std::cerr << "Bisimulation: From (" << old_size << ") To (" << new_size << ") Initial: (" << initial_partition << ")" << std::endl;
            //}
            return(dra_new);
        }
예제 #2
0
        /** 
         * Perform quotienting using bisimulation
         * @param dra the DRA to be optimized
         * @param printColoring print colorings on std::cerr?
         * @param detailedStates save detailed information on the interals in the state?
         * @param printStats print statistics on std::cerr?
         * @return shared_ptr to the quotiented DRA
         */
        public DRA optimizeBisimulation(DRA dra)
        {
            bool printColoring = false;
            bool detailedStates = false;
            bool printStats = false;

            //if (!dra.isCompact()) {dra.makeCompact();}

            List<int> states = new List<int>(dra.size());

            for (int i = 0; i < dra.size(); i++)
            {
                //states[i] = i;
                states.Add(i);
            }

            AcceptanceSignatureContainer accsig_container = new AcceptanceSignatureContainer(dra);
            AcceptanceSignatureComparator accsig_comp = new AcceptanceSignatureComparator(accsig_container);


            Coloring coloring = new Coloring(dra, detailedStates);
            // generate initial coloring by running with the 
            // different acceptance signature
            Coloring new_coloring = generateColoring(states, coloring, accsig_comp);
            //delete coloring;
            coloring = new_coloring;

            int old_size = dra.size();
            int initial_partition = coloring.countColors();

            int oldColors;
            do
            {
                oldColors = coloring.countColors();

                ColoredStateComparator cnc = new ColoredStateComparator(coloring, dra);

                Coloring new_coloring_temp = generateColoring(states, coloring, cnc);
                //delete coloring;
                coloring = new_coloring_temp;
            } while (oldColors != coloring.countColors());

            //if (printColoring) {
            //  std::cerr << *coloring << std::endl;
            //}

            DRA dra_new = generateDRAfromColoring(dra, coloring, detailedStates);
            //delete coloring;

            int new_size = dra_new.size();

            //if (printStats) {
            //  std::cerr << "Bisimulation: From (" << old_size << ") To (" << new_size << ") Initial: (" << initial_partition << ")" << std::endl;
            //}
            return dra_new;
        }