Ejemplo n.º 1
0
        private void button9_Click(object sender, EventArgs e)
        {
            textBox3.Text = "searching...";
            textBox3.Refresh();
            double initial_temp             = (double)numericUpDown6.Value;
            double cooling_factor           = double.Parse(textBox4.Text);
            simulated_annealing <int[]> sa  = new simulated_annealing <int[]>(initial_temp, cooling_factor);
            n_queens_problem            nqp = new n_queens_problem();

            int[] result = sa.solve(nqp, helper.generate_random_array(number_of_queen()));
            textBox3.Text = print_n_queen_result(result);
        }
Ejemplo n.º 2
0
        private void button10_Click(object sender, EventArgs e)
        {
            textBox10.Text = "searching...";
            textBox10.Refresh();
            int color_constraint = number_of_colors();

            int[] a = helper.generate_random_array(number_of_nodes(), color_constraint);
            bool[,] adj_matrix = get_adjacency_matrix();
            double initial_temp            = (double)numericUpDown8.Value;
            double cooling_factor          = double.Parse(textBox6.Text);
            simulated_annealing <int[]> sa = new simulated_annealing <int[]>(initial_temp, cooling_factor);
            graph_coloring gc = new graph_coloring(adj_matrix, color_constraint);

            int[] result = sa.solve(gc, a);
            textBox10.Text = print_graph_coloring_result(gc, result);
        }