private static void generator10_priemer(GeneratorSeed seed)
        {
            //VYGENEROVANY TYP OPRAVY
            Duration[] d3 =
            {
                new Duration(0, 0, 0.7), new Duration(0, 0, 0.2), new Duration(0, 0, 0.1)
            };
            IGenerators[] generators =
            {
                new UniformDiscreteDistribution(seed.GetRandomSeed(),                                                                            2,  20),
                new DiscreteEmpiricalDistribution(seed,
                                                  new[] { new Duration(10,                                                                      40, 0.1),new Duration(41,       61, 0.6), new Duration(62, 100, 0.3) }),
                new UniformDiscreteDistribution(seed.GetRandomSeed(),                                                                          120, 260)
            };

            var gen10   = new DiscreteEmpiricalDistribution(seed, d3, generators);
            var sucet   = 0;
            var numbers = 10000000;

            for (var i = 0; i < numbers; i++)
            {
                sucet += gen10.GenerateInt();
            }

            Console.WriteLine((double)sucet / numbers);
        }
Beispiel #2
0
        public AutoserviceGenerators()
        {
            var seed = new GeneratorSeed();

            _gen1 = new ExponencionalDistribution(seed.GetRandomSeed(), 300);
            _gen2 = new DiscreteEmpiricalDistribution(seed, new[]
            {
                new Duration(1, 1, 0.4), new Duration(2, 2, 0.15), new Duration(3, 3, 0.14), new Duration(4, 4, 0.12),
                new Duration(5, 5, 0.1), new Duration(6, 6, 0.09)
            });

            _gen3 = new UniformContinuousDistribution(seed.GetRandomSeed(), 70, 310);
            _gen4 = new UniformContinuousDistribution(seed.GetRandomSeed(), 80, 160);
            _gen5 = new TriangleUniformDistribution(seed.GetRandomSeed(), 120, 540, 240);
            _gen6 = new UniformContinuousDistribution(seed.GetRandomSeed(), 123, 257);
            _gen7 = new DiscreteEmpiricalDistribution(seed, new[]
            {
                new Duration(0, 0, 0.7), new Duration(0, 0, 0.2), new Duration(0, 0, 0.1)
            }, new IGenerators[]
            {
                new UniformDiscreteDistribution(seed.GetRandomSeed(), 2, 20),
                new DiscreteEmpiricalDistribution(seed,
                                                  new[] { new Duration(10, 40, 0.1), new Duration(41, 61, 0.6), new Duration(62, 100, 0.3) }),
                new UniformDiscreteDistribution(seed.GetRandomSeed(), 120, 260)
            });
        }
Beispiel #3
0
        public AutoserviceGenerators(int gen1,
                                     double gen213,
                                     double gen223,
                                     double gen233,
                                     double gen243,
                                     double gen253,
                                     double gen263,
                                     int gen31, int gen32,
                                     int gen41, int gen42,
                                     int gen51, int gen52, int gen53,
                                     int gen61, int gen62,
                                     double gen71, double gen72, double gen73,
                                     int gen711, int gen712,
                                     int gen721, int gen722, double gen723,
                                     int gen731, int gen732, double gen733,
                                     int gen741, int gen742, double gen743,
                                     int gen751, int gen752
                                     )
        {
            var seed = new GeneratorSeed();

            _gen1 = new ExponencionalDistribution(seed.GetRandomSeed(), gen1);
            _gen2 = new DiscreteEmpiricalDistribution(seed, new[]
            {
                new Duration(1, 1, gen213),
                new Duration(2, 2, gen223),
                new Duration(3, 3, gen233),
                new Duration(4, 4, gen243),
                new Duration(5, 5, gen253),
                new Duration(6, 6, gen263)
            });

            _gen3 = new UniformContinuousDistribution(seed.GetRandomSeed(), gen31, gen32);
            _gen4 = new UniformContinuousDistribution(seed.GetRandomSeed(), gen41, gen42);
            _gen5 = new TriangleUniformDistribution(seed.GetRandomSeed(), gen51, gen52, gen53);
            _gen6 = new UniformContinuousDistribution(seed.GetRandomSeed(), gen61, gen62);
            _gen7 = new DiscreteEmpiricalDistribution(seed, new[]
            {
                new Duration(0, 0, gen71), new Duration(0, 0, gen72), new Duration(0, 0, gen73)
            }, new IGenerators[]
            {
                new UniformDiscreteDistribution(seed.GetRandomSeed(), gen711, gen712),
                new DiscreteEmpiricalDistribution(seed,
                                                  new[]
                {
                    new Duration(gen721, gen722, gen723), new Duration(gen731, gen732, gen733),
                    new Duration(gen741, gen742, gen743)
                }),
                new UniformDiscreteDistribution(seed.GetRandomSeed(), gen751, gen752)
            });
        }
        private static void generator8(GeneratorSeed seed)
        {
            //STREDNE TAZKA OPRAVA
            //diskretne empiricke
            // T:   10-40       41-61       62-100
            // p:   0.1         0.6         0.3
            Duration[] d2 =
            {
                new Duration(10, 40, 0.1), new Duration(41, 61, 0.6), new Duration(62, 100, 0.3)
            };
            var gen8 = new DiscreteEmpiricalDistribution(seed, d2);

            TestDistributionsToFileInt(gen8, "generator_8_empiricke.dst");
        }
        private static void generator2(GeneratorSeed seed)
        {
            //Pravdepodobnosti poctu oprav, tkore bude zakaznik pozadovat
            //pocet oprav       1       2       3       4       5       6
            //pravdepodobnst    0.4     0.15    0.14    0.12    0.1     0.09
            //Empiricke rozdelenie
            Duration[] d =
            {
                new Duration(1, 1, 0.4), new Duration(2, 2, 0.15), new Duration(3, 3, 0.14), new Duration(4, 4, 0.12),
                new Duration(5, 5, 0.1), new Duration(6, 6, 0.09)
            };
            var discPocet_oprav = new DiscreteEmpiricalDistribution(seed, d);

            TestDistributionsToFileInt(discPocet_oprav, "generator_2_empiricke.dst");
        }
        private static void generator10(GeneratorSeed seed)
        {
            //VYGENEROVANY TYP OPRAVY
            Duration[] d3 =
            {
                new Duration(0, 0, 0.7), new Duration(0, 0, 0.2), new Duration(0, 0, 0.1)
            };
            IGenerators[] generators =
            {
                new UniformDiscreteDistribution(seed.GetRandomSeed(),                                                                            2,  20),
                new DiscreteEmpiricalDistribution(seed,
                                                  new[] { new Duration(10,                                                                      40, 0.1),new Duration(41,       61, 0.6), new Duration(62, 100, 0.3) }),
                new UniformDiscreteDistribution(seed.GetRandomSeed(),                                                                          120, 260)
            };

            var gen10 = new DiscreteEmpiricalDistribution(seed, d3, generators);

            TestDistributionsToFileInt(gen10, "generator_10_empiricke.dst");
        }