Ejemplo n.º 1
0
        // Try random solutions.
        private void randomButton_Click(object sender, EventArgs e)
        {
            randomTimeTextBox.Clear();
            randomDiffTextBox.Clear();
            set0ListBox.DataSource = null;
            set1ListBox.DataSource = null;
            Cursor = Cursors.WaitCursor;
            Refresh();

            int N = Values.Length;

            Stopwatch watch = new Stopwatch();

            watch.Start();
            Partitions.Random(Values, Solution, N * N, out BestDifference);
            watch.Stop();
            ShowSolution(watch.Elapsed.TotalSeconds, randomTimeTextBox, randomDiffTextBox);

            Cursor = Cursors.Default;
        }