Changeset 11694


Ignore:
Timestamp:
12/17/14 18:52:37 (8 years ago)
Author:
bburlacu
Message:

#1772: Fixed cloning in tracking operators for symbolic data analysis. Added unit tests (in progress).

Location:
branches/HeuristicLab.EvolutionTracking
Files:
5 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs

    r11639 r11694  
    4646      : base(original, cloner) {
    4747      RebuildDictionaries();
     48
     49      foreach (var arcs in Vertices.Select(v => (List<IArc>)((Vertex)v).InArcs)) {
     50        arcs.Sort((a, b) => {
     51          if (a.Data == b.Data)
     52            return 0;
     53          if (a.Data == null)
     54            return -1;
     55          return 1;
     56        });
     57      }
    4858    }
    4959
     
    6070    private void AfterDeserialization() {
    6171      RebuildDictionaries();
     72
     73      foreach (var arcs in Vertices.Select(v => (List<IArc>)((Vertex)v).InArcs)) {
     74        arcs.Sort((a, b) => {
     75          if (a.Data == b.Data)
     76            return 0;
     77          if (a.Data == null)
     78            return -1;
     79          return 1;
     80        });
     81      }
    6282    }
    6383
     
    91111        throw new InvalidOperationException("Duplicate ids are not allowed in the genealogy graph.");
    92112      idMap[genealogyGraphNode.Id] = genealogyGraphNode;
    93       if (!Ranks.ContainsKey(genealogyGraphNode.Rank))
    94         Ranks[genealogyGraphNode.Rank] = new List<IGenealogyGraphNode>();
    95       Ranks[genealogyGraphNode.Rank].Add(genealogyGraphNode);
     113      if (!ranks.ContainsKey(genealogyGraphNode.Rank))
     114        ranks[genealogyGraphNode.Rank] = new List<IGenealogyGraphNode>();
     115      ranks[genealogyGraphNode.Rank].Add(genealogyGraphNode);
    96116    }
    97117
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r11638 r11694  
    136136      <Private>False</Private>
    137137    </Reference>
    138     <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    139       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
    140       <Private>False</Private>
    141     </Reference>
    142138    <Reference Include="HeuristicLab.MainForm-3.3">
    143139      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
     
    223219    <Compile Include="MenuItems\OptimizeDataAnalysisRunsMenuItem.cs" />
    224220    <Compile Include="Plugin.cs" />
    225     <Compile Include="SlidingWindowDataView.cs" />
     221    <Compile Include="SlidingWindowDataView.cs">
     222      <SubType>UserControl</SubType>
     223    </Compile>
    226224    <Compile Include="SlidingWindowDataView.Designer.cs">
    227225      <DependentUpon>SlidingWindowDataView.cs</DependentUpon>
     
    245243      <DependentUpon>GraphicalSymbolicDataAnalysisModelView.cs</DependentUpon>
    246244    </Compile>
    247     <Compile Include="Symbols\ConstantView.cs" />
     245    <Compile Include="Symbols\ConstantView.cs">
     246      <SubType>UserControl</SubType>
     247    </Compile>
    248248    <Compile Include="Symbols\ConstantView.Designer.cs">
    249249      <DependentUpon>ConstantView.cs</DependentUpon>
    250250    </Compile>
    251     <Compile Include="Symbols\LaggedVariableView.cs" />
     251    <Compile Include="Symbols\LaggedVariableView.cs">
     252      <SubType>UserControl</SubType>
     253    </Compile>
    252254    <Compile Include="Symbols\LaggedVariableView.Designer.cs">
    253255      <DependentUpon>LaggedVariableView.cs</DependentUpon>
    254256    </Compile>
    255     <Compile Include="Symbols\TimeLagView.cs" />
     257    <Compile Include="Symbols\TimeLagView.cs">
     258      <SubType>UserControl</SubType>
     259    </Compile>
    256260    <Compile Include="Symbols\TimeLagView.Designer.cs">
    257261      <DependentUpon>TimeLagView.cs</DependentUpon>
    258262    </Compile>
    259     <Compile Include="Symbols\VariableConditionView.cs" />
     263    <Compile Include="Symbols\VariableConditionView.cs">
     264      <SubType>UserControl</SubType>
     265    </Compile>
    260266    <Compile Include="Symbols\VariableConditionView.Designer.cs">
    261267      <DependentUpon>VariableConditionView.cs</DependentUpon>
    262268    </Compile>
    263     <Compile Include="Symbols\VariableView.cs" />
     269    <Compile Include="Symbols\VariableView.cs">
     270      <SubType>UserControl</SubType>
     271    </Compile>
    264272    <Compile Include="Symbols\VariableView.Designer.cs">
    265273      <DependentUpon>VariableView.cs</DependentUpon>
    266274    </Compile>
    267     <Compile Include="Tracking\FragmentGraphView.cs" />
     275    <Compile Include="Tracking\FragmentGraphView.cs">
     276      <SubType>UserControl</SubType>
     277    </Compile>
    268278    <Compile Include="Tracking\FragmentGraphView.Designer.cs">
    269279      <DependentUpon>FragmentGraphView.cs</DependentUpon>
    270280    </Compile>
    271     <Compile Include="Tracking\SymboldDataAnalysisGenealogyView.cs" />
     281    <Compile Include="Tracking\SymboldDataAnalysisGenealogyView.cs">
     282      <SubType>UserControl</SubType>
     283    </Compile>
    272284    <Compile Include="Tracking\SymboldDataAnalysisGenealogyView.Designer.cs">
    273285      <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
     
    325337      <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4</Name>
    326338      <Private>False</Private>
     339    </ProjectReference>
     340    <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj">
     341      <Project>{06d4a186-9319-48a0-bade-a2058d462eea}</Project>
     342      <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name>
    327343    </ProjectReference>
    328344    <ProjectReference Include="..\..\HeuristicLab.EvolutionTracking.Views\3.4\HeuristicLab.EvolutionTracking.Views-3.4.csproj">
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs

    r11350 r11694  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2728using HeuristicLab.EvolutionTracking;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2830
    2931namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3032  public class SymbolicDataAnalysisExpressionAfterCrossoverOperator : AfterCrossoverOperator<ISymbolicExpressionTree> {
     33    public SymbolicDataAnalysisExpressionAfterCrossoverOperator() { }
     34
     35    protected SymbolicDataAnalysisExpressionAfterCrossoverOperator(SymbolicDataAnalysisExpressionAfterCrossoverOperator original, Cloner cloner)
     36      : base(original, cloner) {
     37    }
     38
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new SymbolicDataAnalysisExpressionAfterCrossoverOperator(this, cloner);
     41    }
     42
     43    [StorableConstructor]
     44    protected SymbolicDataAnalysisExpressionAfterCrossoverOperator(bool deserializing) : base(deserializing) { }
     45
    3146    public override IOperation Apply() {
    32       var childVertex = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph.GetByContent(ChildParameter.ActualValue);
     47      var childVertex = GenealogyGraph.GetByContent(ChildParameter.ActualValue);
    3348      var arcs = childVertex.InArcs.ToList();
    3449      var nodes0 = (List<ISymbolicExpressionTreeNode>)arcs[0].Data;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs

    r11387 r11694  
    2121
    2222using System.Linq;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2526using HeuristicLab.EvolutionTracking;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2628
    2729namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    2830  public class SymbolicDataAnalysisExpressionAfterManipulatorOperator : AfterManipulatorOperator<ISymbolicExpressionTree> {
     31    public SymbolicDataAnalysisExpressionAfterManipulatorOperator() { }
     32
     33    protected SymbolicDataAnalysisExpressionAfterManipulatorOperator(SymbolicDataAnalysisExpressionAfterManipulatorOperator original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36
     37    public override IDeepCloneable Clone(Cloner cloner) {
     38      return new SymbolicDataAnalysisExpressionAfterManipulatorOperator(this, cloner);
     39    }
     40
     41    [StorableConstructor]
     42    protected SymbolicDataAnalysisExpressionAfterManipulatorOperator(bool deserializing) : base(deserializing) { }
     43
    2944    public override IOperation Apply() {
    3045      var child = ChildParameter.ActualValue;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeCrossoverOperator.cs

    r11233 r11694  
    2121
    2222using System.Linq;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2526using HeuristicLab.EvolutionTracking;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2628
    2729namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    2830  public class SymbolicDataAnalysisExpressionBeforeCrossoverOperator : BeforeCrossoverOperator<ISymbolicExpressionTree> {
     31    public SymbolicDataAnalysisExpressionBeforeCrossoverOperator() { }
     32
     33    protected SymbolicDataAnalysisExpressionBeforeCrossoverOperator(SymbolicDataAnalysisExpressionBeforeCrossoverOperator original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36
     37    public override IDeepCloneable Clone(Cloner cloner) {
     38      return new SymbolicDataAnalysisExpressionBeforeCrossoverOperator(this, cloner);
     39    }
     40
     41    [StorableConstructor]
     42    protected SymbolicDataAnalysisExpressionBeforeCrossoverOperator(bool deserializing) : base(deserializing) { }
     43
    2944    public override IOperation Apply() {
    3045      var result = base.Apply(); // the base operator will add the child to the graph before the actual crossover operation takes place
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeManipulatorOperator.cs

    r11387 r11694  
    2121
    2222using System.Linq;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2526using HeuristicLab.EvolutionTracking;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2628
    2729namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    2830  public class SymbolicDataAnalysisExpressionBeforeManipulatorOperator : BeforeManipulatorOperator<ISymbolicExpressionTree> {
     31    public SymbolicDataAnalysisExpressionBeforeManipulatorOperator() { }
     32
     33    protected SymbolicDataAnalysisExpressionBeforeManipulatorOperator(SymbolicDataAnalysisExpressionBeforeManipulatorOperator original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36
     37    public override IDeepCloneable Clone(Cloner cloner) {
     38      return new SymbolicDataAnalysisExpressionBeforeManipulatorOperator(this, cloner);
     39    }
     40
     41    [StorableConstructor]
     42    protected SymbolicDataAnalysisExpressionBeforeManipulatorOperator(bool deserializing) : base(deserializing) { }
     43
    2944    public override IOperation Apply() {
    3045      // the call below does the following things:
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Tracking.sln

    r11208 r11694  
    22Microsoft Visual Studio Solution File, Format Version 12.00
    33# Visual Studio 2013
    4 VisualStudioVersion = 12.0.30501.0
     4VisualStudioVersion = 12.0.31101.0
    55MinimumVisualStudioVersion = 10.0.40219.1
    66Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C80F4C35-CB87-4695-8A53-6F2D08275253}"
     
    2929EndProject
    3030Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.TravelingSalesman.Views-3.3", "HeuristicLab.Problems.TravelingSalesman.Views\3.3\HeuristicLab.Problems.TravelingSalesman.Views-3.3.csproj", "{CDA28124-ACD0-4231-8EB0-C510B361F84E}"
     31EndProject
     32Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.EvolutionTracking.Tests", "HeuristicLab.EvolutionTracking.Tests\HeuristicLab.EvolutionTracking.Tests.csproj", "{F065C97D-A66B-401C-AD1B-78D59E14BEDA}"
    3133EndProject
    3234Global
     
    166168    {CDA28124-ACD0-4231-8EB0-C510B361F84E}.Release|x86.ActiveCfg = Release|x86
    167169    {CDA28124-ACD0-4231-8EB0-C510B361F84E}.Release|x86.Build.0 = Release|x86
     170    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     171    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
     172    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
     173    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
     174    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Debug|x64.ActiveCfg = Debug|Any CPU
     175    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Debug|x86.ActiveCfg = Debug|Any CPU
     176    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
     177    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Release|Any CPU.Build.0 = Release|Any CPU
     178    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
     179    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
     180    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Release|x64.ActiveCfg = Release|Any CPU
     181    {F065C97D-A66B-401C-AD1B-78D59E14BEDA}.Release|x86.ActiveCfg = Release|Any CPU
    168182  EndGlobalSection
    169183  GlobalSection(SolutionProperties) = preSolution
Note: See TracChangeset for help on using the changeset viewer.