public class MapOptimization
{
private double[,] MappingPoints;
private Point[] MapPoints;
private int PointCount;
public int LoadPoints(double[,] DataSet)
{
PointCount = DataSet.GetLength(0);
MapPoints = new Point[PointCount];
MappingPoints = new double[PointCount, 2];
for (int i = 0; i < PointCount; i++)
{
MapPoints[i].X = Math.Round(DataSet[i, 0], 5); // Round off to 5 Digits
MapPoints[i].Y = Math.Round(DataSet[i, 1], 5);
}
// Move DataSet to MappingPoints, Checking each Point For Duplicates.
// Return How Many Valid Points Loaded
return PointCount;
}
public double[,] Optimize()
{
var sortedPoints = MapPoints.OrderBy(p => p.X).ThenBy(p => p.Y);
int i = 0;
foreach (Point TempPoint in sortedPoints)
{
MappingPoints[i, 0] = TempPoint.X;
MappingPoints[i, 1] = TempPoint.Y;
i++;
}
return MappingPoints;
}
}
But I am looking for help in truly optimizing the path.
An Example map would be something like this

What's the best way of determining the optimal path to stop at each point at least once with minimal movement?


Sign In
Create Account


Back to top









