Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            int    len = 960 + 95;//11 days
            string outputFile;
            string mdServer = "http://scspc417.cs.uwaterloo.ca:23456/TrustedServer/";

            outputFile = ".\\optimal-remoteread";
            LocationInfo li = new LocationInfo("testdrive", "zRTT++dVryOWXJyAM7NM0TuQcu0Y23BgCQfkt7xh2f/Mm+r6c8/XtPTY0xxaF6tPSACJiuACsjotDeNIVyXM8Q==", SynchronizerType.Azure);

            int[] chunkSizes = { 960, 480, 320, 240, 160, 120, 60, 30, 20, 10 };


            foreach (int chunk in chunkSizes)
            {
                NaivePreHeat_remoteread preheat = new NaivePreHeat_remoteread(null, 5, outputFile, chunk, mdServer, li, len);
                List <long>             r       = new List <long>();

                for (int i = 1; i <= 10; i++)
                {
                    r.Add(preheat.PredictOccupancy(960, len).ElementAt(0).getVal());// 11th day
                }
                long   mean = ListExtensions.Mean(r);
                double std  = ListExtensions.StandardDeviation(r);

                StreamWriter results;
                using (results = File.AppendText("avg-ret-time-chunksize.txt"))
                    results.WriteLine("{0} {1} {2}", chunk, mean, std);
            }



            /*
             * outputFile = ".\\smart";
             * SmartPreHeat spreheat = new SmartPreHeat(null, 5, outputFile);
             * spreheat.PredictOccupancy(0, len);
             *
             * CreateDayMax(outputFile, 3);
             * CreateDayMax(outputFile, 4);
             * CreateDayMax(outputFile, 5);
             *
             *
             * outputFile = ".\\optimal";
             * OptimalPreHeat preheat = new OptimalPreHeat(null, 5, outputFile);
             * preheat.PredictOccupancy(0, len);
             *
             * CreateDayMax(outputFile, 3);
             * CreateDayMax(outputFile, 4);
             * CreateDayMax(outputFile, 5);
             *
             *
             * outputFile = ".\\naive";
             * NaivePreHeat npreheat = new NaivePreHeat(null, 5, outputFile);
             * npreheat.PredictOccupancy(0, len);
             *
             * CreateDayMax(outputFile, 3);
             * CreateDayMax(outputFile, 4);
             * CreateDayMax(outputFile, 5);
             *
             */
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            int len =960 + 95;//11 days
            string outputFile;
            string mdServer = "http://scspc417.cs.uwaterloo.ca:23456/TrustedServer/";
            outputFile = ".\\optimal-remoteread";
            LocationInfo li = new LocationInfo("testdrive", "zRTT++dVryOWXJyAM7NM0TuQcu0Y23BgCQfkt7xh2f/Mm+r6c8/XtPTY0xxaF6tPSACJiuACsjotDeNIVyXM8Q==", SynchronizerType.Azure);

            int[] chunkSizes = {960, 480, 320,240,160,120,60,30,20,10};
            
            
            foreach (int chunk in chunkSizes)
            {
                NaivePreHeat_remoteread preheat = new NaivePreHeat_remoteread(null, 5, outputFile, chunk, mdServer , li, len);
                List<long> r= new List<long>();

                for (int i = 1; i <= 10; i++)
                {
                    r.Add(preheat.PredictOccupancy(960, len).ElementAt(0).getVal());// 11th day
                }
                long mean = ListExtensions.Mean(r);
                double std = ListExtensions.StandardDeviation(r);
                
                StreamWriter results;
                using (results = File.AppendText("avg-ret-time-chunksize.txt"))
                    results.WriteLine("{0} {1} {2}", chunk, mean, std);
            }

           

            /*
            outputFile = ".\\smart";
            SmartPreHeat spreheat = new SmartPreHeat(null, 5, outputFile);
            spreheat.PredictOccupancy(0, len);

            CreateDayMax(outputFile, 3);
            CreateDayMax(outputFile, 4);
            CreateDayMax(outputFile, 5);


            outputFile = ".\\optimal";
            OptimalPreHeat preheat = new OptimalPreHeat(null, 5, outputFile);
            preheat.PredictOccupancy(0, len);

            CreateDayMax(outputFile, 3);
            CreateDayMax(outputFile, 4);
            CreateDayMax(outputFile, 5);


            outputFile = ".\\naive";
            NaivePreHeat npreheat = new NaivePreHeat(null, 5, outputFile);
            npreheat.PredictOccupancy(0, len);

            CreateDayMax(outputFile, 3);
            CreateDayMax(outputFile, 4);
            CreateDayMax(outputFile, 5);

            */
            
            

        }