Ejemplo n.º 1
0
 private void Button_Click_3(object sender, RoutedEventArgs e)
 {
     if (tabTask.IsSelected)
     {
         _grView.ClearAll();
     }
     else
     {
         _grViewCS.ClearAll();
     }
 }
Ejemplo n.º 2
0
        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();
        }