private void Button_Click_Gant(object sender, EventArgs e) { int algorithm = -1, destination_algorithm = -1; if (radBtnAlg2.IsChecked == true) { algorithm = 2; } else if (radBtnAlg3.IsChecked == true) { algorithm = 3; } else if (radBtnAlg12.IsChecked == true) { algorithm = 12; } if (radBtnDestAlg4.IsChecked == true) { destination_algorithm = 4; } else if (radBtnDestAlg5.IsChecked == true) { destination_algorithm = 5; } else if (radBtnDestAlg6.IsChecked == true) { destination_algorithm = 6; } bool isDuplex = true; if (radBtnDuplex.IsChecked == false) { isDuplex = false; } int countLinks = int.Parse(txtBoxLinks.Text); double proizvodProcessors = double.Parse(txtBoxProcessors.Text); double propuskChannels = double.Parse(txtBoxChannels.Text); _destin_alg = new DestinationAlgorithms(canvasGant, _grView, _grViewCS, propuskChannels, proizvodProcessors, isDuplex, countLinks); if (algorithm != -1 && destination_algorithm != -1) { _destin_alg.test(algorithm, destination_algorithm, true); } else { MessageBox.Show("Для побудови діаграми Ганта необхідно обрати алгоритми"); } }
private void Button_Click_Gant(object sender, EventArgs e) { int algorithm = -1, destination_algorithm = -1; if (radBtnAlg2.IsChecked == true) { algorithm = 2; } else if (radBtnAlg3.IsChecked == true) { algorithm = 3; } else if (radBtnAlg12.IsChecked == true) { algorithm = 12; } if (radBtnDestAlg4.IsChecked == true) { destination_algorithm = 4; } else if (radBtnDestAlg5.IsChecked == true) { destination_algorithm = 5; } else if (radBtnDestAlg6.IsChecked == true) { destination_algorithm = 6; } _destin_alg = new DestinationAlgorithms(canvasGant, _grView, _grViewCS); if (algorithm != -1 && destination_algorithm != -1) { _destin_alg.test(algorithm, destination_algorithm, true); } else { MessageBox.Show("Для побудови діаграми Ганта необхідно обрати алгоритми"); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { Dictionary <double, List <double> > dict_Kp = new Dictionary <double, List <double> >(); Dictionary <double, List <double> > dict_Ke = new Dictionary <double, List <double> >(); Dictionary <double, List <double> > dict_Keap = new Dictionary <double, List <double> >(); Dictionary <double, List <double> > dict_Time = new Dictionary <double, List <double> >(); int int_minCountTops = int.Parse(minCountTops.Text); int int_maxCountTops = int.Parse(maxCountTops.Text); int int_stepCountTops = int.Parse(stepCountTops.Text); int int_minConnected = Convert.ToInt32(double.Parse(minConnected.Text) * 100); int int_maxConnected = Convert.ToInt32(double.Parse(maxConnected.Text) * 100); int int_stepConnected = Convert.ToInt32(double.Parse(stepConnected.Text) * 100); int int_minWeightTops = int.Parse(minWeightTops.Text); int int_maxWeightTops = int.Parse(maxWeightTops.Text); int int_countGraphs = int.Parse(countGraphs.Text); int k = 0; string str = ""; for (int i = int_minConnected; i <= int_maxConnected; i += int_stepConnected) { double coherence = Convert.ToDouble(i) / 100; dict_Kp[coherence] = new List <double>(); dict_Ke[coherence] = new List <double>(); dict_Keap[coherence] = new List <double>(); dict_Time[coherence] = new List <double>(); k = 0; for (int j = int_minCountTops; k < int_countGraphs; j += int_stepCountTops, k++) { _grView.ClearAll(); if (j > int_maxCountTops) { j = int_minCountTops; } _grView.GenerateGraph(j, int_minWeightTops, int_maxWeightTops, coherence); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, isDuplex, countLinks); // str += "Зв'язність " + coherence + "\n" +_destin_alg.test(2, 4, false); str += "Зв'язність " + coherence + "\n" + _destin_alg.test(2, 4, false); dict_Kp[coherence].Add(_destin_alg.Kp); dict_Ke[coherence].Add(_destin_alg.Ke); dict_Time[coherence].Add(_destin_alg.Time); dict_Keap[coherence].Add(_destin_alg.Keap); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, isDuplex, countLinks); str += "Зв'язність " + coherence + "\n" + _destin_alg.test(2, 5, false); dict_Kp[coherence].Add(_destin_alg.Kp); dict_Ke[coherence].Add(_destin_alg.Ke); dict_Time[coherence].Add(_destin_alg.Time); dict_Keap[coherence].Add(_destin_alg.Keap); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, isDuplex, countLinks); str += "Зв'язність " + coherence + "\n" + _destin_alg.test(2, 6, false); dict_Kp[coherence].Add(_destin_alg.Kp); dict_Ke[coherence].Add(_destin_alg.Ke); dict_Time[coherence].Add(_destin_alg.Time); dict_Keap[coherence].Add(_destin_alg.Keap); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, isDuplex, countLinks); str += "Зв'язність " + coherence + "\n" + _destin_alg.test(3, 4, false); dict_Kp[coherence].Add(_destin_alg.Kp); dict_Ke[coherence].Add(_destin_alg.Ke); dict_Time[coherence].Add(_destin_alg.Time); dict_Keap[coherence].Add(_destin_alg.Keap); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, isDuplex, countLinks); str += "Зв'язність " + coherence + "\n" + _destin_alg.test(3, 5, false); dict_Kp[coherence].Add(_destin_alg.Kp); dict_Ke[coherence].Add(_destin_alg.Ke); dict_Time[coherence].Add(_destin_alg.Time); dict_Keap[coherence].Add(_destin_alg.Keap); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, isDuplex, countLinks); str += "Зв'язність " + coherence + "\n" + _destin_alg.test(3, 6, false); dict_Kp[coherence].Add(_destin_alg.Kp); dict_Ke[coherence].Add(_destin_alg.Ke); dict_Time[coherence].Add(_destin_alg.Time); dict_Keap[coherence].Add(_destin_alg.Keap); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, isDuplex, countLinks); str += "Зв'язність " + coherence + "\n" + _destin_alg.test(12, 4, false); dict_Kp[coherence].Add(_destin_alg.Kp); dict_Ke[coherence].Add(_destin_alg.Ke); dict_Time[coherence].Add(_destin_alg.Time); dict_Keap[coherence].Add(_destin_alg.Keap); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, isDuplex, countLinks); str += "Зв'язність " + coherence + "\n" + _destin_alg.test(12, 5, false); dict_Kp[coherence].Add(_destin_alg.Kp); dict_Ke[coherence].Add(_destin_alg.Ke); dict_Time[coherence].Add(_destin_alg.Time); dict_Keap[coherence].Add(_destin_alg.Keap); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, isDuplex, countLinks); str += "Зв'язність " + coherence + "\n" + _destin_alg.test(12, 6, false); dict_Kp[coherence].Add(_destin_alg.Kp); dict_Ke[coherence].Add(_destin_alg.Ke); dict_Time[coherence].Add(_destin_alg.Time); dict_Keap[coherence].Add(_destin_alg.Keap); } } FileStream fs = new FileStream("test.txt", FileMode.Create); StreamWriter w = new StreamWriter(fs, Encoding.UTF8); w.WriteLine(str); w.Flush(); w.Close(); fs.Close(); SaveWord(dict_Kp, dict_Ke, dict_Keap, dict_Time); MessageBox.Show("Результати записані"); this.Close(); }
private void Button_Click_2(object sender, RoutedEventArgs e) { Dictionary <double, List <double> > dict_KpDuplex = new Dictionary <double, List <double> >(); // Dictionary<int, List<double>> dict_KpLink = new Dictionary<int, List<double>>(); Dictionary <double, List <double> > dict_TimeDuplex = new Dictionary <double, List <double> >(); // Dictionary<int, List<double>> dict_TimeLink = new Dictionary<int, List<double>>(); int int_minCountTops = int.Parse(minCountTops.Text); int int_maxCountTops = int.Parse(maxCountTops.Text); int int_stepCountTops = int.Parse(stepCountTops.Text); int int_minConnected = Convert.ToInt32(double.Parse(minConnected.Text) * 100); int int_maxConnected = Convert.ToInt32(double.Parse(maxConnected.Text) * 100); int int_stepConnected = Convert.ToInt32(double.Parse(stepConnected.Text) * 100); int int_minWeightTops = int.Parse(minWeightTops.Text); int int_maxWeightTops = int.Parse(maxWeightTops.Text); int int_countGraphs = int.Parse(countGraphs.Text); int int_minCountLinks = int.Parse(minCountLinks.Text); int int_maxCountLinks = int.Parse(maxCountLinks.Text); Dictionary <double, Dictionary <int, List <double> > > dict_Kp = new Dictionary <double, Dictionary <int, List <double> > >(); Dictionary <double, Dictionary <int, List <double> > > dict_Time = new Dictionary <double, Dictionary <int, List <double> > >(); int k = 0; string str = ""; for (int i = int_minConnected; i <= int_maxConnected; i += int_stepConnected) { double coherence = Convert.ToDouble(i) / 100; dict_KpDuplex[coherence] = new List <double>(); dict_TimeDuplex[coherence] = new List <double>(); k = 0; for (int j = int_minCountTops; k < int_countGraphs; j += int_stepCountTops, k++) { _grView.ClearAll(); if (j > int_maxCountTops) { j = int_minCountTops; } _grView.GenerateGraph(j, int_minWeightTops, int_maxWeightTops, coherence); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, true, countLinks); str += "Д Зв'язність " + coherence + "\n" + _destin_alg.test(2, 5, false); dict_KpDuplex[coherence].Add(_destin_alg.Kp); dict_TimeDuplex[coherence].Add(_destin_alg.Time); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, false, countLinks); str += "Н Зв'язність " + coherence + "\n" + _destin_alg.test(2, 5, false); dict_KpDuplex[coherence].Add(_destin_alg.Kp); dict_TimeDuplex[coherence].Add(_destin_alg.Time); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, true, countLinks); str += "Д Зв'язність " + coherence + "\n" + _destin_alg.test(2, 6, false); dict_KpDuplex[coherence].Add(_destin_alg.Kp); dict_TimeDuplex[coherence].Add(_destin_alg.Time); _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, false, countLinks); str += "Н Зв'язність " + coherence + "\n" + _destin_alg.test(2, 6, false); dict_KpDuplex[coherence].Add(_destin_alg.Kp); dict_TimeDuplex[coherence].Add(_destin_alg.Time); } } /* string str2 = ""; * int l = 0; * for (int i = int_minConnected; i <= int_maxConnected; i += int_stepConnected) * { * double coherence = Convert.ToDouble(i) / 100; * dict_Kp[coherence] = new Dictionary<int, List<double>>(); * dict_Time[coherence] = new Dictionary<int, List<double>>(); * k = 0; * * Dictionary<int, List<double>> dict_newKp = new Dictionary<int, List<double>>(); * Dictionary<int, List<double>> dict_newTime = new Dictionary<int, List<double>>(); * for (l = int_minCountLinks; l <= int_maxCountLinks; l++) * { * dict_newKp[l] = new List<double>(); * dict_newTime[l] = new List<double>(); * } * * for (int j = int_minCountTops; k < int_countGraphs; j += int_stepCountTops, k++) * { * * _grView.ClearAll(); * if (j > int_maxCountTops) * j = int_minCountTops; * * _grView.GenerateGraph(j, int_minWeightTops, int_maxWeightTops, coherence); * * for (l = int_minCountLinks; l <= int_maxCountLinks; l++) * { * _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, true, l); * str2 += "Зв'язність " + coherence + "\tlinks " + l + "\n" + _destin_alg.test(2, 5, false); * dict_newKp[l].Add(_destin_alg.Kp); * dict_newTime[l].Add(_destin_alg.Time); * * _destin_alg = new DestinationAlgorithms(canvas, _grView, _grViewCS, propuskChannels, proizvodProcessors, true, l); * str2 += "Зв'язність " + coherence + "\tlinks " + l + "\n" + _destin_alg.test(2, 6, false); * dict_newKp[l].Add(_destin_alg.Kp); * dict_newTime[l].Add(_destin_alg.Time); * } * } * // MessageBox.Show(""); * dict_Kp[coherence] = dict_newKp; * dict_Time[coherence] = dict_newTime; * * } */ FileStream fs = new FileStream("test.txt", FileMode.Create); StreamWriter w = new StreamWriter(fs, Encoding.UTF8); w.WriteLine(str); w.Flush(); w.Close(); fs.Close(); /* fs = new FileStream("test2.txt", FileMode.Create); * w = new StreamWriter(fs, Encoding.UTF8); * w.WriteLine(str2); * w.Flush(); * w.Close(); * fs.Close(); * */ SaveWord(dict_KpDuplex, dict_TimeDuplex, dict_Kp, dict_Time); MessageBox.Show("Результати записані"); }