Exemplo n.º 1
0
        public void StartChecking()
        {
            InitDictionary();

            //This was used to create the final data file.
            Algoritm6 algoritm1 = new Algoritm6();

            algoritm1.MAX_VALUE = 580000;
            algoritm1.Init(17, 19);
            double tempcRes     = CheckAlAfterInit(algoritm1);
            long   zipFsileSize = Compress(new FileInfo("raw.txt"), sb);


            /**
             * Stop Here while debugging to get the final data compress file.
             */


            //This was used to find the best combination for the bitmap size and primary numbers.
            int[] prime = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71 };
            for (algoritm1.MAX_VALUE = 200000;
                 algoritm1.MAX_VALUE < 1300000;
                 algoritm1.MAX_VALUE = algoritm1.MAX_VALUE + 10000)
            {
                double maxresults = 0;

                for (int i = 1; i < prime.Length; i++)
                {
                    for (int j = 1; j < prime.Length; j++)
                    {
                        algoritm1.Init(prime[i], prime[j]);

                        long zipFileSize = Compress(new FileInfo("raw.txt"), sb);

                        if (zipFileSize > 64000)
                        {
                            continue;
                        }

                        Console.WriteLine("i=" + prime[i] + "     j=" + prime[j]);
                        sb.AppendLine("i=" + prime[i] + "     j=" + prime[j]);

                        double tempRes = CheckAlAfterInit(algoritm1);
                        if (zipFileSize != 1 && tempRes > maxresults)
                        {
                            maxresults = tempRes;
                        }
                    }
                }

                sb.AppendLine("maxresults= " + maxresults);

                File.AppendAllText("output_alg3_" + algoritm1.MAX_VALUE + ".txt", sb.ToString());

                sb = new StringBuilder();
            }
        }
Exemplo n.º 2
0
        private double CheckAlAfterInit(Algoritm6 algoritm1)
        {
            int succses       = 0;
            int falseNegative = 0;
            int falsePositive = 0;

            foreach (string key in trueSet.Keys)
            {
                if (algoritm1.IsValidWord(key) == trueSet[key])
                {
                    succses++;
                }
                else
                {
                    if (algoritm1.IsValidWord(key))
                    {
                        falsePositive++;
                    }
                    else
                    {
                        falseNegative++;
                    }
                }
            }

            double results = ((double)succses / trueSet.Count) * 100;
            string res     = results.ToString();

            Console.WriteLine("res = " + res);
            Console.WriteLine("");

            sb.AppendLine("res = " + res);
            sb.AppendLine("");

            return(results);
        }