static void Main(string[] args)
        {
            string BeeHiveAdress    = @"C:\Users\user1\source\repos\CodeIt\Defect2019\bin\Release\EllipseData";
            string NotBeeHiveAdress = @"C:\Users\user1\Desktop\EllipseData";
            string Symbols          = "ABCDEFGH";

            string[] files = new string[Symbols.Length * (Symbols.Length - 1)];
            int      k     = 0;

            for (int i = 0; i < Symbols.Length; i++)
            {
                for (int j = 0; j < Symbols.Length; j++)
                {
                    if (i != j)
                    {
                        files[k++] = $"{Symbols[i]}to{Symbols[j]}(MaxCoordinate).txt";
                    }
                }
            }

            double[] Get(string path) => files.Select(s => Expendator.GetStringArrayFromFile(Path.Combine(path, s))[2].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[2].Replace('.', ',').ToDouble()).ToArray();

            var vec1 = Get(BeeHiveAdress);
            var vec2 = Get(NotBeeHiveAdress);

            double s1 = 0, s2 = 0;

            using (StreamWriter r = new StreamWriter("bee.txt"))
                for (int i = 0; i < vec1.Length; i++)
                {
                    r.WriteLine($"{vec1[i]} {vec2[i]}");
                    Console.WriteLine($"{vec1[i]} \t{vec2[i]} " + ((vec1[i] >= vec2[i]) ? "\tЛучше  +" : "\tХучше  -"));
                    double tmp = vec1[i] - vec2[i];
                    if (tmp < 0)
                    {
                        s2 -= tmp;
                    }
                    else
                    {
                        s1 += tmp;
                    }
                }
            Console.WriteLine($"Выигрыш = \t{s1} ({Expendator.GetProcent(s1, s1 + s2)}%)");
            Console.WriteLine($"Проигрыш = \t{s2} ({Expendator.GetProcent(s2, s1 + s2)}%)");

            File.Copy(Expendator.GetResource("TestBee.r", "OptimisationTest"), "TestBee.r", true);
            Expendator.StartProcessOnly("TestBee.r");
            Process.Start("bee.png");

            Console.ReadKey();
        }
        private async Task MakeDiffAsync()
        {
            var ar = Enumerable.Range(0, sourcesCount).ToArray();

            all = CountOfEdges;
            int[] tmp = new int[all];
            save = 0;
            timer1.Start();
            await Task.Run(() =>
            {
                Parallel.For(0, sourcesCount, (int i) =>
                {
                    var args    = ar.Where(n => n != i).ToArray();
                    var ArNames = new List <string>(args.Length);

                    for (int j = 0; j < sourcesCount - 1; j++)
                    {
                        //Debug.WriteLine(max);
                        using (StreamWriter res = new StreamWriter(Path.Combine(fdiff[i], ArraysNames[args[j]])))
                        {
                            using (StreamReader f0 = new StreamReader(Path.Combine(fwithout[i], ArraysNames[args[j]])))
                                using (StreamReader f1 = new StreamReader(Path.Combine(fwith[i], ArraysNames[args[j]])))
                                {
                                    string s = f0.ReadLine();
                                    while (s != null && s.Length > 0)
                                    {
                                        double t = Convert.ToDouble(f1.ReadLine().Replace('.', ',')) - Convert.ToDouble(s.Replace('.', ','));
                                        res.WriteLine(t.ToString().Replace(',', '.'));
                                        s = f0.ReadLine();
                                    }
                                }
                        }

                        ArNames.Add(ArraysNames[args[j]]);

                        tmp[i * (sourcesCount - 1) + j]++;
                        save = tmp.Sum();
                    }

                    ArNames.Insert(0, timefile);
                    Expendator.WriteInFile(Path.Combine(fdiff[i], "DefNames.txt"), ArNames.Select(s => s.Replace(".txt", "")).ToArray());
                    InteractFlags(fdiff[i]);
                    File.Copy(Expendator.GetResource("GraficFunc.r"), Path.Combine(fdiff[i], "GraficFunc.r"), true);
                });
            });

            save = 0;
            Timer1_Tick(new object(), new EventArgs());
            timer1.Stop();
        }
Example #3
0
        public static void ReadModelData()
        {
            StreamReader fs = new StreamReader(Expendator.GetResource("poles.dat"));
            List <Tuple <double, double[]> > list = new List <Tuple <double, double[]> >(100);

            string s = fs.ReadLine();

            s = fs.ReadLine();
            while (s != null)
            {
                s = s.Replace("+0", "+").Replace("-0", "-").Replace('.', ',');
                string[] st = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                list.Add(new Tuple <double, double[]>(st[0].ToDouble(), new double[] { st[2].ToDouble(), st[3].ToDouble(), st[4].ToDouble() }));
                s = fs.ReadLine();
            }
            fs.Close();
            Model = list.ToArray();
        }
 private void button6_Click(object sender, EventArgs e) => new Библиотека_графики.PdfOpen("Варианты метрик", Expendator.GetResource("formula.pdf")).ShowDialog();
 private void button3_Click(object sender, EventArgs e)
 {
     new Библиотека_графики.PdfOpen("Алгоритм работы", Expendator.GetResource("algolIlusha.pdf", "PS5000ABlockCapture")).Show();
 }