}                                                        //Количество возвращенных заявок

        public ModelController(int nReq, UniformTimeRandomizer recvTimeGen,
                               NormalTimeRandomizer handlTimeGen, DecisionRandomizer lbDecisionRand)
        {
            numRequests = nReq;

            recvTime = new double[numRequests];

            recvTimeGenerator          = recvTimeGen;
            handlTimeGenerator         = handlTimeGen;
            loopBackDecisionRandomizer = lbDecisionRand;

            MAX_QUEUE_LENGTH = nReq;
        }
예제 #2
0
        public void Calculate()
        {
            /*Ввод исходных данных для расчета*/
            double timeStep = Convert.ToDouble(textBox1.Text); //Шаг повремени
            int    numReqs  = Convert.ToInt32(textBox2.Text);  //Число заявок
            double a        = Convert.ToDouble(textBox3.Text);
            double b        = Convert.ToDouble(textBox4.Text);
            double M        = Convert.ToDouble(textBox5.Text);
            double sigma    = Convert.ToDouble(textBox6.Text);
            double retProb  = Convert.ToDouble(textBox7.Text); //Вероятность возврата заявки

            UniformTimeRandomizer recvGen   = new UniformTimeRandomizer(a, b);
            NormalTimeRandomizer  handleGen = new NormalTimeRandomizer(M, sigma);
            DecisionRandomizer    decRand   = new DecisionRandomizer(retProb);

            ModelController modelController = null;

            if (radioButton1.Checked)
            {
                modelController = new TimeModelController(numReqs, recvGen, handleGen, decRand, timeStep);
            }
            else if (radioButton2.Checked)
            {
                textBox1.Visible = false;
                modelController  = new EventModelController(numReqs, recvGen, handleGen, decRand);
            }

            modelController.Initialize();

            while (!modelController.Finished())
            {
                modelController.MoveOn();
            }

            textBox8.Text = modelController.MaxQueueLength.ToString();
        }
 public EventModelController(int nReq, UniformTimeRandomizer recvTimeGen,
                             NormalTimeRandomizer handlTimeGen, DecisionRandomizer lbDecisionRand) :
     base(nReq, recvTimeGen, handlTimeGen, lbDecisionRand)
 {
 }
 public TimeModelController(int nReq, UniformTimeRandomizer recvTimeGen,
                            NormalTimeRandomizer handlTimeGen, DecisionRandomizer lbDecisionRand, double timeStep) :
     base(nReq, recvTimeGen, handlTimeGen, lbDecisionRand)
 {
     TimeStep = timeStep;
 }