- Timestamp:
- 02/17/17 12:51:44 (8 years ago)
- Location:
- branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3
- Files:
-
- 5 added
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/InformationAnalysis.cs
r13583 r14678 212 212 private string asString; 213 213 public override string ToString() { 214 return asString ?? (asString = string.Join("", slopes.Select(s => (s == Slope.Down ? " v" : (s == Slope.Up ? "^" : "-")))));214 return asString ?? (asString = string.Join("", slopes.Select(s => (s == Slope.Down ? "\\" : (s == Slope.Up ? "/" : "-"))))); 215 215 } 216 216 } 217 217 218 218 private static IEnumerable<Slope> Slopes(double eps, IEnumerable<double> differences) { 219 return differences.Select(d => (d > eps ? Slope.Up : (d < -eps ? Slope.Down : 0)));219 return differences.Select(d => (d > eps ? Slope.Up : (d < -eps ? Slope.Down : Slope.Flat))); 220 220 } 221 221 -
branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/HeuristicLab.Analysis.FitnessLandscape-3.3.csproj
r13668 r14678 152 152 <Private>False</Private> 153 153 </Reference> 154 <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 155 <SpecificVersion>False</SpecificVersion> 156 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath> 157 <Private>False</Private> 158 </Reference> 159 <Reference Include="HeuristicLab.Problems.QuadraticAssignment-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 160 <SpecificVersion>False</SpecificVersion> 161 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.QuadraticAssignment-3.3.dll</HintPath> 162 <Private>False</Private> 163 </Reference> 154 164 <Reference Include="HeuristicLab.Random-3.3"> 155 165 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath> … … 196 206 <Compile Include="CharacteristicCalculator\UpDownWalkCalculator.cs" /> 197 207 <Compile Include="CharacteristicCalculator\RandomWalkCalculator.cs" /> 208 <Compile Include="ProblemCharacteristicAnalysis\CharacteristicCalculator.cs" /> 209 <Compile Include="ProblemCharacteristicAnalysis\DoubleMatrixCharacteristicCalculator.cs" /> 210 <Compile Include="ProblemCharacteristicAnalysis\QAP\QAPCharacteristicCalculator.cs" /> 211 <Compile Include="ProblemCharacteristicAnalysis\QAP\QAPDirectedWalk.cs" /> 212 <Compile Include="ProblemInstanceAnalysis\DirectedPath.cs" /> 213 <Compile Include="ProblemInstanceAnalysis\ProblemInstanceAnalyzer.cs" /> 214 <Compile Include="ProblemInstanceAnalysis\PRProblemInstanceAnalyzer.cs" /> 215 <Compile Include="ProblemInstanceAnalysis\QAPPRProblemInstanceAnalyzer.cs" /> 198 216 <Compile Include="UpDownSelector.cs" /> 199 217 <Compile Include="DistanceCalculators\RealVectorDistanceCalculator.cs" /> -
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.