Exemplo n.º 1
0
        public void Task2()
        {
            var outputParams = new QOutputParams();

            double[] roValues    = new double[] { 0.25, 0.5, 0.75 };
            double   paramLambda = 4;

            double[] imgClientsProbas = new double[3];

            for (int i = 0; i < roValues.Length; i++)
            {
                double paramRo     = roValues[i];
                double paramMi     = paramLambda / paramRo;
                var    queueSystem = new Mm1Continuous(paramMi, paramLambda);
                var    simulator   = new MultiSimulator(queueSystem);
                simulator.RunSim();

                outputParams.AddEntry(simulator.OutputParams);
                imgClientsProbas[i] = simulator.ImgClientServicedProbability;
            }

            string output = Task2Intro;

            output += PrettyPrint(outputParams);
            output += PrettyPrintImgClientProbability(roValues, imgClientsProbas);
            Console.Write(output);
            AllOutput += output;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 1. Symulacja kolejki M/M/1
        /// </summary>
        public void Task1()
        {
            double[] roValues         = new double[] { 0.25, 0.5, 0.75 };
            double   paramLambda      = 4;
            var      outputParams     = new QOutputParams();
            var      p0Points         = new List <List <Point> >();
            var      expectedP0Values = new List <double>();

            for (int i = 0; i < roValues.Length; i++)
            {
                double paramRo = roValues[i];
                double paramMi = paramLambda / paramRo;

                var queueSystem = new Mm1QueueSystem(paramMi, paramLambda);

                var simulator = new MultiSimulator(queueSystem);
                simulator.RunSim();

                outputParams.AddEntry(simulator.OutputParams);
                p0Points.Add(simulator.EventSimulator.P0Points);
                expectedP0Values.Add(simulator.EventSimulator.QueueSystem.ExpectedP0);
            }

            string output = Task1Intro;

            output += PrettyPrint(outputParams);

            SaveP0Points(p0Points);
            output += "\n\nPunkty wykresów zbieżności P0 zapisano w pliku 'p0data.txt' na Pulpicie";

            Console.Write(output);
            AllOutput += output;
        }