private void button4_Click(object sender, EventArgs e) { Random r = new Random(); // grab random sample Int32 sampleSize = (Int32)Math.Sqrt(coordinates.Length); if (sampleSize < numericUpDown2.Value) { sampleSize = (int)numericUpDown2.Value; } //Coordinate[] sample = coordinates.OrderBy((Coordinate c) => { return r.Next(); }).Take(sampleSize).ToArray(); //Coordinate[] sample = coordinates.GetRandomSample(sampleSize); Stopwatch sw = new Stopwatch(); sw.Start(); //processor = new KMedoidsProcessor<Coordinate>((int)numericUpDown2.Value, sample, new RoutingAI.Algorithms.StraightDistanceAlgorithm()); //processor = new KMedoidsSampledProcessor<Coordinate>((int)numericUpDown2.Value, coordinates, sampleSize, 100, new RoutingAI.Algorithms.StraightDistanceAlgorithm(), 2); processor = new CLARAClusteringAlgorithm <Coordinate>(coordinates, (int)numericUpDown2.Value, (int)numericUpDown6.Value, new RoutingAI.Algorithms.StraightDistanceAlgorithm()); processor.Run(); sw.Stop(); lblTime.Text = String.Format("Time Elapsed: {0}ms", sw.ElapsedMilliseconds); panel1.Invalidate(); }
private void button2_Click(object sender, EventArgs e) { Random r = new Random(); Stopwatch sw = new Stopwatch(); sw.Start(); //processor = new KMedoidsProcessor<Coordinate>((int)numericUpDown2.Value, coordinates, new RoutingAI.Algorithms.StraightDistanceAlgorithm()); processor = new PAMClusteringAlgorithm <Coordinate>(coordinates, (int)numericUpDown2.Value, new RoutingAI.Algorithms.StraightDistanceAlgorithm()); processor.Run(); sw.Stop(); lblTime.Text = String.Format("Time Elapsed: {0}ms", sw.ElapsedMilliseconds); panel1.Invalidate(); }
private void button2_Click(object sender, EventArgs e) { Random r = new Random(); Stopwatch sw = new Stopwatch(); sw.Start(); //processor = new KMedoidsProcessor<Coordinate>((int)numericUpDown2.Value, coordinates, new RoutingAI.Algorithms.StraightDistanceAlgorithm()); processor = new PAMClusteringAlgorithm<Coordinate>(coordinates, (int)numericUpDown2.Value, new RoutingAI.Algorithms.StraightDistanceAlgorithm()); processor.Run(); sw.Stop(); lblTime.Text = String.Format("Time Elapsed: {0}ms", sw.ElapsedMilliseconds); panel1.Invalidate(); }
private void button4_Click(object sender, EventArgs e) { Random r = new Random(); // grab random sample Int32 sampleSize = (Int32)Math.Sqrt(coordinates.Length); if (sampleSize < numericUpDown2.Value) sampleSize = (int)numericUpDown2.Value; //Coordinate[] sample = coordinates.OrderBy((Coordinate c) => { return r.Next(); }).Take(sampleSize).ToArray(); //Coordinate[] sample = coordinates.GetRandomSample(sampleSize); Stopwatch sw = new Stopwatch(); sw.Start(); //processor = new KMedoidsProcessor<Coordinate>((int)numericUpDown2.Value, sample, new RoutingAI.Algorithms.StraightDistanceAlgorithm()); //processor = new KMedoidsSampledProcessor<Coordinate>((int)numericUpDown2.Value, coordinates, sampleSize, 100, new RoutingAI.Algorithms.StraightDistanceAlgorithm(), 2); processor = new CLARAClusteringAlgorithm<Coordinate>(coordinates, (int)numericUpDown2.Value, (int)numericUpDown6.Value, new RoutingAI.Algorithms.StraightDistanceAlgorithm()); processor.Run(); sw.Stop(); lblTime.Text = String.Format("Time Elapsed: {0}ms", sw.ElapsedMilliseconds); panel1.Invalidate(); }