예제 #1
0
        private void btnLoadScene_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            IList <ICartesianCoordinate> coordinates = null;
            CostMatrix <double>          costs       = null;

            if (radioButton1.Checked)
            {
                coordinates = LoadCSV_Coordinates(Path.Combine(dropboxlocation, @"10001.csv"));
            }
            else if (radioButton2.Checked)
            {
                coordinates = new[] { new Point(3, 0), new Point(3, 5), new Point(5, 2), new Point(1, 1), new Point(4, 6) };
            }

            if (radioButton4.Checked)
            {
                costs = LoadCSV_Costs(Path.Combine(dropboxlocation, @"dump.csv"), coordinates.Count);
            }
            else if (radioButton3.Checked)
            {
                var costWithFunction = new CostWithFunction <ICartesianCoordinate>(coordinates, Diverse.DistanceSquared);
                costs = new CostMatrix <double>(costWithFunction, coordinates.Count);
            }

            boundingRectangle = coordinates.BoundingRectangle(); // for viewport

            algorithmSet = new AlgorithmSet <ICartesianCoordinate>(coordinates, costs);
            algorithmSet.ClusterAfterIterationEvent += algorithmSet_ClusterAfterIterationEvent;
            algorithmSetClusters      = null;
            lastTSPResultWithClusters = null;

            panel1.Refresh();
        }
예제 #2
0
        private void btnLoadScene_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            IList<ICartesianCoordinate> coordinates = null;
            CostMatrix<double> costs = null;

            if (radioButton1.Checked)
            {
                coordinates = LoadCSV_Coordinates(Path.Combine(dropboxlocation, @"10001.csv"));
            }
            else if (radioButton2.Checked)
            {
                coordinates = new[] { new Point(3, 0), new Point(3, 5), new Point(5, 2), new Point(1, 1), new Point(4, 6) };
            }

            if (radioButton4.Checked)
            {
                costs = LoadCSV_Costs(Path.Combine(dropboxlocation, @"dump.csv"), coordinates.Count);
            }
            else if (radioButton3.Checked)
            {
                var costWithFunction = new CostWithFunction<ICartesianCoordinate>(coordinates, Diverse.DistanceSquared);
                costs = new CostMatrix<double>(costWithFunction, coordinates.Count);
            }

            boundingRectangle = coordinates.BoundingRectangle(); // for viewport

            algorithmSet = new AlgorithmSet<ICartesianCoordinate>(coordinates, costs);
            algorithmSet.ClusterAfterIterationEvent += algorithmSet_ClusterAfterIterationEvent;
            algorithmSetClusters = null;
            lastTSPResultWithClusters = null;

            panel1.Refresh();
        }