Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();
            var p = Path.GetFullPath(Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).ToString()) + @"\TestCases\TestCase2.txt");

            Program.Sys.runSystem(p);
            MessageBox.Show(Program.Sys.SelectionMethod.ToString());
            MessageBox.Show(TestingManager.Test(Program.Sys, Constants.FileNames.TestCase2));

            for (int i = 0; i < Program.Sys.SimulationTable.Count; ++i)
            {
                int             rowId = SimTable.Rows.Add();
                DataGridViewRow row   = SimTable.Rows[rowId];

                row.Cells[0].Value = Program.Sys.SimulationTable[i].CustomerNumber;
                row.Cells[1].Value = Program.Sys.SimulationTable[i].RandomInterArrival;
                row.Cells[2].Value = Program.Sys.SimulationTable[i].InterArrival;
                row.Cells[3].Value = Program.Sys.SimulationTable[i].ArrivalTime;
                row.Cells[4].Value = Program.Sys.SimulationTable[i].RandomService;
                row.Cells[5].Value = Program.Sys.SimulationTable[i].AssignedServer.ID;
                row.Cells[6].Value = Program.Sys.SimulationTable[i].StartTime;
                row.Cells[7].Value = Program.Sys.SimulationTable[i].ServiceTime;
                row.Cells[8].Value = Program.Sys.SimulationTable[i].EndTime;
                row.Cells[9].Value = Program.Sys.SimulationTable[i].TimeInQueue;
            }
            AverageWaitingTime.Text = Program.Sys.PerformanceMeasures.AverageWaitingTime.ToString();
            MaxQueueLength.Text     = Program.Sys.PerformanceMeasures.MaxQueueLength.ToString();
            WaitingProbability.Text = Program.Sys.PerformanceMeasures.WaitingProbability.ToString();
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();
            var path = Path.GetFullPath(Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).ToString()) + @"\TestCases\TestCase2.txt");

            Program.Sys.runSystem(path);
            MessageBox.Show(TestingManager.Test(Program.Sys, Constants.FileNames.TestCase2));
            for (int i = 0; i < Program.Sys.SimulationTable.Count; ++i)
            {
                int             rowId = SimTable.Rows.Add();
                DataGridViewRow row   = SimTable.Rows[rowId];

                row.Cells[0].Value = Program.Sys.SimulationTable[i].DayNo;
                row.Cells[1].Value = Program.Sys.SimulationTable[i].RandomNewsDayType;
                row.Cells[2].Value = Program.Sys.SimulationTable[i].NewsDayType;
                row.Cells[3].Value = Program.Sys.SimulationTable[i].RandomDemand;
                row.Cells[4].Value = Program.Sys.SimulationTable[i].Demand;
                row.Cells[5].Value = Program.Sys.SimulationTable[i].DailyCost;
                row.Cells[6].Value = Program.Sys.SimulationTable[i].SalesProfit;
                row.Cells[7].Value = Program.Sys.SimulationTable[i].LostProfit;
                row.Cells[8].Value = Program.Sys.SimulationTable[i].ScrapProfit;
                row.Cells[9].Value = Program.Sys.SimulationTable[i].DailyNetProfit;
            }
            TotalSalesRevenue.Text                 = Program.Sys.PerformanceMeasures.TotalSalesProfit.ToString();
            TotalCostofNewspapers.Text             = Program.Sys.PerformanceMeasures.TotalCost.ToString();
            TotalLostProfitfromExcessDemand.Text   = Program.Sys.PerformanceMeasures.TotalLostProfit.ToString();
            TotalSalvagefromsaleofScrappapers.Text = Program.Sys.PerformanceMeasures.TotalScrapProfit.ToString();
            NetProfit.Text = Program.Sys.PerformanceMeasures.TotalNetProfit.ToString();
            Numberofdayshavingexcessdemand.Text = Program.Sys.PerformanceMeasures.DaysWithMoreDemand.ToString();
            Numberofdayshavingunsoldpapers.Text = Program.Sys.PerformanceMeasures.DaysWithUnsoldPapers.ToString();
        }
Esempio n. 3
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            system = new SimSys();
            string file = comboBox1.SelectedItem.ToString();

            system.startSimulation(file);
            string results = TestingManager.Test(system, file);

            MessageBox.Show(results);
            if (tabPage1.Controls.Count > 0)
            {
                tabPage1.Controls.RemoveAt(0);
            }
            tabPage1.Controls.Add(currentGridView(system.CurrentSimulationTable, system.NumberOfBearings));
            tabPage1.Controls[0].Width  = tabPage1.Width;
            tabPage1.Controls[0].Height = tabPage1.Height;

            if (tabPage2.Controls.Count > 0)
            {
                tabPage2.Controls.RemoveAt(0);
            }
            tabPage2.Controls.Add(ProposedGridView(system.ProposedSimulationTable, system.NumberOfBearings));
            tabPage2.Controls[0].Width  = tabPage2.Width;
            tabPage2.Controls[0].Height = tabPage2.Height;

            if (tabPage3.Controls.Count > 0)
            {
                tabPage3.Controls.RemoveAt(0);
            }
            tabPage3.Controls.Add(performanceMeasures(system.CurrentPerformanceMeasures, system.ProposedPerformanceMeasures));
            tabPage3.Controls[0].Width  = tabPage3.Width;
            tabPage3.Controls[0].Height = tabPage3.Height;
        }
Esempio n. 4
0
        private void Readfile_Click_1(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            DialogResult   result         = openFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string fileName = openFileDialog.FileName;

                string[] fileData = File.ReadAllLines(fileName);

                FillSimSysObj(fileData);
                //MessageBox.Show("Done!!");
                FillDistribution();
                FillSimulationTable();
                string[] splitedFilName = fileName.Split(Path.DirectorySeparatorChar);
                string   testing        = TestingManager.Test(simSys, splitedFilName[splitedFilName.Length - 1]);

                MessageBox.Show(testing);

                Form2 f2 = new Form2();
                f2.Show();
                //this.Close();
                this.Hide();
            }
        }
Esempio n. 5
0
 private void Simulate_Click(object sender, EventArgs e)
 {
     if (mysys == null)
     {
         MessageBox.Show("Error No Input !!!");
     }
     else
     {
         Simulator Simulator_Case = new Simulator(mysys);
         Simulator_Case.Run();
         SimulationTableForm simulationTable = new SimulationTableForm(mysys);
         simulationTable.Show();
         string test_res = "";
         string s        = comboBox1.Text;
         if (s == "TestCase1")
         {
             test_res = TestingManager.Test(mysys, Constants.FileNames.TestCase1);
         }
         else if (s == "TestCase2")
         {
             test_res = TestingManager.Test(mysys, Constants.FileNames.TestCase2);
         }
         else if (s == "TestCase3")
         {
             test_res = TestingManager.Test(mysys, Constants.FileNames.TestCase3);
         }
         else if (s == "TestCase4")
         {
             test_res = TestingManager.Test(mysys, Constants.FileNames.TestCase4);
         }
         MessageBox.Show(test_res);
         mysys = new SimulationSystem();
     }
 }
Esempio n. 6
0
    void Start()
    {
        numTrials = 1;
        totalPoints = 0;

        testingScript = this.GetComponent<TestingManager>();

        if( !training )
        {
            string dateFormat =  "yyyy-MM-dd";

            string subject_id = (PlayerPrefs.GetString("subject_id") == null) ? "NA" : PlayerPrefs.GetString("subject_id");
            string fileName = subject_id + "--" + System.DateTime.Now.ToString(dateFormat);

            path = pathName + "/" + fileName + ".csv";
            jsonPath = pathName + "/" + fileName + "-json.txt";

            if (!System.IO.File.Exists( path ))
            {
                // Create a file to write to.
                //string headerColumn = "Trial\tTime\tAngle\tCue\tDir.\tValid\tSucc.\tNoResp.\tAcc.\tRT\tHit" + System.Environment.NewLine;
                string headerColumn = "Trial,Time,Angle,Cue,Direction,Valid,Success,No Response,Acceleration time,Reaction time,Hit time, Coordinates" + System.Environment.NewLine;
                //string headerColumn = "";
                System.IO.File.WriteAllText(path, headerColumn);

                headerColumn = "";
                System.IO.File.WriteAllText(jsonPath, headerColumn);

                /*string createText = "Initiate Data " + System.Environment.NewLine;
                System.IO.File.AppendAllText(path, createText);
                System.IO.File.AppendAllText(coordsPath, createText);*/
            }
        }
    }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            system = new invsys();
            string file = comboBox1.SelectedItem.ToString();

            table.Clear();

            int tcase = Int32.Parse(file);

            system.start_simulation(tests[tcase - 1]);
            string[] row;
            for (int i = 0; i < system.NumberOfDays; i++)
            {
                row     = new string[12];
                row[0]  = system.SimulationTable[i].Day.ToString();
                row[1]  = system.SimulationTable[i].Cycle.ToString();
                row[2]  = system.SimulationTable[i].DayWithinCycle.ToString();
                row[3]  = system.SimulationTable[i].BeginningInventory.ToString();
                row[4]  = system.SimulationTable[i].RandomDemand.ToString();
                row[5]  = system.SimulationTable[i].Demand.ToString();
                row[6]  = system.SimulationTable[i].EndingInventory.ToString();
                row[7]  = system.SimulationTable[i].ShortageQuantity.ToString();
                row[8]  = system.SimulationTable[i].OrderQuantity.ToString();
                row[9]  = system.SimulationTable[i].RandomLeadDays.ToString();
                row[10] = system.SimulationTable[i].LeadDays.ToString();
                row[11] = system.SimulationTable[i].orderArrival.ToString();
                table.Rows.Add(row);
            }
            string msg = TestingManager.Test(system, tests[int.Parse(file) - 1]);

            MessageBox.Show(msg);
        }
Esempio n. 8
0
        public Form1()
        {
            InitializeComponent();
            var testCasePath = Path.GetFullPath(Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).ToString()) + @"\TestCases\TestCase4.txt");

            Program.inventorySystem.fillSystemInformation(testCasePath);

            Program.inventorySystem.fillSystemDistributionTables();

            Program.inventorySystem.runSystem();

            MessageBox.Show(TestingManager.Test(Program.inventorySystem, Constants.FileNames.TestCase4));

            for (int i = 0; i < Program.inventorySystem.SimulationTable.Count; ++i)
            {
                int             rowId = SimTable.Rows.Add();
                DataGridViewRow row   = SimTable.Rows[rowId];

                row.Cells[0].Value  = Program.inventorySystem.SimulationTable[i].Day;
                row.Cells[1].Value  = Program.inventorySystem.SimulationTable[i].Cycle;
                row.Cells[2].Value  = Program.inventorySystem.SimulationTable[i].DayWithinCycle;
                row.Cells[3].Value  = Program.inventorySystem.SimulationTable[i].BeginningInventory;
                row.Cells[4].Value  = Program.inventorySystem.SimulationTable[i].RandomDemand;
                row.Cells[5].Value  = Program.inventorySystem.SimulationTable[i].Demand;
                row.Cells[6].Value  = Program.inventorySystem.SimulationTable[i].EndingInventory;
                row.Cells[7].Value  = Program.inventorySystem.SimulationTable[i].ShortageQuantity;
                row.Cells[8].Value  = Program.inventorySystem.SimulationTable[i].OrderQuantity;
                row.Cells[9].Value  = Program.inventorySystem.SimulationTable[i].RandomLeadDays;
                row.Cells[10].Value = Program.inventorySystem.SimulationTable[i].LeadDays;
                row.Cells[11].Value = Program.inventorySystem.SimulationTable[i].DaysUntilOrderArrives;
            }
            EndingInventoryAverage.Text  = Program.inventorySystem.PerformanceMeasures.EndingInventoryAverage.ToString();
            ShortageQuantityAverage.Text = Program.inventorySystem.PerformanceMeasures.ShortageQuantityAverage.ToString();
        }
Esempio n. 9
0
        private void Simulate_Click(object sender, EventArgs e)
        {
            simulator.calculate_life_time(dataGridView1);
            simulator.calculate_delay_time(dataGridView2);
            Form2 f2 = new Form2(mysystem);

            f2.Show();
            Form3 f3 = new Form3(mysystem);

            f3.Show();
            string s = "";

            if (comboBox1.Text == "TestCase1")
            {
                s = TestingManager.Test(mysystem, Constants.FileNames.TestCase1);
            }
            else if (comboBox1.Text == "TestCase2")
            {
                s = TestingManager.Test(mysystem, Constants.FileNames.TestCase2);
            }
            else
            {
                s = TestingManager.Test(mysystem, Constants.FileNames.TestCase3);
            }

            MessageBox.Show(s);
            mysystem = new BearingMachineModels.SimulationSystem();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            InventoryModels.SimulationSystem simsys = new InventoryModels.SimulationSystem();
            LeadTimeDis = new List <Distribution>();
            demandDis   = new List <Distribution>();

            Read_Demand_Distribution();
            Read_Lead_time_Distribution();
            Helper.Calc_Ranges(LeadTimeDis);
            Helper.Calc_Ranges(demandDis);
            simsys.DemandDistribution   = demandDis;
            simsys.LeadDaysDistribution = LeadTimeDis;
            // MessageBox.Show(LeadTimeDis.Count.ToString());

            simsys.NumberOfDays           = Int32.Parse(NumberOfDays.Text.ToString());
            simsys.OrderUpTo              = Int32.Parse(theOrderLevel.Text.ToString());
            simsys.ReviewPeriod           = Int32.Parse(TheReviewPeriod.Text.ToString());
            simsys.StartOrderQuantity     = Int32.Parse(FirstOrderQuantity.Text.ToString());
            simsys.StartLeadDays          = Int32.Parse(FirstOrderarrivesAfter.Text.ToString());
            simsys.StartInventoryQuantity = Int32.Parse(BeginningInventoryQuantity.Text.ToString());


            List <SimulationCase> simulation = Helper.simulate(simsys);

            simsys.SimulationCases = simulation;
            simsys.PerformanceMeasures.EndingInventoryAverage  = Helper.endingInvenoryAverage(simulation);
            simsys.PerformanceMeasures.ShortageQuantityAverage = Helper.shortageQuantityAverage(simulation);
            dataGridView3.DataSource = simulation;


            string testing = TestingManager.Test(simsys, Constants.FileNames.TestCase1);

            MessageBox.Show(testing);
        }
Esempio n. 11
0
        private void readFileButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            DialogResult   result         = openFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string   fileName = openFileDialog.FileName;
                string[] fileData = File.ReadAllLines(fileName);

                fillSimSysObj(fileData);
                fillInterArrivaleTable();
                fillServersTimeDistribution();
                fillSimCaseRow();
                systemCalculations();
                serverCalculations();

                string testingResult = TestingManager.Test(simSys, Constants.FileNames.TestCase2);
                MessageBox.Show(testingResult);

                Form2 f2 = new Form2();
                f2.Show();
                this.Hide();
            }
        }
Esempio n. 12
0
        private void Form1_Load(object sender, EventArgs e)
        {
            System.startsimulation("TestCase1.txt");
            dataGridView1.DataSource = System.SimulationTable;
            String testResult = TestingManager.Test(System, Constants.FileNames.TestCase1);

            MessageBox.Show(testResult);
        }
Esempio n. 13
0
 private void btn_start_Click(object sender, EventArgs e)
 {
     sys.start_simulation();
     lbl_endingInventoryavg.Text  = sys.PerformanceMeasures.EndingInventoryAverage.ToString();
     lbl_shortageQuantityAvg.Text = sys.PerformanceMeasures.ShortageQuantityAverage.ToString();
     grad_output.DataSource       = sys.SimulationTable;
     MessageBox.Show(TestingManager.Test(sys, test_message));
 }
Esempio n. 14
0
        private void TestCasePath_SelectedIndexChanged(object sender, EventArgs e)
        {
            SS.ReadINPUT(TestCasePath.SelectedItem.ToString());
            //SS.FillPerformanceMeasures();
            String TestingResult = TestingManager.Test(SS, Constants.FileNames.TestCase1);

            MessageBox.Show(TestingResult);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string           TestCasePath = txttestcase.Text.ToString();
            SimulationSystem SimSystem    = new SimulationSystem();

            Display(SimSystem.StartSimulation(TestCasePath), SimSystem);
            string TestResult = TestingManager.Test(SimSystem, Constants.FileNames.TestCase3);

            MessageBox.Show(TestResult);
        }
Esempio n. 16
0
        private void Form1_Load(object sender, EventArgs e)
        {
            system.SetPriorityServer(1);
            system.StartSimulation();
            dataGridView1.DataSource = system.SimulationTable;

            String testResult = TestingManager.Test(system, Constants.FileNames.TestCase1);

            MessageBox.Show(testResult);
        }
Esempio n. 17
0
        static void Main()
        {
            SimulationSystem system = new SimulationSystem();
            string           result = TestingManager.Test(system, Constants.FileNames.TestCase1);

            MessageBox.Show(result);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
Esempio n. 18
0
        private void SimulationButton_Click(object sender, EventArgs e)
        {
            Program.simulationSystem.Simulate();
            dgv.DataSource       = Program.simulationSystem.SimulationTable;
            txt_endingAvg.Text   = Program.simulationSystem.PerformanceMeasures.EndingInventoryAverage.ToString();
            txt_shortageAvg.Text = Program.simulationSystem.PerformanceMeasures.ShortageQuantityAverage.ToString();

            string testingResult = TestingManager.Test(Program.simulationSystem, Start.testCase + ".txt");

            MessageBox.Show(testingResult);
        }
Esempio n. 19
0
        private void show_outputs_Click(object sender, EventArgs e)
        {
            Ending_avg.Text   = sys.PerformanceMeasures.EndingInventoryAverage.ToString();
            shortage_avg.Text = sys.PerformanceMeasures.ShortageQuantityAverage.ToString();

            sim_table.DataSource = sys.SimulationTable;

            string testing = TestingManager.Test(sys, Constants.FileNames.TestCase2);

            MessageBox.Show(testing);
        }
Esempio n. 20
0
        private void Simulate_Click(object sender, EventArgs e)
        {
            SimulationSystem ss = new SimulationSystem
            {
                DowntimeCost             = (int)DC_numeric.Value,
                RepairPersonCost         = (int)RPC_numeric.Value,
                BearingCost              = (int)BC_numeric.Value,
                NumberOfHours            = (int)NH_numeric.Value,
                NumberOfBearings         = (int)NB_numeric.Value,
                RepairTimeForOneBearing  = (int)RT1B_numeric.Value,
                RepairTimeForAllBearings = (int)RTAB_numeric.Value
            };
            int     convertedTime;
            decimal convertedProbability;
            var     DTD = DTD_textbox.Text.Split('\n');
            var     BTD = BLD_textbox.Text.Split('\n');

            foreach (var dtd in DTD)
            {
                string[] spliced = dtd.Split(',');
                if (spliced.Length == 2 && int.TryParse(spliced[0], out convertedTime) && decimal.TryParse(spliced[1], out convertedProbability))
                {
                    ss.DelayTimeDistribution.Add(new TimeDistribution
                    {
                        Time = convertedTime, Probability = convertedProbability
                    });
                }
            }
            foreach (var btd in BTD)
            {
                var spliced = btd.Split(',');
                if (spliced.Length == 2 && int.TryParse(spliced[0], out convertedTime) && decimal.TryParse(spliced[1], out convertedProbability))
                {
                    ss.BearingLifeDistribution.Add(new TimeDistribution
                    {
                        Time = convertedTime, Probability = convertedProbability
                    });
                }
            }
            ss.CalculateBearingLifeDistribution();
            ss.CalculateDelayTimeDistribution();
            ss.InitBearings();
            ss.CurrentSimulationTable      = ss.GenerateCurrentSimulationCase();
            ss.ProposedSimulationTable     = ss.GenerateProposedSimulationCase();
            ss.CurrentPerformanceMeasures  = ss.SolveCurrentSimulationCase();
            ss.ProposedPerformanceMeasures = ss.SolveProposedSimulationCase();
            if (File.Exists("TestCases\\" + TC_list.Text))
            {
                var testingResult = TestingManager.Test(ss, TC_list.Text);
                MessageBox.Show(testingResult);
                ResultsForm resultsForm = new ResultsForm(ss);
                resultsForm.ShowDialog(this);
            }
        }
Esempio n. 21
0
        public void Print()
        {
            foreach (SimulationCase s in system.system.SimulationTable)
            {
                dataGridView1.Rows.Add(s.CustomerNumber, s.RandomInterArrival, s.InterArrival, s.ArrivalTime, s.RandomService, s.ServiceTime, s.AssignedServer.ID, s.StartTime, s.EndTime, s.TimeInQueue);
            }
            system.calcPreformance();
            drawChart(1);
            string res = TestingManager.Test(system.system, Constants.FileNames.TestCase2);

            MessageBox.Show(res);
        }
Esempio n. 22
0
        public void Form1_Load()
        {
            init();
            read_file();
            build_tables();
            start();
            dataGridView1.DataSource = sys.SimulationTable;
            dataGridView2.DataSource = sys.InterarrivalDistribution;
            string test = TestingManager.Test(sys, Constants.FileNames.TestCase3);

            MessageBox.Show(test);
        }
Esempio n. 23
0
        private void simulate_Click(object sender, EventArgs e)
        {
            simulationSystem.DayType_Disribution(ref simulationSystem);
            simulationSystem.Demand_Disrtibution(ref simulationSystem);
            simulationSystem.Calculate_SimulationTable(ref simulationSystem);
            string testResult = TestingManager.Test(simulationSystem, Constants.FileNames.TestCase2);

            MessageBox.Show(testResult);
            this.Hide();
            TableResults results = new TableResults(ref simulationSystem);

            results.Show();
        }
Esempio n. 24
0
        private void button1_Click(object sender, EventArgs e)
        {
            system = new ManageSystem();
            dataGridView1.Rows.Clear();
            dataGridView2.Rows.Clear();
            system.readData("E:\\Collage\\NewspaperSellerSimulation_Students\\NewspaperSellerSimulation\\TestCases\\TestCase3.txt");
            //testDataReaderFromFile();
            system.startSimulation();
            fillDataGridViews();
            string test = TestingManager.Test(system.system, Constants.FileNames.TestCase3);

            MessageBox.Show(test);
        }
        private void btnStartSimulation_Click(object sender, EventArgs e)
        {
            Program.f1.s.NumOfRecords = 0;
            Program.f1.s.SimulationCases.Clear();
            Program.f1.s.PerformanceMeasures.setterPerformanceMeasures();
            string val = nrecordstxt.Text.ToString();

            if (Program.f1.s.isNum(val) == false)
            {
                performance_txt.Text = "";
                MessageBox.Show("Invalid Value " + val + " for Number of Days", "Caution", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //write simulation code here
                performance_txt.Text      = "";
                Program.f1.s.NumOfRecords = int.Parse(val);
                dgv_sim.Rows.Clear();
                Program.f1.s.fillsimulationtable();
                foreach (SimulationCase s in Program.f1.s.SimulationCases)
                {
                    dgv_sim.Rows.Add(s.DayNo, s.RandomNewsDayType, s.NewsDayType, s.RandomDemand, s.Demand, s.DailyCost, s.SalesProfit, s.LostProfit, s.ScrapProfit, s.DailyNetProfit);
                }//endforeach
                ///////////////////////////////
                Program.f1.s.Performance_measures();
                performance_txt.Text += "Total Cost of Newspapers : " + Program.f1.s.PerformanceMeasures.TotalCost.ToString() + Environment.NewLine;
                performance_txt.Text += "Total Sales Revenue ; " + Program.f1.s.PerformanceMeasures.TotalSalesProfit.ToString() + Environment.NewLine;
                performance_txt.Text += "Total Lost Profit from Excess Demand : " + Program.f1.s.PerformanceMeasures.TotalLostProfit.ToString() + Environment.NewLine;
                performance_txt.Text += "Total Salvage from sale of Scrap papers : " + Program.f1.s.PerformanceMeasures.TotalScrapProfit.ToString() + Environment.NewLine;
                performance_txt.Text += "Net Profit " + Program.f1.s.PerformanceMeasures.TotalNetProfit.ToString() + Environment.NewLine;
                performance_txt.Text += "Number of days having excess demand : " + Program.f1.s.PerformanceMeasures.DaysWithMoreDemand.ToString() + Environment.NewLine;
                performance_txt.Text += "Number of days having unsold papers : " + Program.f1.s.PerformanceMeasures.DaysWithUnsoldPapers.ToString() + Environment.NewLine;
                //Test
                int    n       = Program.f1.s.fb.path.LastIndexOf("TestCase") + 8;
                string testRes = "";
                if (Program.f1.s.fb.path[n] == '1')
                {
                    testRes = TestingManager.Test(Program.f1.s, Constants.FileNames.TestCase1);
                }
                else if (Program.f1.s.fb.path[n] == '2')
                {
                    testRes = TestingManager.Test(Program.f1.s, Constants.FileNames.TestCase2);
                }
                else if (Program.f1.s.fb.path[n] == '3')
                {
                    testRes = TestingManager.Test(Program.f1.s, Constants.FileNames.TestCase3);
                }
                //MessageBox.Show(Program.f1.s.fb.path[n].ToString());
                MessageBox.Show(testRes);
            }
        }
Esempio n. 26
0
 private void Simulate_Click(object sender, EventArgs e)
 {
     if (SimulationReady() == -1)
     {
         MessageBox.Show("Make sure you have filled all the fields");
     }
     else
     {
         Program.Run();
         View();
         string testingResult = TestingManager.Test(Program, Constants.FileNames.TestCase1);
         MessageBox.Show(testingResult);
     }
 }
        static void Main()
        {
            SimulationSystem system = new SimulationSystem();
            var list = ReadFile();

            //init(system,lines);
            Console.WriteLine("number of servers is" + system.Servers.Count);
            string result = TestingManager.Test(system, Constants.FileNames.TestCase1);

            MessageBox.Show(result);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
Esempio n. 28
0
        private void button2_Click(object sender, EventArgs e)
        {
            d.sim();

            DataGridView dataGridView1 = new DataGridView();

            dataGridView1.Size       = new System.Drawing.Size(900, 450);
            dataGridView1.ScrollBars = ScrollBars.Both;
            tabControl1.Controls[0].Controls.Clear();
            tabControl1.Controls[0].Controls.Add(dataGridView1);
            dataGridView1.ScrollBars = ScrollBars.Both;

            MessageBox.Show(TestingManager.Test(d, filename));

            button2.Hide();

            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            dataGridView1.Columns.Add("Day", "Day");
            dataGridView1.Columns.Add("Cycle", "Cycle");
            dataGridView1.Columns.Add("DayWithinCycle", "DayWithinCycle");
            dataGridView1.Columns.Add("BeginningInventory", "BeginningInventory");
            dataGridView1.Columns.Add("RandomDemand", "RandomDemand");
            dataGridView1.Columns.Add("Demand", "Demand");
            dataGridView1.Columns.Add("EndingInventory", "EndingInventory");
            dataGridView1.Columns.Add("ShortageQuantity", "ShortageQuantity");
            dataGridView1.Columns.Add("OrderQuantity", "OrderQuantity");
            dataGridView1.Columns.Add("RandomLeadDays", "RandomLeadDays");
            dataGridView1.Columns.Add("LeadDays", "LeadDays");

            dataGridView1.Rows.Add(d.SimulationTable.Count());
            for (int i = 0; i < d.SimulationTable.Count(); i++)
            {
                dataGridView1.Rows[i].Cells[0].Value  = d.SimulationTable[i].Day;
                dataGridView1.Rows[i].Cells[1].Value  = d.SimulationTable[i].Cycle;
                dataGridView1.Rows[i].Cells[2].Value  = d.SimulationTable[i].DayWithinCycle;
                dataGridView1.Rows[i].Cells[3].Value  = d.SimulationTable[i].BeginningInventory;
                dataGridView1.Rows[i].Cells[4].Value  = d.SimulationTable[i].RandomDemand;
                dataGridView1.Rows[i].Cells[5].Value  = d.SimulationTable[i].Demand;
                dataGridView1.Rows[i].Cells[6].Value  = d.SimulationTable[i].EndingInventory;
                dataGridView1.Rows[i].Cells[7].Value  = d.SimulationTable[i].ShortageQuantity;
                dataGridView1.Rows[i].Cells[8].Value  = d.SimulationTable[i].OrderQuantity;
                dataGridView1.Rows[i].Cells[9].Value  = d.SimulationTable[i].RandomLeadDays;
                dataGridView1.Rows[i].Cells[10].Value = d.SimulationTable[i].LeadDays;
            }


            textBox1.Text = d.PerformanceMeasures.EndingInventoryAverage.ToString();
            textBox2.Text = d.PerformanceMeasures.ShortageQuantityAverage.ToString();
        }
Esempio n. 29
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string           path             = @"D:\_FCIS\Sna 4\Semester 1\Modeling _ simulation\Simulation_Project\Task 4 - InventorySimulation\InventorySimulation\TestCases\TestCase1.txt";
            SimulationSystem simulationSystem = new SimulationSystem();

            simulationSystem.Run(path);
            dataGridView1.DataSource     = simulationSystem.SimulationTable;
            EndingInventoryAverage.Text  = "Ending Inventory Average: " + simulationSystem.PerformanceMeasures.EndingInventoryAverage.ToString();
            ShortageQuantityAverage.Text = "Shortage Quantity Average: " + simulationSystem.PerformanceMeasures.ShortageQuantityAverage.ToString();

            string testingResult = TestingManager.Test(simulationSystem, Constants.FileNames.TestCase1);

            MessageBox.Show(testingResult);
        }
Esempio n. 30
0
        public Form1()
        {
            InitializeComponent();
            //our Functions -------------(-_-).

            ///Read input from file .......................
            ///least utilization...........................
            ///GUI ............................................
            Read_input("TestCase2");
            Calc_Cummualtive();
            running();
            string testingR = TestingManager.Test(sys, Constants.FileNames.TestCase2);

            MessageBox.Show(testingR);
            //--------------------------------
        }
Esempio n. 31
0
        private void btn_file_Click(object sender, EventArgs e)
        {
            Program.system.ClearSystem();
            string projectPath = System.IO.Directory.GetCurrentDirectory();

            projectPath = projectPath.Remove(projectPath.Length - 10);
            string fileName = txtb_fileName.Text.ToString();

            string[] lines = System.IO.File.ReadAllLines(projectPath + "\\TestCases\\" + fileName + ".txt");

            Program.system.InputData(lines);
            Program.system.Simulate();
            string result = TestingManager.Test(Program.system, fileName + ".txt");

            MessageBox.Show(result);
        }
Esempio n. 32
0
 void Start()
 {
     calibrateScript = this.GetComponent<Calibrate>();
     testingScript = this.GetComponent<TestingManager>();
     path = Application.persistentDataPath + "/" + fileName + "." + trialNum + ".txt";
     if (!System.IO.File.Exists( path ))
     {
         // Create a file to write to.
         string createText = "Initiate Data " + System.Environment.NewLine;
         System.IO.File.WriteAllText(path, createText);
     }
     else {
         string addText = "New Data Entry " + System.Environment.NewLine;
         System.IO.File.AppendAllText(path, addText);
     }
 }
Esempio n. 33
0
    // Use this for initialization
    void Start()
    {
        testingScript = Camera.main.GetComponent<TestingManager>();

        materialTime = displayTime / 3.0f;
        points = 0.0f;
    }
Esempio n. 34
0
 // Use this for initialization
 void Start()
 {
     testingScript = Camera.main.GetComponent<TestingManager>();
 }