Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10884


Ignore:
Timestamp:
05/21/14 23:39:19 (9 years ago)
Author:
bburlacu
Message:

#1772: Added license headers where they were missing. Introduced an id map to the DirectedGraph to get graph vertices based on the id injected in the scopes by the genealogy analyzer.

Location:
branches/HeuristicLab.EvolutionTracking
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs

    r10839 r10884  
    2828using HeuristicLab.Common;
    2929using HeuristicLab.Visualization;
    30 
    3130using Rectangle = HeuristicLab.Visualization.Rectangle;
    3231
     
    143142      Clear();
    144143      var actualRoot = Root;
    145       if (Root.Symbol is ProgramRootSymbol && Root.SubtreeCount == 1) { actualRoot = Root.GetSubtree(0).GetSubtree(0); }
     144      //      if (Root.Symbol is ProgramRootSymbol && Root.SubtreeCount == 1) { actualRoot = Root.GetSubtree(0).GetSubtree(0); }
    146145
    147146      LayoutEngine.NodeWidth = PreferredNodeWidth;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/HeuristicLab.EvolutionTracking.Views-3.4.csproj

    r10514 r10884  
    9797      <DependentUpon>FrequentFragmentsDialog.cs</DependentUpon>
    9898    </Compile>
    99     <Compile Include="GenealogyGraphChart.cs">
    100       <SubType>UserControl</SubType>
    101     </Compile>
     99    <Compile Include="GenealogyGraphChart.cs" />
    102100    <Compile Include="GenealogyGraphChart.Designer.cs">
    103101      <DependentUpon>GenealogyGraphChart.cs</DependentUpon>
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs

    r10833 r10884  
    1 using System.Linq;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System.Linq;
    223using HeuristicLab.Common;
    324using HeuristicLab.Core;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/DirectedGraph.cs

    r10833 r10884  
    3333  public class DirectedGraph : Item, IDirectedGraph {
    3434    [Storable]
    35     protected readonly List<IVertex> nodes; // for performance reasons, maybe this should be a linked list (fast remove)
    36     public List<IVertex> Nodes {
     35    private readonly List<IVertex> nodes; // for performance reasons, maybe this should be a linked list (fast remove)
     36    public IEnumerable<IVertex> Nodes {
    3737      get { return nodes; }
    3838    }
     39
     40    [Storable]
     41    private readonly Dictionary<string, IVertex> idMap;
     42
    3943    [Storable]
    4044    private readonly Dictionary<object, IVertex> contentMap;
     
    4246      nodes = new List<IVertex>();
    4347      contentMap = new Dictionary<object, IVertex>();
     48      idMap = new Dictionary<string, IVertex>();
    4449    }
    4550    [StorableConstructor]
     
    5156      nodes = new List<IVertex>(original.Nodes);
    5257      contentMap = new Dictionary<object, IVertex>(original.contentMap);
     58      idMap = new Dictionary<string, IVertex>(original.idMap);
    5359    }
    5460    public override IDeepCloneable Clone(Cloner cloner) {
     
    6268      return contentMap.ContainsKey(content);
    6369    }
     70
     71    public IVertex GetVertex(string id) {
     72      IVertex result;
     73      idMap.TryGetValue(id, out result);
     74      return result;
     75    }
     76
    6477    public IVertex this[object key] {
    6578      get {
     
    6982      }
    7083      set {
     84        if (contentMap.ContainsKey(key)) {
     85          idMap.Remove(contentMap[key].Id);
     86        }
    7187        contentMap[key] = value;
     88        idMap[value.Id] = value;
    7289      }
    7390    }
     
    8198      nodes.Clear();
    8299      contentMap.Clear();
     100      idMap.Clear();
    83101    }
    84102    public virtual void AddVertex(IVertex vertex) {
     
    87105      }
    88106      contentMap[vertex.Content] = vertex;
    89       Nodes.Add(vertex);
     107      idMap[vertex.Id] = vertex;
     108      nodes.Add(vertex);
    90109    }
    91110
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IDirectedGraph.cs

    r10833 r10884  
    3131    void AddVertex(IVertex vertex);
    3232    void RemoveVertex(IVertex vertex);
    33     List<IVertex> Nodes { get; }
     33    IEnumerable<IVertex> Nodes { get; }
    3434    IVertex this[object content] { get; set; }
    3535    bool Contains(object content);
     36    IVertex GetVertex(string id);
    3637  }
    3738}
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeCrossoverOperator.cs

    r10830 r10884  
    6363    }
    6464
     65    private readonly Func<IScope, string> getScopeId = s => ((StringValue)s.Variables["Id"].Value).Value;
    6566    public override IOperation Apply() {
    6667      if (CurrentGeneration == null) throw new Exception();
    67       var parentVertices = (from s in ExecutionContext.Scope.SubScopes
    68                             let id = ((StringValue)s.Variables["Id"].Value).Value
    69                             select CurrentGeneration.First(x => x.Id == id)).ToList(); // the id is unique
     68      var subScopes = ExecutionContext.Scope.SubScopes;
     69      var parentVertices = subScopes.Select(x => (GenealogyGraphNode<T>)GenealogyGraph.GetVertex(getScopeId(x))).ToList();
    7070
    7171      var parents = ParentsParameter.ActualValue.ToList();
    7272
    7373      var childVertex = new GenealogyGraphNode<T> {
    74         // the child parameter does not have a value yet (it will be assigned after crossover), but the first parent is actually the future child so we use this
     74        // the child parameter does not have a value yet (it will be assigned after crossover),
     75        // but the first parent is actually the future child so we use this
    7576        Content = parents[0],
    7677        Rank = parentVertices[0].Rank + 1
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r10827 r10884  
    279279      <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
    280280    </Compile>
    281     <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs">
    282       <SubType>UserControl</SubType>
    283     </Compile>
     281    <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs" />
    284282    <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs">
    285283      <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon>
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/FragmentGraphView.cs

    r10840 r10884  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Drawing;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Matching/SymbolicExpressionTreeNodeSimilarityComparer.cs

    r10650 r10884  
    1 using HeuristicLab.Common;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Common;
    223using HeuristicLab.Core;
    324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionTracing.cs

    r10838 r10884  
    1 
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
    222using System;
    323using System.Collections.Generic;
Note: See TracChangeset for help on using the changeset viewer.