Exemple #1
0
        private void FrequancyAlgorithm_Click(object sender, EventArgs e)
        {
            if (this.Validation())
            {
                this.PrepareData();


                Form showResult = new AlgorithmForm("Частотний", manufactures, clients,
                                                    (manufactures, clients) =>
                {
                    manufactures        = GeneticAlgorithm.ProbabilityComputerer.Compute(manufactures);
                    var resultAlgorithm = FrequencySearch.FrequancySearch.FindMostFrequance(manufactures, 100, 30);

                    var cost  = resultAlgorithm.Adaptability;
                    var route = resultAlgorithm.Routes;

                    return(new TransportTaskResult
                    {
                        ResultRoute = route,
                        Cost = cost
                    });
                });
                showResult.Show();
            }
            else
            {
                MessageBox.Show("Перевірте введені дані");
            }
        }
Exemple #2
0
        private void GreedyAlgorithm_Click(object sender, EventArgs e)
        {
            if (this.Validation())
            {
                this.PrepareData();

                Form showResult = new AlgorithmForm("Жадібний", manufactures, clients,
                                                    (manufactures, clients) =>
                {
                    List <Route> _routes;

                    Expensive greedy    = new Expensive();
                    var resultAlgorithm = greedy.Solver(manufactures, clients, out _routes);

                    return(new TransportTaskResult
                    {
                        ResultRoute = _routes,
                        Cost = resultAlgorithm
                    });
                });
                showResult.Show();
            }
            else
            {
                MessageBox.Show("Перевірте введені дані");
            }
        }
Exemple #3
0
        private void GeneticAlgorithm_Click(object sender, EventArgs e)
        {
            if (this.Validation())
            {
                this.PrepareData();

                Form showResult = new AlgorithmForm("Генетичний", manufactures, clients,
                                                    (manufactures, clients) =>
                {
                    var resultAlgorithm = GeneticAlgorithm.Executing.Solve(manufactures);
                    return(new TransportTaskResult
                    {
                        ResultRoute = resultAlgorithm.Routes,
                        Cost = resultAlgorithm.Adaptability
                    });
                });
                showResult.Show();
            }
            else
            {
                MessageBox.Show("Перевірте введені дані");
            }
        }