public async Task GetDataAsync()
        {
            masA = new long[CountSum];
            int it = 0;
            int mx = CountOfEdges;

            for (int i = 0; i < sourcesCount; i++)
            {
                textBoxUnitInfo.AppendText(Switch_.GetAccepted() + "\n");
                Switch_.SendCmd(0, i);
                textBoxUnitInfo.AppendText(Switch_.GetAccepted() + "\n");
                await Task.Delay(2000);

                for (int j = 0; j < sourcesCount; j++)
                {
                    if (i != j)
                    {
                        await GetDataMiniAsync(j, Path.Combine(ItFolder(i), ArraysNames[j]));

                        toolStripStatusLabel2.Text = $"Выполнено {++it} из {mx} ({Expendator.GetProcent(it, mx, 2)}%)";
                    }
                }
                toolStripStatusLabel2.Text = "";

                FurierOrShowIterationAsync(ItFolder(i), null, i);
            }
        }
Ejemplo n.º 2
0
 private void Timer1_Tick(object Sender, EventArgs e)
 {
     if (label1String != null)
     {
         toolStripStatusLabel1.Text = label1String;
     }
     if (label2String != null)
     {
         toolStripStatusLabel2.Text = label2String;
     }
     toolStripProgressBar1.Value = (int)(Expendator.GetProcent(save, all) / 100 * toolStripProgressBar1.Maximum);
     this.Refresh();
 }
        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();
        }
        public WaveletContinious(Source[] array)
        {
            InitializeComponent();
            sources = array;

            SetDefaultStrip();
            SetDataGrid();

            timer1.Tick += (o, e) =>
            {
                var d = Expendator.GetProcent(save, all, 2);
                toolStripLabel2.Text        = $"{d}%";
                toolStripProgressBar1.Value = (int)(d / 100 * toolStripProgressBar1.Maximum);
            };
            groupBox3.Hide();
        }
        public OnePoint(Source[] smas)
        {
            InitializeComponent();
            sources       = smas;
            files         = new string[sources.Length];
            textBox5.Text = Environment.CurrentDirectory;

            SetToolTip();
            FillListAndFileArrays();

            timer1.Interval = 250;
            timer1.Tick    += (object o, EventArgs e) =>
            {
                toolStripProgressBar1.Value = (Expendator.GetProcent(save, all) / 100 * toolStripProgressBar1.Maximum).ToInt();
                this.Refresh();
            };
        }
        public static void Start(double begin, double step, int count, string filename, string path,
                                 Wavelet.Wavelets wavelets, double omega, FuncMethods.DefInteg.GaussKronrod.NodesCount nodesCount,
                                 NetOnDouble X, NetOnDouble Y)
        {
            Wavelet.countNodes = nodesCount;
            var wavel = Wavelet.Create(wavelets, omega);

            var mas = Point.CreatePointArray(begin, step, count, filename, path);
            Func <double, double, Complex> f = wavel.GetAnalys(mas);

            IProgress <int> progress = new Progress <int>(number => Console.WriteLine(Expendator.GetProcent(number, X.Count * Y.Count).ToString(2) + "%"));

            Create3DGrafics.MakeGrafic(Create3DGrafics.GraficType.PdfPngHtml, $"wavelets{wavelets}",
                                       (a, b) => f(a, b).Abs, X, Y,
                                       progress, new System.Threading.CancellationToken(),
                                       new StringsForGrafic($"Wavelet {wavelets}", "a", "b", "|values|"), true);

            //Func<double, double> func2 = wavel.GetSyntesis();
            //new MostSimpleGrafic( func2, mas,    "Преобразование",    true).ShowDialog();
        }
        public static void Start(Func <double, double> func,
                                 Wavelet.Wavelets wavelets, double omega, FuncMethods.DefInteg.GaussKronrod.NodesCount nodesCount,
                                 NetOnDouble X, NetOnDouble Y, NetOnDouble T)
        {
            Wavelet.countNodes = nodesCount;
            var wavel = Wavelet.Create(wavelets, omega);

            Func <double, double, Complex> f = wavel.GetAnalys(func);

            IProgress <int> progress = new Progress <int>(number => Console.WriteLine(Expendator.GetProcent(number, X.Count * Y.Count).ToString(2) + "%"));

            Create3DGrafics.MakeGrafic(Create3DGrafics.GraficType.PdfPngHtml, $"wavelets{wavelets}",
                                       (a, b) => f(a, b).Abs, X, Y,
                                       progress, new System.Threading.CancellationToken(),
                                       new StringsForGrafic($"Wavelet {wavelets}", "a", "b", "|values|"), true);


            Func <double, double> func2 = wavel.GetSyntesis();

            new MostSimpleGrafic(new Func <double, double>[]
            {
                func,
                func2
            },
                                 T,
                                 new string[] {
                "Исходная функция",
                "Её преобразование туда-сюда"
            },
                                 true).ShowDialog();
        }