Changeset 14678 for branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis
- Timestamp:
- 02/17/17 12:51:44 (8 years ago)
- Location:
- branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/CharacteristicCalculator.cs
r13667 r14678 27 27 using System.Collections.Generic; 28 28 29 namespace HeuristicLab. Problems.CharacteristicAnalysis{29 namespace HeuristicLab.Analysis.FitnessLandscape { 30 30 [Item("Characteristic Calculator", "")] 31 31 [StorableClass] -
branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/DoubleMatrixCharacteristicCalculator.cs
r13667 r14678 25 25 using System.Linq; 26 26 27 namespace HeuristicLab. Problems.CharacteristicAnalysis{27 namespace HeuristicLab.Analysis.FitnessLandscape { 28 28 public static class DoubleMatrixCharacteristicCalculator { 29 29 public static double CoeffVariation(DoubleMatrix m) { -
branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/QAP/QAPCharacteristicCalculator.cs
r13667 r14678 30 30 using System.Linq; 31 31 32 namespace HeuristicLab. Problems.CharacteristicAnalysis.QAP{32 namespace HeuristicLab.Analysis.FitnessLandscape { 33 33 [Item("QAP Characteristic Calculator", "")] 34 34 [StorableClass] -
branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/QAP/QAPDirectedWalk.cs
r14429 r14678 33 33 using System.Linq; 34 34 35 namespace HeuristicLab. Problems.CharacteristicAnalysis.QAP{35 namespace HeuristicLab.Analysis.FitnessLandscape { 36 36 [Item("Directed Walk (QAP-specific)", "")] 37 37 [StorableClass] … … 110 110 } 111 111 112 public static IEnumerable<IResult> Calculate(List<List<Tuple<Permutation, double>>> trajectories) { 113 var firstDerivatives = trajectories.Select(path => ApproximateDerivative(path).ToList()).ToList(); 114 var secondDerivatives = firstDerivatives.Select(d1 => ApproximateDerivative(d1).ToList()).ToList(); 115 116 var props = GetCharacteristics(trajectories, firstDerivatives, secondDerivatives).ToDictionary(x => x.Item1, x => x.Item2); 117 yield return new Result("Swap2.Sharpness", new DoubleValue(props["Sharpness"])); 118 yield return new Result("Swap2.Bumpiness", new DoubleValue(props["Bumpiness"])); 119 yield return new Result("Swap2.Flatness", new DoubleValue(props["Flatness"])); 120 yield return new Result("Swap2.Steadiness", new DoubleValue(props["Steadiness"])); 121 } 122 112 123 public static IEnumerable<List<Tuple<Permutation, double>>> Run(IRandom random, QuadraticAssignmentProblem qap, IEnumerable<Permutation> permutations, bool bestImprovement = true) { 113 124 var iter = permutations.GetEnumerator(); 114 125 if (!iter.MoveNext()) yield break; 115 126 127 var min = qap.LowerBound.Value; 128 var max = qap.AverageQuality.Value; 129 116 130 var start = iter.Current; 117 131 while (iter.MoveNext()) { … … 119 133 120 134 var walk = (bestImprovement ? BestDirectedWalk(qap, start, end) : FirstDirectedWalk(random, qap, start, end)).ToList(); 121 var max = walk.Max(x => x.Item2); 122 var min = walk.Min(x => x.Item2); 123 if (max > min) 124 yield return walk.Select(x => Tuple.Create(x.Item1, (x.Item2 - min) / (max - min))).ToList(); 125 else yield return walk.Select(x => Tuple.Create(x.Item1, 0.0)).ToList(); 135 yield return walk.Select(x => Tuple.Create(x.Item1, (x.Item2 - min) / (max - min))).ToList(); 126 136 start = end; 127 137 } // end paths 128 138 } 129 139 130 private IEnumerable<Tuple<string, double>> GetCharacteristics(List<List<Tuple<Permutation, double>>> f, List<List<Tuple<Permutation, double>>> f1, List<List<Tuple<Permutation, double>>> f2) {140 private static IEnumerable<Tuple<string, double>> GetCharacteristics(List<List<Tuple<Permutation, double>>> f, List<List<Tuple<Permutation, double>>> f1, List<List<Tuple<Permutation, double>>> f2) { 131 141 var sharpness = f2.Average(x => Area(x)); 132 142 var bumpiness = 0.0;
Note: See TracChangeset
for help on using the changeset viewer.