コード例 #1
0
        private async Task GenerateWithDefaultRangeAsync(int SetsNumber)
        {
            btnGenerate.IsEnabled = false;

            await Task.Run(() =>
            {
                SetGenerationArgumentsFromDefaultRange();


                this.Dispatcher.Invoke((Action) delegate
                {
                    txtStatus.Text = BPMGeneratorMethods.UpdateStatusWithGenArgsAndSaveDirectory(generationArgs, _saveDirectory);
                });

                allGeneratedBenchmarks.Clear();
                for (int i = 0; i < SetsNumber; i++)
                {
                    GenerateAndAddBencharkInstanceToList(generationArgs);
                }

                PrintAllGeneratedBenchmarksToFile();

                this.Dispatcher.Invoke((Action) delegate
                {
                    txtStatus.Text = BPMGeneratorMethods.UpdateStatusAsSuccessful(txtStatus);
                });
            });

            btnGenerate.IsEnabled = true;
        }
コード例 #2
0
        private void PrintAllGeneratedBenchmarksToFile()
        {
            string saveDestination = null;
            int    benchmarkNumber = 0;

            this.Dispatcher.Invoke((Action) delegate
            {
                txtStatus.Text += "Created files:\n";
            });

            foreach (BenchmarkInstance b in allGeneratedBenchmarks)
            {
                saveDestination = _saveDirectory + "\\" + benchmarkNumber + b.Name + ".txt";

                BPMGeneratorMethods.PrintBenchmarkToFile(b, saveDestination);

                this.Dispatcher.Invoke((Action) delegate
                {
                    txtStatus.Text += $"{benchmarkNumber + b.Name}.txt\n";
                });

                benchmarkNumber++;
            }

            this.Dispatcher.Invoke((Action) delegate
            {
                txtStatus.Text += "\n\n";
            });
        }
コード例 #3
0
 public void SetGenerationArgumentsAllCases(string noJobs, string jobProcTimeRange, string jobSizeRange, string machCapacity)
 {
     BPMGeneratorMethods.SetNumberOfJobsArgs(noJobs, generationArgs);
     BPMGeneratorMethods.SetJobProcTimeArgs(jobProcTimeRange, generationArgs);
     BPMGeneratorMethods.SetJobSizeArgs(jobSizeRange, generationArgs);
     BPMGeneratorMethods.SetMachineCapacityArgs(machCapacity, generationArgs);
 }
コード例 #4
0
        private async Task GenerateAllCasesAsync(int SetsNumber)
        {
            btnGenerate.IsEnabled = false;

            await Task.Run(() =>
            {
                string statusCleanUp = string.Format($"Save directory:\n {_saveDirectory}\n\n Benchmarks parameters: \n\n");
                this.Dispatcher.Invoke((Action) delegate { txtStatus.Text = statusCleanUp; });

                string[] jobsNumberFactorsLevels = new string[4] {
                    "10", "20", "50", "100"
                };
                string[] procTimeFactorsLevels = new string[2] {
                    "[1,10]", "[1,20]"
                };
                string[] jobsSizesFactorsLevels = new string[3] {
                    "[1,10]", "[2,4]", "[4,8]"
                };
                string[] machineCapacityFactorsLevels = new string[1] {
                    "10"
                };


                allGeneratedBenchmarks.Clear();
                for (int jn = 0; jn < jobsNumberFactorsLevels.Length; jn++)
                {
                    for (int pt = 0; pt < procTimeFactorsLevels.Length; pt++)
                    {
                        for (int js = 0; js < jobsSizesFactorsLevels.Length; js++)
                        {
                            for (int mc = 0; mc < machineCapacityFactorsLevels.Length; mc++)
                            {
                                SetGenerationArgumentsAllCases(jobsNumberFactorsLevels[jn],
                                                               procTimeFactorsLevels[pt], jobsSizesFactorsLevels[js], machineCapacityFactorsLevels[mc]);

                                this.Dispatcher.Invoke((Action) delegate
                                {
                                    txtStatus.Text = BPMGeneratorMethods.UpdateStatusWithGenerationArgs(generationArgs, txtStatus);
                                });

                                for (int set = 0; set < SetsNumber; set++)
                                {
                                    GenerateAndAddBencharkInstanceToList(generationArgs);
                                }
                            }
                        }
                    }
                }


                PrintAllGeneratedBenchmarksToFile();

                this.Dispatcher.Invoke((Action) delegate
                {
                    txtStatus.Text = BPMGeneratorMethods.UpdateStatusAsSuccessful(txtStatus);
                });
            }); //await Task.Run(() =>

            btnGenerate.IsEnabled = true;
        }
コード例 #5
0
        private void MainWindowSetup()
        {
            radioAllCases.IsChecked = true;

            _saveDirectory = BPMGeneratorMethods.GetStartingDirectory();

            txtStatus.Text += BPMGeneratorMethods.CurrentSaveDirectoryStatus(_saveDirectory);
        }
コード例 #6
0
        private void btnPath_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog newDirectoryDialog = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult dialogResult = newDirectoryDialog.ShowDialog();

            if (dialogResult == System.Windows.Forms.DialogResult.OK)
            {
                _saveDirectory = newDirectoryDialog.SelectedPath;
                txtStatus.Text = BPMGeneratorMethods.CurrentSaveDirectoryStatus(_saveDirectory);
            }
        }
コード例 #7
0
        private void SetGenerationArgumentsFromDefaultRange()
        {
            string stringNumberOfJobs     = "";
            string stringJobProcTimeRange = "";
            string stringJobSizeRange     = "";
            string stringMachineCapacity  = "";

            this.Dispatcher.Invoke((Action) delegate
            {
                stringNumberOfJobs     = (this.combNumOfJobs.SelectedItem as ComboBoxItem)?.Content.ToString();
                stringJobProcTimeRange = (this.combJobProcTime.SelectedItem as ComboBoxItem)?.Content.ToString();
                stringJobSizeRange     = (this.combJobSize.SelectedItem as ComboBoxItem)?.Content.ToString();
                stringMachineCapacity  = "10";
            });

            BPMGeneratorMethods.SetNumberOfJobsArgs(stringNumberOfJobs, generationArgs);
            BPMGeneratorMethods.SetJobProcTimeArgs(stringJobProcTimeRange, generationArgs);
            BPMGeneratorMethods.SetJobSizeArgs(stringJobSizeRange, generationArgs);
            BPMGeneratorMethods.SetMachineCapacityArgs(stringMachineCapacity, generationArgs);
        }
コード例 #8
0
        private int GetSetsNumber(int lowestNumberOfSets)
        {
            string stringInstancesSetsNumber = null;

            int intInstancesSetsNumber = -1;

            try
            {
                stringInstancesSetsNumber = txtInstancesSetsNumber.Text;
                intInstancesSetsNumber    = BPMGeneratorMethods.ParseStringToInteger(stringInstancesSetsNumber, txbInstancesSetsNumber, lowestNumberOfSets);
            }
            catch (FormatException fex)
            {
                MessageBox.Show(fex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return(intInstancesSetsNumber);
        }
コード例 #9
0
        private void GenerateAndAddBencharkInstanceToList(GenerationArgs gArgs)
        {
            BenchmarkInstance benchmark = null;

            try
            {
                benchmark = BPMGeneratorMethods.GenerateOneBencharkInstance(gArgs);
            }
            catch (ArgumentOutOfRangeException rex)
            {
                MessageBox.Show(rex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            if (benchmark != null)
            {
                allGeneratedBenchmarks.Add(benchmark);
            }
        }
コード例 #10
0
        private async Task GenerateWithCustomRangeAsync(int SetsNumber)
        {
            btnGenerate.IsEnabled = false;

            await Task.Run(() =>
            {
                string stringNumberOfJobs          = "";
                string stringMachineCapacity       = "";
                string stringJobProcessingTimeFrom = "";
                string stringJobProcessingTimeTo   = "";
                string stringJobSizeFrom           = "";
                string stringJobSizeTo             = "";

                this.Dispatcher.Invoke((Action) delegate
                {
                    stringNumberOfJobs    = txtNumOfJobs.Text;
                    stringMachineCapacity = txtMachineCapacity.Text;

                    stringJobProcessingTimeFrom = txtJobProcTimeFrom.Text;
                    stringJobProcessingTimeTo   = txtJobProcTimeTo.Text;

                    stringJobSizeFrom = txtJobSizeFrom.Text;
                    stringJobSizeTo   = txtJobSizeTo.Text;
                });

                int lowestPossibleNum = 1;

                try
                {
                    generationArgs.NumberOfJobs    = BPMGeneratorMethods.ParseStringToInteger(stringNumberOfJobs, txbNumOfJobs, lowestPossibleNum);
                    generationArgs.MachineCapacity = BPMGeneratorMethods.ParseStringToInteger(stringMachineCapacity, txbMachineCapacity, lowestPossibleNum);

                    generationArgs.JobProcessingTimeFrom = BPMGeneratorMethods.ParseStringToInteger(stringJobProcessingTimeFrom, txbJobProcTime, lowestPossibleNum);
                    generationArgs.JobProcessingTimeTo   = BPMGeneratorMethods.ParseStringToInteger(stringJobProcessingTimeTo, txbJobProcTime, lowestPossibleNum);

                    generationArgs.JobSizeFrom = BPMGeneratorMethods.ParseStringToInteger(stringJobSizeFrom, txbJobSize, lowestPossibleNum);
                    generationArgs.JobSizeTo   = BPMGeneratorMethods.ParseStringToInteger(stringJobSizeTo, txbJobSize, lowestPossibleNum);
                }
                catch (FormatException fex)
                {
                    MessageBox.Show(fex.Message);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                this.Dispatcher.Invoke((Action) delegate
                {
                    txtStatus.Text = BPMGeneratorMethods.UpdateStatusWithGenArgsAndSaveDirectory(generationArgs, _saveDirectory);
                });

                allGeneratedBenchmarks.Clear();
                for (int i = 0; i < SetsNumber; i++)
                {
                    GenerateAndAddBencharkInstanceToList(generationArgs);
                }

                PrintAllGeneratedBenchmarksToFile();

                this.Dispatcher.Invoke((Action) delegate
                {
                    txtStatus.Text = BPMGeneratorMethods.UpdateStatusAsSuccessful(txtStatus);
                });
            });

            btnGenerate.IsEnabled = true;
        }