Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            CitiesCoordinates = AntAlgo.GetCitiesCoordinatesFromFile(FileOpenStatus);
            AntInfo solution;

            if (CitiesCoordinates.Any())
            {
                double a = 1, b = 5;
                textBox1.Text = Convert.ToString(a);
                textBox2.Text = Convert.ToString(b);
                solution      = AntAlgo.AlgoGo(a, b, CitiesCoordinates, Solution);
                label2.Text   = "SOLUTION";

                coordsSequence = AntAlgo.CitiesCoordinatesSequence(CitiesCoordinates, solution);
                AntAlgo.BuildGraphic(chart1, coordsSequence, solution.T);
            }

            //show recommended parameters alpha beta
            label7.Text  = "alpha:\n";
            label7.Text += "  beta:";
            label8.Text  = "0,5\n 5";
            label9.Text  = "1\n1";
            label10.Text = "1\n2";
            label11.Text = "1\n5";
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                double  a = Convert.ToDouble(textBox1.Text);
                double  b = Convert.ToDouble(textBox2.Text);
                AntInfo solution;

                if (CitiesCoordinates.Any())
                {
                    solution    = AntAlgo.AlgoGo(a, b, CitiesCoordinates, Solution);
                    label2.Text = "SOLUTION";

                    coordsSequence = AntAlgo.CitiesCoordinatesSequence(CitiesCoordinates, solution);
                    AntAlgo.BuildGraphic(chart1, coordsSequence, solution.T);
                }
            }
            catch (Exception) { }
        }