Changeset 9728 for branches/HeuristicLab.Analysis.AlgorithmBehavior
- Timestamp:
- 07/20/13 13:06:59 (11 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views-3.3.csproj
r9361 r9728 143 143 <DependentUpon>ParameterInfluenceView.cs</DependentUpon> 144 144 </Compile> 145 <Compile Include="PermutationSolutionDictionaryView.cs"> 146 <SubType>UserControl</SubType> 147 </Compile> 148 <Compile Include="PermutationSolutionDictionaryView.Designer.cs"> 149 <DependentUpon>PermutationSolutionDictionaryView.cs</DependentUpon> 150 </Compile> 145 151 <Compile Include="Plugin.cs" /> 146 152 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj
r9723 r9728 119 119 <Compile Include="SolutionsCaching\SolutionDictionary.cs" /> 120 120 <Compile Include="SelectionPressureAnalyzer.cs" /> 121 <Compile Include="SolutionsCaching\PermutationInformation.cs" /> 121 122 <Compile Include="WorstQualityAnalyzer.cs" /> 122 123 <Compile Include="InitializableOperator.cs" /> -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/SolutionsCaching/PermutationSolutionDictionary.cs
r9723 r9728 31 31 [StorableClass] 32 32 public class PermutationSolutionDictionary<TKey, TValue> : SolutionDictionary<TKey, TValue> 33 where TKey : PermutationWrapper { 33 where TKey : PermutationWrapper 34 where TValue : PermutationInformation { 34 35 35 36 public PermutationSolutionDictionary() { … … 83 84 return new PermutationSolutionDictionary<TKey, TValue>(this, cloner); 84 85 } 86 87 public int NumberOfPartialSolutions() { 88 return solutionDictionary.Where(x => x.Key.ElementType == ElementType.Diff).Count(); 89 } 90 91 public int NumberOfCompleteSolutions() { 92 return solutionDictionary.Where(x => x.Key.ElementType == ElementType.Complete).Count(); 93 } 85 94 } 86 95 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/SolutionsCaching/SolutionCachingAnalyzer.cs
r9723 r9728 20 20 #endregion 21 21 22 23 22 using HeuristicLab.Common; 24 23 using HeuristicLab.Core; … … 35 34 public class SolutionCachingAnalyzer : SingleSuccessorOperator, IAnalyzer { 36 35 private const string ResultsParameterName = "Results"; 37 //TODO: this should be a stateful item! 36 38 37 #region IAnalyzer Members 39 38 public bool EnabledByDefault { … … 58 57 get { return ResultsParameter.ActualValue; } 59 58 } 60 61 [Storable]62 private PermutationSolutionDictionary<PermutationWrapper, int> solDict;63 59 #endregion 64 60 … … 68 64 private SolutionCachingAnalyzer(SolutionCachingAnalyzer original, Cloner cloner) 69 65 : base(original, cloner) { 70 this.solDict = (PermutationSolutionDictionary<PermutationWrapper, int>)original.solDict.Clone(cloner);71 66 } 72 67 … … 76 71 Parameters.Add(new LookupParameter<IntValue>("Generations", "Nr of generations.")); 77 72 Parameters.Add(new ScopeTreeLookupParameter<Permutation>("Solution", "The solutions that should be stored.", "TSPTour", 1)); 78 solDict = new PermutationSolutionDictionary<PermutationWrapper, int>();79 73 } 80 74 … … 85 79 public override IOperation Apply() { 86 80 ItemArray<Permutation> solutions = SolutionParameter.ActualValue; 81 PermutationSolutionDictionary<PermutationWrapper, PermutationInformation> solDict; 82 83 if (!Results.ContainsKey("SolutionCache")) { 84 solDict = new PermutationSolutionDictionary<PermutationWrapper, PermutationInformation>(); 85 Results.Add(new Result("SolutionCache", solDict)); 86 } else { 87 solDict = (PermutationSolutionDictionary<PermutationWrapper, PermutationInformation>)Results["SolutionCache"].Value; 88 } 87 89 88 90 foreach (var sol in solutions) { 89 solDict.Add(new PermutationWrapper(sol), GenerationsParameter.ActualValue.Value); 91 PermutationInformation info = new PermutationInformation(); 92 info.Generation = GenerationsParameter.ActualValue.Value; 93 info.ProducedBy = ProducedBy.Mutation; 94 95 solDict.Add(new PermutationWrapper(sol), info); 90 96 } 91 92 if (!ResultsParameter.ActualValue.ContainsKey("SolutionCache")) {93 ResultsParameter.ActualValue.Add(new Result("SolutionCache", solDict));94 }95 96 97 return base.Apply(); 97 98 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/SolutionsCaching/SolutionDictionary.cs
r9723 r9728 66 66 return solutionDictionary.ContainsKey(key); 67 67 } 68 69 public int Size() { 70 return solutionDictionary.Count; 71 } 68 72 } 69 73 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.sln
r9723 r9728 5 5 ProjectSection(SolutionItems) = preProject 6 6 Build.cmd = Build.cmd 7 Performance1.psess = Performance1.psess8 7 PreBuildEvent.cmd = PreBuildEvent.cmd 9 8 EndProjectSection
Note: See TracChangeset
for help on using the changeset viewer.