Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10026


Ignore:
Timestamp:
10/04/13 17:24:46 (11 years ago)
Author:
ascheibe
Message:

#1886

  • removed old caching code
  • adapted convex hull view and some other minor improvements
Location:
branches/HeuristicLab.Analysis.AlgorithmBehavior
Files:
4 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/AlgorithmBehaviorUnitTests.csproj

    r9945 r10026  
    7777  <ItemGroup>
    7878    <Compile Include="UnitTest2.cs" />
    79     <Compile Include="UnitTest1.cs" />
    8079    <Compile Include="Properties\AssemblyInfo.cs" />
    8180    <Compile Include="ConvexHullTest.cs" />
     
    8988      <Project>{2533d1f9-f7f6-46cb-90d2-76d254e38dee}</Project>
    9089      <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>
    9194    </ProjectReference>
    9295    <ProjectReference Include="..\MIConvexHull\MIConvexHull.csproj">
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/UnitTest2.cs

    r9757 r10026  
    11using System.Linq;
    2 using HeuristicLab.Analysis.AlgorithmBehavior.Analyzers;
     2using HeuristicLab.Analysis.SolutionCaching;
     3using HeuristicLab.Analysis.SolutionCaching.PermutationEncoding;
    34using HeuristicLab.Encodings.PermutationEncoding;
    45using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    1011    public void TestPermutationSolutionDictionary() {
    1112      var rand = new HeuristicLab.Random.FastRandom();
    12       PermutationWrapperEqualityComparer comp = new PermutationWrapperEqualityComparer();
    13       PermutationSolutionDictionary dict = new PermutationSolutionDictionary();
     13      PermutationEqualityComparer comp = new PermutationEqualityComparer();
     14      PermutationSolutionCache dict = new PermutationSolutionCache();
    1415      int realDuplicates = 0;
    1516      int noDuplicates = 0;
    1617
    17       PermutationWrapper[] permutations = new PermutationWrapper[500];
     18      Permutation[] permutations = new Permutation[500];
    1819      for (int i = 0; i < permutations.Length; i += 2) {
    1920        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;
    2323
    24         PermutationInformation pi = new PermutationInformation();
     24        PermutationSolutionInformation pi = new PermutationSolutionInformation();
    2525        pi.Generation = rand.Next(0, 100);
    2626        pi.ProducedBy = ProducedBy.Mutation;
    2727
    28         dict.Add(pw, pi);
     28        dict.Add(p, pi);
    2929      }
    3030
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/ConvexHullView.cs

    r10007 r10026  
    2222using System;
    2323using System.Linq;
    24 using System.Windows.Forms;
     24using HeuristicLab.Analysis.SolutionCaching.PermutationEncoding;
    2525using HeuristicLab.Core.Views;
    2626using HeuristicLab.Encodings.PermutationEncoding;
    2727using HeuristicLab.MainForm;
    28 using HeuristicLab.MainForm.WindowsForms;
    2928
    3029namespace HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views {
    3130  [View("ConvexHull View")]
    32   [Content(typeof(PermutationSolutionDictionary), false)]
     31  [Content(typeof(PermutationSolutionCache), false)]
    3332  public partial class ConvexHullView : ItemView {
    3433    public ConvexHullView() {
     
    3635    }
    3736
    38     public new PermutationSolutionDictionary Content {
    39       get { return (PermutationSolutionDictionary)base.Content; }
     37    public new PermutationSolutionCache Content {
     38      get { return (PermutationSolutionCache)base.Content; }
    4039      set { base.Content = value; }
    4140    }
     
    5150        var sols = Content.GetSolutionsFromGeneration(i);
    5251
    53         var input = sols.Select(x => ConvertPermutationToVertex(x.GetPermutation())).ToArray();
     52        var input = sols.Select(x => ConvertPermutationToVertex(x)).ToArray();
    5453        var convexHull = HyperHull.CalculateUsingSMO(input);
    5554        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  
    145145      <DependentUpon>ParameterInfluenceView.cs</DependentUpon>
    146146    </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>
    153147    <Compile Include="Plugin.cs" />
    154148    <Compile Include="Properties\AssemblyInfo.cs" />
     
    171165      <Name>HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3</Name>
    172166      <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>
    173175    </ProjectReference>
    174176    <ProjectReference Include="..\..\MIConvexHull\MIConvexHull.csproj">
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj

    r10007 r10026  
    133133    <Compile Include="ConvexHullMeasures.cs" />
    134134    <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" />
    141135    <Compile Include="SelectionPressureAnalyzer.cs" />
    142     <Compile Include="SolutionsCaching\PermutationInformation.cs" />
    143136    <Compile Include="SVM.cs" />
    144137    <Compile Include="WorstQualityAnalyzer.cs" />
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching.Views/3.3/SolutionCacheView.cs

    r10024 r10026  
    3030namespace HeuristicLab.Analysis.SolutionCaching.Views {
    3131  [View("SolutionCache View")]
    32   [Content(typeof(SolutionCache<,>), false)]
     32  [Content(typeof(SolutionCache<,>), true)]
    3333  public abstract partial class SolutionCacheView<TKey, TValue> : ItemView
    3434    where TKey : Item
    35     where TValue : Item {
     35    where TValue : SolutionInformation<TKey> {
    3636    public SolutionCacheView() {
    3737      InitializeComponent();
     
    4949      if (Content != null) {
    5050        cacheSizeTextBox.Text = Content.Size().ToString();
     51        InitializeMenu();
    5152      }
    5253    }
    5354
    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);
    5757      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)) {
    5959          ToolStripMenuItem menuItem = new ToolStripMenuItem();
    6060          menuItem.Text = ViewAttribute.GetViewName(viewType);
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RealVectorEncoding/RealVectorEqualityComparer.cs

    r10023 r10026  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
    2425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3536    public override bool Equals(RealVector x, RealVector y) {
    3637      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;
    3839      }
    3940      return true;
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/SolutionCache.cs

    r10023 r10026  
    2121
    2222using System.Collections.Generic;
     23using System.Linq;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    3233  public abstract class SolutionCache<TKey, TValue> : Item
    3334    where TKey : Item
    34     where TValue : Item {
     35    where TValue : SolutionInformation<TKey> {
    3536
    3637    [Storable]
     
    8384      return solutionDictionary.Count;
    8485    }
     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    }
    8590  }
    8691}
Note: See TracChangeset for help on using the changeset viewer.