private bool hasBetterStatsThan(MySimulation mySimAfterSimulation, double bestAverageWaitingTime, double bestArrivedAfterStartRatio)
        {
            double arrivedAfterStartRatio = mySimAfterSimulation.ArrivedAfterStartRatioSim.Mean();
            double averageWaitingTime     = mySimAfterSimulation.AveragePassengerWaitingTimeSim.Mean();

            return(arrivedAfterStartRatio < bestArrivedAfterStartRatio && averageWaitingTime < bestAverageWaitingTime);
        }
Ejemplo n.º 2
0
        private void ScheduleLineVehiclesStart(int line, List <List <Vehicle> > lineVehicles, List <double>[] lineStartTimes)
        {
            if (lineVehicles[line].Count == 0)
            {
                return;
            }

            MySimulation mySimulation = (MySimulation)MySim;

            MyMessage myMessage = new MyMessage(MySim)
            {
                Addressee = MyAgent.VehicleStartScheduler
            };

            double startTime = mySimulation.HockeyMatchTime - lineStartTimes[line][0];

            for (int vehicleIdx = 0; vehicleIdx < lineVehicles[line].Count; vehicleIdx++)
            {
                if (vehicleIdx != 0)
                {
                    startTime += lineStartTimes[line][vehicleIdx];
                }

                var messageCopy = (MyMessage)myMessage.CreateCopy();
                messageCopy.Vehicle = lineVehicles[line][vehicleIdx];
                messageCopy.Time    = startTime;
                StartContinualAssistant(messageCopy);
            }
        }
Ejemplo n.º 3
0
        private void UpdateSimulationStats(MySimulation sim)
        {
            labelSimLoaderWaiting.Text  = "Average waiting time: " + sim.AgentSkladky.WaitingTimeSimulacia.Mean().ToString("####.00");
            labelSimLoaderQueue.Text    = "Average length of queue: " + sim.AgentSkladky.LengthOfQueueSimulacia.Mean().ToString("####.00");
            labelSimLoadWaitingCar.Text = "Average waiting time per car: " + (sim.AgentSkladky.WaitingTimeSimulacia.Mean() / SelectedCars.Length).ToString("####.00");
            labelSimUsageLA.Text        = "Usage A: " + sim.AgentSkladky.RealWorkingTimeASimulacia.Mean().ToString("P");
            labelSimUsageLB.Text        = "Usage B: " + sim.AgentSkladky.RealWorkingTimeBSimulacia.Mean().ToString("P");

            labelSimUnloaderWaiting.Text      = "Average waiting time: " + sim.AgentStavby.WaitingTimeSimulacia.Mean().ToString("####.00");
            labelSimUnloaderQueue.Text        = "Average length of queue: " + sim.AgentStavby.LengthOfQueueSimulacia.Mean().ToString("####.00");
            labelSimUnloadWaitingTimeCar.Text = "Average waiting time per car: " + (sim.AgentStavby.WaitingTimeSimulacia.Mean() / SelectedCars.Length).ToString("####.00");
            labelSimUsageUA.Text = "Usage A: " + sim.AgentStavby.RealWorkingTimeASimulacia.Mean().ToString("P");
            labelSimUsageUB.Text = "Usage B: " + sim.AgentStavby.RealWorkingTimeBSimulacia.Mean().ToString("P");


            if (sim.AgentSkladky.WaitingTimeSimulacia.SampleSize > 2 && sim.AgentSkladky.RealWorkingTimeBSimulacia.SampleSize > 2 &&
                sim.AgentStavby.LengthOfQueueSimulacia.SampleSize > 2 && sim.AgentSkladky.LengthOfQueueSimulacia.SampleSize > 2)
            {
                labelCILavg.Text    = "Confidence interval: <" + sim.AgentSkladky.WaitingTimeSimulacia.ConfidenceInterval90[0].ToString("####.00") + ";" + sim.AgentSkladky.WaitingTimeSimulacia.ConfidenceInterval90[1].ToString("####.00") + ">";
                labelCIUlength.Text = "Confidence interval: <" + sim.AgentSkladky.LengthOfQueueSimulacia.ConfidenceInterval90[0].ToString("####.00") + ";" + sim.AgentSkladky.LengthOfQueueSimulacia.ConfidenceInterval90[1].ToString("####.00") + ">";
                labelCILA.Text      = "Confidence interval: <" + sim.AgentSkladky.RealWorkingTimeASimulacia.ConfidenceInterval90[0].ToString("P") + ";" + sim.AgentSkladky.RealWorkingTimeASimulacia.ConfidenceInterval90[1].ToString("P") + ">";
                labelCILB.Text      = "Confidence interval: <" + sim.AgentSkladky.RealWorkingTimeBSimulacia.ConfidenceInterval90[0].ToString("P") + ";" + sim.AgentSkladky.RealWorkingTimeBSimulacia.ConfidenceInterval90[1].ToString("P") + ">";

                labelCIUavg.Text    = "Confidence interval: <" + sim.AgentStavby.WaitingTimeSimulacia.ConfidenceInterval90[0].ToString("####.00") + ";" + sim.AgentStavby.WaitingTimeSimulacia.ConfidenceInterval90[1].ToString("####.00") + ">";
                labelCILlength.Text = "Confidence interval: <" + sim.AgentStavby.LengthOfQueueSimulacia.ConfidenceInterval90[0].ToString("####.00") + ";" + sim.AgentStavby.LengthOfQueueSimulacia.ConfidenceInterval90[1].ToString("####.00") + ">";
                labelCIUA.Text      = "Confidence interval: <" + sim.AgentStavby.RealWorkingTimeASimulacia.ConfidenceInterval90[0].ToString("P") + ";" + sim.AgentStavby.RealWorkingTimeASimulacia.ConfidenceInterval90[1].ToString("P") + ">";
            }

            if (!sim.AgentStavby.VykladacBIsDisabled)
            {
                labelCIUB.Text = "Confidence interval: <" + sim.AgentStavby.RealWorkingTimeBSimulacia.ConfidenceInterval90[0].ToString("####.00") + ";" + sim.AgentStavby.RealWorkingTimeBSimulacia.ConfidenceInterval90[1].ToString("####.00") + ">";
            }
        }
 public void Execute(MySimulation simulation)
 {
     if (simulation.generateCustomers == false)
     {
         simulation.generateCustomers = true;
         simulation.logForBakeryRelatedUpdates.Log("Simulation started");
     }
 }
 public BusStop(MySimulation mySimulation, int id, string name, int maxPassengersCount)
 {
     this.mySimulation = mySimulation;
     Name = name;
     MaxPassengersCount = maxPassengersCount;
     Id             = id;
     passengerQueue = new Queue <Passenger>();
 }
 public void Execute(MySimulation simulation)
 {
     if (simulation.bakery.listOfBakers.Count < 9)
     {
         simulation.bakery.HireApprentice(simulation.actualTime);
         simulation.logForBakeryRelatedUpdates.Log(simulation.writer.HiredWriter(simulation.bakery));
     }
 }
        private void CreateVehicles(MySimulation simulation)
        {
            int id = 1;

            id = CreateLineBuses(simulation, id, 0, VehicleType.PublicCarrierVehicle);
            id = CreateLineBuses(simulation, id, 1, VehicleType.PublicCarrierVehicle);
            id = CreateLineBuses(simulation, id, 2, VehicleType.PublicCarrierVehicle);

            id = CreateMicrobuses(simulation, id, VehicleType.PrivateCarrierVehicle);
        }
Ejemplo n.º 8
0
 static async System.Threading.Tasks.Task Main(string[] args)
 {
     var input = new TextInput();
     var gui   = new ConsoleGUI()
     {
         Input = input
     };
     var sim = new MySimulation(gui, input);
     await gui.Start(sim);
 }
Ejemplo n.º 9
0
 public Vehicle(MySimulation mySimulation, int id, VehicleType type, int doorsCount, int capacity, Navigation navigation) :
     base(VehicleState.OnTheBusStop, mySimulation.CurrentTime)
 {
     this.mySimulation = mySimulation;
     this.Navigation   = navigation;
     Type           = type;
     DoorsCount     = doorsCount;
     Capacity       = capacity;
     Id             = id;
     FreeDoorsCount = doorsCount;
     passengers     = new Stack <Passenger>();
 }
        private int CreateLineBuses(MySimulation simulation, int id, int line, VehicleType type)
        {
            foreach (var lineVehicle in simulation.LineVehicles[line])
            {
                var vehicle = new Vehicle(simulation, id, type, busesDoorsCounts[lineVehicle], busesCapacity[lineVehicle],
                                          new Navigation(busStopsMap.StartsOfTheLines[line]));
                LineBuses[line].Add(vehicle);
                id++;
            }

            return(id);
        }
Ejemplo n.º 11
0
 public void SpustiSimulaciuRychlo()
 {
     if (!start && stop && !pouse)
     {
         MySimulation          = new MySimulation(_linkaATyp1, _linkaATyp2, _linkaAMicro, _linkaBTyp1, _linkaBTyp2, _linkaBMicro, _linkaCTyp1, _linkaCTyp2, _linkaCMicro);
         MySimulation._cakanie = _cakanie;
         MySimulation.Fast     = true;
         _thread = new Thread(Simuluj);
         _thread.Start();
         start = true;
         stop  = false;
     }
 }
Ejemplo n.º 12
0
        public MainForm()
        {
            InitializeComponent();
            init();

            this.simulation = new MySimulation(0, hockeyMatchTime - startTime, endTime - startTime);

            // register simulation lifecycle handlers
            simulation.OnSimulationDidFinish(handleSimulationDidFinish);
            simulation.OnSimulationWillStart(handleSimulationWillStart);
            simulation.OnReplicationWillStart(handleReplicationWillStart);
            simulation.OnReplicationDidFinish(handleReplicationDidFinish);
            simulation.OnRefreshUI(handleRefreshUi);
        }
        private int CreateMicrobuses(MySimulation simulation, int id, VehicleType type)
        {
            for (int line = 0; line < simulation.LineMicrobuses.Length; line++)
            {
                int microbusesCount = simulation.LineMicrobuses[line];

                for (int i = 0; i < microbusesCount; i++)
                {
                    var vehicle = new Vehicle(simulation, id, type, 1, 8, new Navigation(busStopsMap.StartsOfTheLines[line]));
                    LineMicrobuses[line].Add(vehicle);
                    id++;
                }
            }
            return(id);
        }
        public FindConfigurationForm()
        {
            InitializeComponent();
            Init();
            simulation = new MySimulation(0, hockeyMatchTime - startTime, endTime - startTime);
            Random seedGenerator = new Random();

            chooseBusTypeRand   = new Random(seedGenerator.Next());
            chooseInterTimeRand = new Random(seedGenerator.Next());
            chooseStartTimeRand = new Random(seedGenerator.Next());

            simulation.OnReplicationDidFinish(simulation =>
            {
                DoOnGuiThread(labelCurrentRep, () =>
                {
                    labelCurrentRep.Text = simulation.CurrentReplication.ToString();
                });
            });
        }
Ejemplo n.º 15
0
 public void Simuluj()
 {
     MySimulation.Manazer   = this;
     MySimulation.CasZapasu = CurrentDateTime.TimeOfDay;
     MySimulation.Simulate(_pocet);
 }
Ejemplo n.º 16
0
 private void updateReplicationStatistics(MySimulation mySimulation)
 {
     updateStatistic(labelAveragePassengerWaitingTimeRep, mySimulation.AveragePassengerWaitingTimeRep);
     updateStatistic(labelArrivedAfterStartRatioRep, mySimulation.ArrivedAfterStartRatioRep);
     updateStatistic(labelAverageVehicleLoadRep, mySimulation.AverageVehicleLoadRep);
 }
Ejemplo n.º 17
0
        private void buttonRun_Click(object sender, System.EventArgs e)
        {
            try
            {
                NumberOfReplications = Int32.Parse(TextBoxReplications.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Enter a valid number of replications", "Invalid format", MessageBoxButtons.OK);
                return;
            }

            try
            {
                GeneratorSeed = Int32.Parse(textBoxSeed.Text);
                // simulation start
                int userSeed = 0;
                if (userSeed > 0 || textBoxSeed.Text != "")
                {
                    Constants.Seed = userSeed;
                }
                else
                {
                    Constants.Seed = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Enter a valid generator seed", "Invalid format", MessageBoxButtons.OK);
                return;
            }
            _first = true;

            DisableChanges();

            Sim = new MySimulation();
            Sim.SetSimSpeed(_interval, _duration);
            Sim.AgentModelu.SelectedCars = SelectedCars;

            System.Action <MySimulation> updateGuiAction     = new System.Action <MySimulation>((s) => UpdateGui(s));
            System.Action <MySimulation> ReplicationFinished = new Action <MySimulation>((s) => UpdateUIAfterReplication());
            System.Action <MySimulation> SimulationFinished  = new Action <MySimulation>((s) => UpdateUIAfterSimulation());
            Sim.OnReplicationDidFinish(simulation => simulation.InvokeAsync(UpdateUIAfterReplication));
            Sim.OnSimulationDidFinish(simulation => simulation.InvokeAsync(UpdateUIAfterSimulation));

            try
            {
                Sim.OnRefreshUI(s => this.Invoke(updateGuiAction, s));
            }
            catch (Exception ex)
            {
                throw ex;
            }

            // 777 600
            Sim.SimulateAsync(NumberOfReplications, 788400);

            DrawChart();
            System.Action <MySimulation> enableChangesAction = new Action <MySimulation>((s) => EnableChanges());
            // nefunguje
            //Sim.OnSimulationDidFinish(s => this.Invoke(enableChangesAction));
        }
Ejemplo n.º 18
0
        private void UpdateGui(MySimulation mySimulation)
        {
            if (!this.checkBoxVizual.Checked)
            {
                this.labelSimTime.Text     = "Simulation time: " + Sim.CurrentTime.ToString("#.000");
                this.labelReplication.Text = "Replication: " + (Sim.CurrentReplication + 1);
                this.labelSimTime.Text     = "Simulation time: " + Sim.CurrentTime.ToString("#.000");
            }
            else
            {
                this.labelSimTime.Text     = "Simulation time: " + Sim.CurrentTime.ToString("#.000");
                this.labelReplication.Text = "Replication: " + Sim.CurrentReplication;
                this.labelQueueLoad.Text   = "Queue at Loader: ";
                if (Sim.AgentSkladky.AutaSkladkaQueue != null && Sim.AgentSkladky.AutaSkladkaQueue.First != null)
                {
                    foreach (var vehicle in Sim.AgentSkladky.AutaSkladkaQueue)
                    {
                        this.labelQueueLoad.Text += vehicle.Name + " ";
                    }
                }

                this.labelLoaderA.Text = !Sim.AgentSkladky.NakladacAIsWorking()
                    ? "Loads Car: Not working"
                    : Sim.AgentSkladky.CarAtLoaderA != null
                        ? ("Loads Car: " + Sim.AgentSkladky.CarAtLoaderA.Name + ": [" +
                           GetProgressOfLoading(Sim.AgentSkladky.CarAtLoaderA)[0].ToString("##.0") + "/" +
                           GetProgressOfLoading(Sim.AgentSkladky.CarAtLoaderA)[1] + "] ")
                        : "Loads Car: Empty";
                this.labelLoaderB.Text = !Sim.AgentSkladky.NakladacBIsWorking()
                    ? "Loads Car: Not working"
                    : Sim.AgentSkladky.CarAtLoaderB != null
                        ? ("Loads Car: " + Sim.AgentSkladky.CarAtLoaderB.Name + ": [" +
                           GetProgressOfLoading(Sim.AgentSkladky.CarAtLoaderB)[0].ToString("##.0") + "/" +
                           GetProgressOfLoading(Sim.AgentSkladky.CarAtLoaderB)[1] + "] ")
                        : "Loads Car: Empty";
                this.labelUnloaderA.Text = !Sim.AgentStavby.VykladacAIsWorking()
                    ? "Unloads Car: Not working"
                    : Sim.AgentStavby.CarAtUnloaderA != null
                        ? ("Unloads Car: " + Sim.AgentStavby.CarAtUnloaderA.Name + ": [" +
                           GetProgressOfUnloading(Sim.AgentStavby.CarAtUnloaderA)[0].ToString("##.0") + "/" +
                           GetProgressOfLoading(Sim.AgentStavby.CarAtUnloaderA)[1] + "] ")
                        : "Unloads Car: Empty";
                this.labelUnloaderB.Text = Sim.AgentStavby.VykladacBIsDisabled
                    ? "Unloads Car: Disabled"
                    : !Sim.AgentStavby.VykladacBIsWorking()
                        ? "Unloads Car: Not working"
                        : Sim.AgentStavby.CarAtUnloaderB != null
                            ? ("Unloads Car: " + Sim.AgentStavby.CarAtUnloaderB.Name + ": [" +
                               GetProgressOfUnloading(Sim.AgentStavby.CarAtUnloaderB)[0].ToString("##.0") + "/" +
                               GetProgressOfLoading(Sim.AgentStavby.CarAtUnloaderB)[1] + "] ")
                            : "Unloads Car: Empty";

                this.labelQueueUnload.Text = "Queue at Unloader: ";
                if (Sim.AgentStavby.AutaStavbaQueue != null && Sim.AgentStavby.AutaStavbaQueue.First != null)
                {
                    foreach (var vehicle in Sim.AgentStavby.AutaStavbaQueue)
                    {
                        labelQueueUnload.Text += vehicle.Name + " ";
                    }
                }

                this.labelMaterialSkladka.Text = Sim.AgentSkladky.MaterialNaSkladke.ToString("####.0");
                this.labelMaterialStavba.Text  = Sim.AgentStavby.MaterialNaStavbe.ToString("####.0");

                this.labelLoaderStatsTime.Text = "Average waiting time: " +
                                                 Sim.AgentSkladky.WaitingTimePerCar.Mean().ToString("####.00");
                this.labelLoaderStatsLen.Text = "Average length of queue: " +
                                                Sim.AgentSkladky.LengthOfQueue.Mean().ToString("####.00");
                this.labelUnloaderStatsTime.Text = "Average waiting time: " +
                                                   Sim.AgentStavby.WaitingTimePerCar.Mean().ToString("####.00");
                this.labelUnloaderStatsLen.Text = "Average length of queue: " +
                                                  Sim.AgentStavby.LengthOfQueue.Mean().ToString("####.00");
            }

            labelTotalAttempts.Text = "Total attempts: " + Sim.AgentStavby.PocetExport;
            if (Sim.AgentStavby.PocetExport > 0)
            {
                _exportRate          = Sim.AgentStavby.PocetUspesnyExport / Sim.AgentStavby.PocetExport;
                labelExportRate.Text = "Successful export rate: " + _exportRate.ToString("P");
            }
            if (Sim.ReplicationCount > 1 && Sim.AgentStavby.OdoberMaterialKumulativny.SampleSize > 1)
            {
                labelConfInterval.Text = "Confidence interval: <" +
                                         Sim.AgentStavby.OdoberMaterialKumulativny.ConfidenceInterval95[0].ToString("P") +
                                         ", " +
                                         mySimulation.AgentStavby.OdoberMaterialKumulativny.ConfidenceInterval95[1]
                                         .ToString("P") + ">";
            }

            //mySimulation.AgentSkladky.UsageLoaderA.

            if (movingPicture.Location.X < 280)
            {
                movingPicture.Location = new Point(
                    movingPicture.Location.X + 5,
                    this.movingPicture.Location.Y);
            }

            if (_first)
            {
                SetupTracing();
                _first = false;
            }

            labelUsageLA.Text = "Usage A: " + Sim.AgentSkladky.RealWorkingTimeA.Mean().ToString("p");
            labelUsageLB.Text = "Usage B: " + Sim.AgentSkladky.RealWorkingTimeB.Mean().ToString("p");
            labelUsageUA.Text = "Usage A: " + Sim.AgentStavby.RealWorkingTimeA.Mean().ToString("p");
            labelUsageUB.Text = "Usage B: " + Sim.AgentStavby.RealWorkingTimeB.Mean().ToString("p");


            storageAStat += Sim.AgentSkladky.MaterialNaSkladke;
            storageBStat += Sim.AgentStavby.MaterialNaStavbe;
            count++;
            if (maxA < storageAStat / count)
            {
                maxA = storageAStat / count;
            }
            if (maxB < storageBStat / count)
            {
                maxB = storageBStat / count;
            }
            if (minA > storageAStat / count)
            {
                minA = storageAStat / count;
            }
            if (minB > storageBStat / count)
            {
                minB = storageBStat / count;
            }
            chart1.ChartAreas[0].AxisY.Maximum = maxA + 30;
            chart1.ChartAreas[0].AxisY.Minimum = minA - 30;
            chart1.Series["StorageA"].Points.AddXY(Sim.CurrentTime, storageAStat / count);
            chart3.ChartAreas[0].AxisY.Maximum = maxB + 30;
            chart3.ChartAreas[0].AxisY.Minimum = minB - 30;
            chart3.Series["StorageB"].Points.AddXY(Sim.CurrentTime, storageBStat / count);

            UpdateCarInfo(_selectedVehicle);
            UpdateSimulationStats(Sim);
        }
Ejemplo n.º 19
0
 public string Execute(MySimulation sim)
 {
     return(sim.TheClinic.Dietitian.GiveAdvice(sim.TheClinic.CurrentClient));
 }
Ejemplo n.º 20
0
 public string Execute(MySimulation sim)
 {
     return(sim.TheClinic.Dietitian.Introduction());
 }
 public string Execute(MySimulation sim)
 {
     sim.simState = new SmoothieState("**SMOOTHIE BAR**", sim.TheClinic.SmoothieBar);
     return("Welcome to the Smoothie Bar. Pick two ingredients for your smoothie");
 }
Ejemplo n.º 22
0
        public static void CarConfig()
        {
            System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            customCulture.NumberFormat.NumberDecimalSeparator = ".";

            System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            string line = "";

            System.IO.StreamReader file = new System.IO.StreamReader("configurationA.txt");

            while ((line = file.ReadLine()) != null)
            {
                int[]        SelectedCars = ToIntArray(line, ',');
                MySimulation ms           = new MySimulation();
                ms.AgentModelu.SelectedCars = SelectedCars;
                ms.SetMaxSimSpeed();
                ms.Simulate(5, 788400);

                using (StreamWriter w = File.AppendText("resultsConfigurationA.txt"))
                {
                    w.WriteLine(line + ", " +
                                ms.AgentSkladky.WaitingTimeSimulacia.Mean().ToString() + ", " +
                                ms.AgentSkladky.LengthOfQueueSimulacia.Mean().ToString() + ", " +
                                (ms.AgentSkladky.WaitingTimeSimulacia.Mean() / SelectedCars.Length).ToString() + ", " +
                                ms.AgentSkladky.RealWorkingTimeASimulacia.Mean().ToString() + ", " +
                                ms.AgentSkladky.RealWorkingTimeBSimulacia.Mean().ToString() + ", " +

                                "<" + ms.AgentSkladky.WaitingTimeSimulacia.ConfidenceInterval90[0].ToString() + ";" + ms.AgentSkladky.WaitingTimeSimulacia.ConfidenceInterval90[1].ToString() + ">" + ", " +
                                "<" + ms.AgentSkladky.LengthOfQueueSimulacia.ConfidenceInterval90[0].ToString() + ";" + ms.AgentSkladky.LengthOfQueueSimulacia.ConfidenceInterval90[1].ToString() + ">" + ", " +
                                "<" + ms.AgentSkladky.RealWorkingTimeASimulacia.ConfidenceInterval90[0].ToString() + ";" + ms.AgentSkladky.RealWorkingTimeASimulacia.ConfidenceInterval90[1].ToString() + ">" + ", " +
                                "<" + ms.AgentSkladky.RealWorkingTimeBSimulacia.ConfidenceInterval90[0].ToString() + ";" + ms.AgentSkladky.RealWorkingTimeBSimulacia.ConfidenceInterval90[1].ToString() + ">" + ", " +

                                ms.AgentStavby.WaitingTimeSimulacia.Mean().ToString() + ", " +
                                ms.AgentStavby.LengthOfQueueSimulacia.Mean().ToString() + ", " +
                                (ms.AgentStavby.WaitingTimeSimulacia.Mean() / SelectedCars.Length).ToString() + ", " +
                                ms.AgentStavby.RealWorkingTimeASimulacia.Mean().ToString() + ", " +
                                //ms.AgentStavby.RealWorkingTimeBSimulacia.Mean().ToString("P") + ", " +

                                "<" + ms.AgentStavby.WaitingTimeSimulacia.ConfidenceInterval90[0].ToString() + ";" + ms.AgentStavby.WaitingTimeSimulacia.ConfidenceInterval90[1].ToString() + ">" + ", " +
                                "<" + ms.AgentStavby.LengthOfQueueSimulacia.ConfidenceInterval90[0].ToString() + ";" + ms.AgentStavby.LengthOfQueueSimulacia.ConfidenceInterval90[1].ToString() + ">" + ", " +
                                "<" + ms.AgentStavby.RealWorkingTimeASimulacia.ConfidenceInterval90[0].ToString() + ";" + ms.AgentStavby.RealWorkingTimeASimulacia.ConfidenceInterval90[1].ToString() + ">" + ", "


                                /*
                                 * if (!ms.AgentStavby.VykladacBIsDisabled)
                                 * {
                                 *  "<"+ms.AgentStavby.RealWorkingTimeBSimulacia.ConfidenceInterval90[0].ToString("####.00") + ";" + ms.AgentStavby.RealWorkingTimeBSimulacia.ConfidenceInterval90[1].ToString("####.00") + ">" + ", "
                                 * }
                                 */
                                )
                    ;
                }



                /*
                 *
                 * using (StreamWriter w = File.AppendText("results.txt"))
                 * {
                 *  w.WriteLine(line + ", " + ms.AgentStavby.OdoberMaterialKumulativny.Mean() + " ");
                 * }
                 *
                 * using (StreamWriter w = File.AppendText("resultsTop.txt"))
                 * {
                 *  if (ms.AgentStavby.OdoberMaterialKumulativny.Mean() >= 0.95)
                 *  {
                 *      w.WriteLine(line + " " + ms.AgentStavby.OdoberMaterialKumulativny.Mean() + ms.AgentModelu.CostOfVehicles().ToString("C") + " ");
                 *  }
                 * }
                 */
            }

            file.Close();
        }
Ejemplo n.º 23
0
        private void handleReplicationDidFinish(Simulation simulation)
        {
            MySimulation mySimulation = (MySimulation)simulation;

            updateSimulationStatistics(mySimulation);
        }
Ejemplo n.º 24
0
 private void updateSimulationStatistics(MySimulation mySimulation)
 {
     updateStatistic(labelAveragePassengerWaitingTimeSim, mySimulation.AveragePassengerWaitingTimeSim);
     updateStatistic(labelArrivedAfterStartRatio, mySimulation.ArrivedAfterStartRatioSim);
     updateStatistic(labelAverageVehicleLoadSim, mySimulation.AverageVehicleLoadSim);
 }
Ejemplo n.º 25
0
 public AgentDopravy(int id, OSPABA.Simulation mySim, Agent parent) :
     base(id, mySim, parent)
 {
     Init();
     _mine = (MySimulation)mySim;
 }
 /// <summary>
 /// Is average waiting time is less than 10 min and average ratio of passengers who arrived at stadium after start of the match is less than 7 %.
 /// </summary>
 /// <param name="mySimAfterSimulation"></param>
 /// <returns></returns>
 private bool IsSimulationResultValid(MySimulation mySimAfterSimulation)
 {
     return(mySimAfterSimulation.ArrivedAfterStartRatioSim.Mean() < 0.07 &&
            mySimAfterSimulation.AveragePassengerWaitingTimeSim.Mean() < 600);
 }
Ejemplo n.º 27
0
 public string Execute(MySimulation sim)
 {
     return(sim.TheClinic.PersonalTrainer.Introduction());
 }
 private void SetConfiguration(MySimulation simulation, SimulationConfiguration config)
 {
     SetConfiguration(simulation.LineVehicles, config.LinesVehicles);
     SetConfiguration(simulation.LineBusesStartTimes, config.LineBusesStartTimes);
 }
Ejemplo n.º 29
0
 public string Execute(MySimulation sim)
 {
     return(sim.TheClinic.PersonalTrainer.GiveAdvice(sim.TheClinic.CurrentClient));
 }