Esempio n. 1
0
        static void Main(string[] args)
        {
            string line2 = "2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443";

            string[] things2 = line2.Split(",");
            int      fool    = things2.Length;

            int[]          primes2 = new int[fool];
            DirectorySetup setup   = new DirectorySetup();

            setup.EnterDirecPath();
            for (int ai = 0; ai < fool; ai++)
            {
                primes2[ai] = int.Parse(things2[ai]);
            }
            Console.WriteLine("Hello World!");
            int foo = 0;

            if (foo == 0)
            {
                RunStuff1 rs1 = new RunStuff1();
                rs1.SetDirecPath(setup.GetDP());
                rs1.DoIt(primes2);

                DataFileMaker dfm = new DataFileMaker();
                dfm.ReadAllRuns();
            }
            else if (foo == 1)
            {
                RunStuff0 rs0 = new RunStuff0();
                rs0.SetDirecPath(setup.GetDP());
                rs0.DoStuff2(1, 3, 15, primes2, 100, 10000);
            }
            else if (foo == 2)
            {
                ParamLoader loadz = new ParamLoader();
                loadz.LoadDirecPath(setup.GetDP());
                loadz.LoadIt(primes2);
            }
        }
Esempio n. 2
0
        public void DoIt(int[] primes2in)
        {
            /*
             * Input format: type d nmin nmax lmin lmax dt dist
             */

            Console.WriteLine("Enter type d nmin nmax lmin lmax dt dist below:");
            line    = Console.ReadLine();
            things  = line.Split(" ");
            type    = int.Parse(things[0]);
            d       = int.Parse(things[1]);
            nmin    = int.Parse(things[2]);
            nmax    = int.Parse(things[3]);
            lmin    = int.Parse(things[4]);
            lmax    = int.Parse(things[5]);
            usedist = bool.Parse(things[7]);
            dt2     = long.Parse(things[6]);
            rss0    = new RunStuff0();
            path2   = direcpath + "\\rubiks\\standard\\cstuff\\runs\\";
            fcount  = Directory.GetFiles(path2, "*", SearchOption.TopDirectoryOnly).Length;
            path    = path2 + "run_" + fcount.ToString() + ".dat";
            nlv     = ((lmax + 1) - lmin) * ((nmax + 1) - nmin);
            tottake = nlv * dt2;
            Console.WriteLine("TOTALTAKE: " + tottake);
            c**t   = 1;
            path4  = direcpath + "\\rubiks\\standard\\cstuff\\dists\\";
            gcount = Directory.GetFiles(path4, "*", SearchOption.TopDirectoryOnly).Length;
            lines  = new string[(nlv * 2) + 1];
            if (usedist)
            {
                lines[0] = "true " + gcount;
                lineos   = new ArrayList();
                line     = "run = " + fcount;
                lineos.Add(line);
                path3 = path4 + "dist_" + gcount.ToString() + ".dat";
            }
            else
            {
                lines[0] = "false";
            }

            for (int zzz = nmin; zzz < nmax + 1; zzz++)
            {
                n = zzz;
                for (int aaa = lmin; aaa < lmax + 1; aaa++)
                {
                    rss0.DoStuff(type, d, n, primes2in, aaa, dt2, usedist);
                    if (usedist)
                    {
                        binos   = rss0.GetBinos2();
                        countos = rss0.GetCountos2();
                        nb      = rss0.GetNB();
                        line    = type.ToString() + " " + d.ToString() + " " + n.ToString() + " " + aaa.ToString() + " " + nb.ToString();
                        lineos.Add(line);
                        for (int ttt = 0; ttt < nb; ttt++)
                        {
                            line = binos[ttt].ToString() + " " + countos[ttt].ToString();
                            lineos.Add(line);
                        }
                    }
                    maxp = rss0.GetMaxPrime();
                    Console.WriteLine("PARAMS: " + type + " " + d + " " + n + " " + aaa + " " + dt2 + " " + rss0.GetMax().ToString());
                    dtper  = dt2 * 1000;
                    dtper /= rss0.GetNT();

                    /*
                     * Run Data Format:
                     * type d n lval nt maxrecl nmaxrecl dt maxprime dtper(us)
                     */
                    line        = type.ToString() + " " + d.ToString() + " " + n.ToString() + " " + aaa.ToString() + " " + rss0.GetNT().ToString() + " " + rss0.GetMax().ToString() + " " + rss0.GetNMax().ToString() + " " + dt2.ToString() + " " + maxp + " " + dtper;
                    lines[c**t] = line;

                    c**t++;
                    line2   = "";
                    bbins2  = rss0.GetBBins2();
                    bbins10 = rss0.GetBBins10();
                    Console.WriteLine("BBINS10L: " + bbins10.Length);

                    line2 = "";
                    for (int bbb = 0; bbb < bbins10.Length; bbb++)
                    {
                        line2 = line2 + bbins10[bbb] + " ";
                    }
                    lines[c**t] = line2;
                    c**t++;
                }
            }
            System.IO.File.WriteAllLines(path, lines);
            if (usedist)
            {
                nl2    = lineos.Count;
                lines2 = new string[nl2];
                for (int bbb = 0; bbb < nl2; bbb++)
                {
                    lines2[bbb] = (string)lineos[bbb];
                }
                System.IO.File.WriteAllLines(path3, lines2);
            }
        }