Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Lab 3");
            for (int intensity = 30; intensity > 0; intensity--)
            {
                int delay = intensity;
                var gen   = GenFactory.getGenerator(3, 10, 0, 10);
                var rnd   = new Random();

                var pq = new PriorityQueue(30);
                for (int i = 0; i < 10000; ++i)
                {
                    if (--delay == 0)
                    {
                        gen.MoveNext();
                        pq.addPackageToTheQueu(gen.Current);
                        delay = intensity;
                    }
                    pq.tick();
                }
                int tavrg = pq.aveageTime / pq.packageNumber;

                Console.WriteLine("Середнiй час очiкування вiд iнтенсивностi:");
                Console.WriteLine("Iнтенсивнiсть: " + intensity + " час очiкування: " + tavrg);
                Console.WriteLine("Середнiй час простою вiд iнтенсивностi:");
                Console.WriteLine("Iнтенсивнiсть: " + intensity + " час простою: " + pq.dt / 100);
            }
            {
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            for (int intensity = 30; intensity > 0; intensity--)
            {
                int delay = intensity;
                var gen   = GenFactory.getGenerator(3, 10, 0, 10);
                var rnd   = new Random();

                var pq = new PriorityQueue(30);
                for (int i = 0; i < 10000; ++i)
                {
                    if (--delay == 0)
                    {
                        gen.MoveNext();
                        pq.addPackageToTheQueu(gen.Current);
                        delay = intensity;
                    }
                    pq.tick();
                }
                int tavrg = pq.aveageTime / pq.packageNumber;

                Console.WriteLine("Average time waiting from intensivity:");

                Console.WriteLine("Intensity- " + intensity + " waiting time-" + tavrg);
                Console.WriteLine("Average time of stucking from intensivity:");
                Console.WriteLine("Intensity- " + intensity + " stuck time- " + pq.dt / 100);
            }
            {
            }
        }