public int RunTest(int liczbaSwietlikow, int maxLiczbaIteracji,
            double gamma, int alfa)
        {
            FireflyAlgorithm algorithm = new FireflyAlgorithm()
                                             {
                                                 M = 10,
                                                 //liczba swietlikow
                                                 Imax = 100,
                                                 //max liczba iteracji
                                                 Gamma = 1.0,
                                                 //wsp absorpcji
                                                 Alfa = 2 //waga losowego kroku <= n
                                             };
            algorithm.SetTestData((int[,]) A.Clone(), (int[,]) B.Clone(), size);

            algorithm.RunAlgorithm();
            return algorithm.GetMinimalCost();
        }
        public void Run()
        {
            if (A == null)
            {
                MessageBox.Show("Załaduj najpierw dane");
                return;
            }
            IAlgorithm algorithm = null;
            string name="Algorytm";
            int iterations=0;

            //wybieranie algorytmu
            switch (SelectedTab)
            {
                case 0:
                    algorithm = new AntColony(_antColony.Ants,_antColony.MaxAssigns,_antColony.Alpha,_antColony.Beta,_antColony.Rho,_antColony.q,_antColony.Q0,_antColony.T0,_antColony.Q);
                    name = "AlgorytmMrówkowy";
                    iterations=_antColony.MaxAssigns;

                    break;
                case 1:
                    algorithm = new BeesAlgorithm()
                    {
                        M = BeeAlgorithm.M,
                        Imax = BeeAlgorithm.Imax,
                        E = beeAlgorithm.E,
                        Ngh=beeAlgorithm.Ngh,
                        Nsp=beeAlgorithm.Nsp,
                        Nb=beeAlgorithm.Nb,
                        Nep=beeAlgorithm.Nep
                    };
                    name = "AlgorytmPszczeli";
                    iterations= BeeAlgorithm.Imax;
                    break;

                case 2:
                    algorithm=new FireflyAlgorithm()
                        {
                            M = FireflyAlgorithm.M,
                            Imax = FireflyAlgorithm.Imax,
                            Gamma = FireflyAlgorithm.Gamma,
                            Alfa = FireflyAlgorithm.Alfa
                        };
                    name = "AlgorytmŚwietlikowy";
                    iterations=FireflyAlgorithm.Imax;
                    break;
                case 3:
                    algorithm = new BeeAlgorithm(this.beeAlgorithmSBC.TotalNumberBees, this.beeAlgorithmSBC.NumberScout, this.beeAlgorithmSBC.MaxNumberVisits, this.beeAlgorithmSBC.MaxNumberCycles, this.beeAlgorithmSBC.ProbPersuasion, this.beeAlgorithmSBC.ProbMistake);
                    name = "AlgorytmPszczeliBSC";
                    iterations = FireflyAlgorithm.Imax;
                    break;
            }

            if (algorithm == null)
            {
                MessageBox.Show("Nie załadowano algorytmu.");
                return;
            }

            //ładowanie algorytmu
            algorithm.SetTestData((int[,]) A.Clone(), (int[,]) B.Clone(), size);
            var sth = new Chart(algorithm,iterations,name,this.iterationGap,filename);
            sth.Show();
        }