Changeset 14690 for branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/CharacteristicCalculator
- Timestamp:
- 02/20/17 20:41:33 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/CharacteristicCalculator/RandomWalkCalculator.cs
r13920 r14690 58 58 characteristics = cloner.Clone(original.characteristics); 59 59 } 60 public RandomWalkCalculator() { 60 public RandomWalkCalculator() : this(new RandomWalk()) { } 61 public RandomWalkCalculator(RandomWalk walker) { 61 62 Name = ItemName; 62 63 Description = ItemDescription; 63 walker = new RandomWalk();64 this.walker = walker; 64 65 characteristics = new CheckedItemList<StringValue>( 65 66 new[] { "AutoCorrelation1", "CorrelationLength", "InformationContent", 66 "PartialInformationContent", "DensityBasinInformation", "InformationStability", 67 "PartialInformationContent", "DensityBasinInformation", "InformationStability", 67 68 "Diversity", "Regularity", "TotalEntropy", "PeakInformationContent", 68 69 "PeakDensityBasinInformation" }.Select(x => new StringValue(x))); … … 91 92 }; 92 93 walker.ExecutionStateChanged += evHandle; 93 walker.Start(); 94 waitHandle.WaitOne(); 95 walker.ExecutionStateChanged -= evHandle; 94 try { 95 walker.Start(); 96 waitHandle.WaitOne(); 97 } finally { walker.ExecutionStateChanged -= evHandle; } 96 98 } 97 99 foreach (var p in characteristics.CheckedItems) { 98 yield return new Result("RandomWalk." + walker.MutatorParameter.Value.Name + "." + p.Value.Value, walker.Results[p.Value.Value].Value); 100 var resultName = "RandomWalk." + walker.MutatorParameter.Value.Name + "." + p.Value.Value; 101 IResult result; 102 if (walker.Results.TryGetValue(p.Value.Value, out result)) { 103 yield return new Result(resultName, result.Value); 104 } else yield return new Result(resultName, new DoubleValue(0)); 99 105 } 100 106 walker.Prepare(true);
Note: See TracChangeset
for help on using the changeset viewer.