Changeset 10026
- Timestamp:
- 10/04/13 17:24:46 (11 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior
- Files:
-
- 4 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/AlgorithmBehaviorUnitTests.csproj
r9945 r10026 77 77 <ItemGroup> 78 78 <Compile Include="UnitTest2.cs" /> 79 <Compile Include="UnitTest1.cs" />80 79 <Compile Include="Properties\AssemblyInfo.cs" /> 81 80 <Compile Include="ConvexHullTest.cs" /> … … 89 88 <Project>{2533d1f9-f7f6-46cb-90d2-76d254e38dee}</Project> 90 89 <Name>HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3</Name> 90 </ProjectReference> 91 <ProjectReference Include="..\HeuristicLab.Analysis.SolutionCaching\3.3\HeuristicLab.Analysis.SolutionCaching-3.3.csproj"> 92 <Project>{a05aa272-14ec-4422-ac70-c9ca42164441}</Project> 93 <Name>HeuristicLab.Analysis.SolutionCaching-3.3</Name> 91 94 </ProjectReference> 92 95 <ProjectReference Include="..\MIConvexHull\MIConvexHull.csproj"> -
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/UnitTest2.cs
r9757 r10026 1 1 using System.Linq; 2 using HeuristicLab.Analysis.AlgorithmBehavior.Analyzers; 2 using HeuristicLab.Analysis.SolutionCaching; 3 using HeuristicLab.Analysis.SolutionCaching.PermutationEncoding; 3 4 using HeuristicLab.Encodings.PermutationEncoding; 4 5 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 10 11 public void TestPermutationSolutionDictionary() { 11 12 var rand = new HeuristicLab.Random.FastRandom(); 12 Permutation WrapperEqualityComparer comp = new PermutationWrapperEqualityComparer();13 PermutationSolution Dictionary dict = new PermutationSolutionDictionary();13 PermutationEqualityComparer comp = new PermutationEqualityComparer(); 14 PermutationSolutionCache dict = new PermutationSolutionCache(); 14 15 int realDuplicates = 0; 15 16 int noDuplicates = 0; 16 17 17 Permutation Wrapper[] permutations = new PermutationWrapper[500];18 Permutation[] permutations = new Permutation[500]; 18 19 for (int i = 0; i < permutations.Length; i += 2) { 19 20 var p = new Permutation(PermutationTypes.RelativeUndirected, 21, rand); 20 var pw = new PermutationWrapper(p); 21 permutations[i] = pw; 22 permutations[i + 1] = pw; 21 permutations[i] = p; 22 permutations[i + 1] = p; 23 23 24 Permutation Information pi = new PermutationInformation();24 PermutationSolutionInformation pi = new PermutationSolutionInformation(); 25 25 pi.Generation = rand.Next(0, 100); 26 26 pi.ProducedBy = ProducedBy.Mutation; 27 27 28 dict.Add(p w, pi);28 dict.Add(p, pi); 29 29 } 30 30 -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/ConvexHullView.cs
r10007 r10026 22 22 using System; 23 23 using System.Linq; 24 using System.Windows.Forms;24 using HeuristicLab.Analysis.SolutionCaching.PermutationEncoding; 25 25 using HeuristicLab.Core.Views; 26 26 using HeuristicLab.Encodings.PermutationEncoding; 27 27 using HeuristicLab.MainForm; 28 using HeuristicLab.MainForm.WindowsForms;29 28 30 29 namespace HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views { 31 30 [View("ConvexHull View")] 32 [Content(typeof(PermutationSolution Dictionary), false)]31 [Content(typeof(PermutationSolutionCache), false)] 33 32 public partial class ConvexHullView : ItemView { 34 33 public ConvexHullView() { … … 36 35 } 37 36 38 public new PermutationSolution DictionaryContent {39 get { return (PermutationSolution Dictionary)base.Content; }37 public new PermutationSolutionCache Content { 38 get { return (PermutationSolutionCache)base.Content; } 40 39 set { base.Content = value; } 41 40 } … … 51 50 var sols = Content.GetSolutionsFromGeneration(i); 52 51 53 var input = sols.Select(x => ConvertPermutationToVertex(x .GetPermutation())).ToArray();52 var input = sols.Select(x => ConvertPermutationToVertex(x)).ToArray(); 54 53 var convexHull = HyperHull.CalculateUsingSMO(input); 55 54 resultsTextBox.Text += "Nr. of Points in Generation " + i + ": " + convexHull.Count + Environment.NewLine; -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views-3.3.csproj
r9945 r10026 145 145 <DependentUpon>ParameterInfluenceView.cs</DependentUpon> 146 146 </Compile> 147 <Compile Include="PermutationSolutionDictionaryView.cs">148 <SubType>UserControl</SubType>149 </Compile>150 <Compile Include="PermutationSolutionDictionaryView.Designer.cs">151 <DependentUpon>PermutationSolutionDictionaryView.cs</DependentUpon>152 </Compile>153 147 <Compile Include="Plugin.cs" /> 154 148 <Compile Include="Properties\AssemblyInfo.cs" /> … … 171 165 <Name>HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3</Name> 172 166 <Private>False</Private> 167 </ProjectReference> 168 <ProjectReference Include="..\..\HeuristicLab.Analysis.SolutionCaching.Views\3.3\HeuristicLab.Analysis.SolutionCaching.Views-3.3.csproj"> 169 <Project>{3977f98a-3d59-4d02-a6d3-51021bceb488}</Project> 170 <Name>HeuristicLab.Analysis.SolutionCaching.Views-3.3</Name> 171 </ProjectReference> 172 <ProjectReference Include="..\..\HeuristicLab.Analysis.SolutionCaching\3.3\HeuristicLab.Analysis.SolutionCaching-3.3.csproj"> 173 <Project>{a05aa272-14ec-4422-ac70-c9ca42164441}</Project> 174 <Name>HeuristicLab.Analysis.SolutionCaching-3.3</Name> 173 175 </ProjectReference> 174 176 <ProjectReference Include="..\..\MIConvexHull\MIConvexHull.csproj"> -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj
r10007 r10026 133 133 <Compile Include="ConvexHullMeasures.cs" /> 134 134 <Compile Include="IntegerExtensions.cs" /> 135 <Compile Include="SolutionsCaching\AfterCrossoverSolutionCachingAnalyzer.cs" />136 <Compile Include="SolutionsCaching\SolutionCachingAnalyzer.cs" />137 <Compile Include="SolutionsCaching\PermutationSolutionDictionary.cs" />138 <Compile Include="SolutionsCaching\PermutationWrapper.cs" />139 <Compile Include="SolutionsCaching\PermutationWrapperEqualityComparer.cs" />140 <Compile Include="SolutionsCaching\SolutionDictionary.cs" />141 135 <Compile Include="SelectionPressureAnalyzer.cs" /> 142 <Compile Include="SolutionsCaching\PermutationInformation.cs" />143 136 <Compile Include="SVM.cs" /> 144 137 <Compile Include="WorstQualityAnalyzer.cs" /> -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching.Views/3.3/SolutionCacheView.cs
r10024 r10026 30 30 namespace HeuristicLab.Analysis.SolutionCaching.Views { 31 31 [View("SolutionCache View")] 32 [Content(typeof(SolutionCache<,>), false)]32 [Content(typeof(SolutionCache<,>), true)] 33 33 public abstract partial class SolutionCacheView<TKey, TValue> : ItemView 34 34 where TKey : Item 35 where TValue : Item{35 where TValue : SolutionInformation<TKey> { 36 36 public SolutionCacheView() { 37 37 InitializeComponent(); … … 49 49 if (Content != null) { 50 50 cacheSizeTextBox.Text = Content.Size().ToString(); 51 InitializeMenu(); 51 52 } 52 53 } 53 54 54 protected override void OnInitialized(EventArgs e) { 55 base.OnInitialized(e); 56 var viewTypes = MainFormManager.GetViewTypes(typeof(SolutionCache<TKey, TValue>), true); 55 protected virtual void InitializeMenu() { 56 var viewTypes = MainFormManager.GetViewTypes(this.Content.GetType(), false); 57 57 foreach (Type viewType in viewTypes.OrderBy(x => ViewAttribute.GetViewName(x))) { 58 if ( (viewType != typeof(SolutionCacheView<TKey, TValue>)) && (viewType != typeof(ViewHost))) {58 if (viewType != typeof(ViewHost)) { 59 59 ToolStripMenuItem menuItem = new ToolStripMenuItem(); 60 60 menuItem.Text = ViewAttribute.GetViewName(viewType); -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RealVectorEncoding/RealVectorEqualityComparer.cs
r10023 r10026 21 21 22 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 35 36 public override bool Equals(RealVector x, RealVector y) { 36 37 for (int i = 0; i < x.Length; i++) { 37 if ( x[i] != y[i]) return false;38 if (!x[i].IsAlmost(y[i])) return false; 38 39 } 39 40 return true; -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/SolutionCache.cs
r10023 r10026 21 21 22 22 using System.Collections.Generic; 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 32 33 public abstract class SolutionCache<TKey, TValue> : Item 33 34 where TKey : Item 34 where TValue : Item{35 where TValue : SolutionInformation<TKey> { 35 36 36 37 [Storable] … … 83 84 return solutionDictionary.Count; 84 85 } 86 87 public virtual List<TKey> GetSolutionsFromGeneration(int generation) { 88 return solutionDictionary.Where(x => x.Value.Count(y => y.Generation == generation) != 0).Select(x => x.Key).ToList<TKey>(); 89 } 85 90 } 86 91 }
Note: See TracChangeset
for help on using the changeset viewer.