Changeset 13486 for stable/HeuristicLab.Problems.Instances

Ignore:
Timestamp:
12/21/15 21:07:12 (5 years ago)
Message:

#2221: merged r13484 to stable

Location:
stable
Files:
4 edited
1 copied

Unmodified
Removed
• stable

• Property svn:mergeinfo changed /trunk/sources merged: 13484
• stable/HeuristicLab.Problems.Instances

• Property svn:mergeinfo changed /trunk/sources/HeuristicLab.Problems.Instances merged: 13484
• stable/HeuristicLab.Problems.Instances/3.3/HeuristicLab.Problems.Instances-3.3.csproj

 r12742
• stable/HeuristicLab.Problems.Instances/3.3/Types/DistanceHelper.cs

 r12009 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace HeuristicLab.Problems.Instances { public enum DistanceMeasure { Direct, Euclidean, RoundedEuclidean, UpperEuclidean, Geo, Manhattan, Maximum, Att }; public static class DistanceHelper { /// public static double[,] GetDistanceMatrix(DistanceMeasure distanceMeasure, double[,] coordinates, double[,] distances, int dimension) { if (distances != null) return distances; distances = new double[dimension, dimension]; for (int i = 0; i < dimension - 1; i++) return distances; } public static double GetDistance(DistanceMeasure distanceMeasure, double x1, double y1, double x2, double y2) { switch (distanceMeasure) { case DistanceMeasure.Att: return AttDistance(x1, y1, x2, y2); case DistanceMeasure.Direct: throw new ArgumentException("Direct distance measure requires distance matrix for distance calculation."); case DistanceMeasure.Euclidean: return EuclideanDistance(x1, y1, x2, y2); case DistanceMeasure.Geo: return GeoDistance(x1, y1, x2, y2); case DistanceMeasure.Manhattan: return ManhattanDistance(x1, y1, x2, y2); case DistanceMeasure.Maximum: return MaximumDistance(x1, y1, x2, y2); case DistanceMeasure.RoundedEuclidean: return Math.Round(EuclideanDistance(x1, y1, x2, y2)); case DistanceMeasure.UpperEuclidean: return Math.Ceiling(EuclideanDistance(x1, y1, x2, y2)); default: throw new InvalidOperationException("Distance measure is not known."); } }
Note: See TracChangeset for help on using the changeset viewer.