Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16255


Ignore:
Timestamp:
10/24/18 18:48:10 (6 years ago)
Author:
bburlacu
Message:

#2950: Implement first version of hash-based building blocks analyzer. Minor performance improvement in HashExtensions.cs. Fix bug in SymbolicExpressionTreeHash.cs with simplification for Multiplication nodes inadvertently altering constant values.

Location:
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashExtensions.cs

    r16252 r16255  
    120120
    121121    public static HashNode<T>[] Sort<T>(this HashNode<T>[] nodes) where T : class {
     122      int sort(int a, int b) => nodes[a].CompareTo(nodes[b]);
     123
    122124      for (int i = 0; i < nodes.Length; ++i) {
    123125        var node = nodes[i];
     
    136138            var sorted = new HashNode<T>[size];
    137139            var indices = nodes.IterateChildren(i);
    138             Array.Sort(indices, (a, b) => nodes[a].CompareTo(nodes[b]));
     140            Array.Sort(indices, sort);
    139141
    140142            int idx = 0;
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/SymbolicExpressionTreeHash.cs

    r16252 r16255  
    1 using System.Collections.Generic;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2018 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.Collections.Generic;
    223using System.Linq;
    324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    103124            var variableTreeNode = (VariableTreeNode)treeNodes[i];
    104125            variableTreeNode.VariableName = variable.VariableName;
    105             variableTreeNode.Weight = 1;
     126            variableTreeNode.Weight = variable.Weight;
    106127          } else if (node.Data is ConstantTreeNode @const) {
    107128            var constantTreeNode = (ConstantTreeNode)treeNodes[i];
     
    175196            var d = children[k];
    176197            if (nodes[d].Data.Symbol is Constant) {
    177               ((ConstantTreeNode)child.Data).Value *= ((ConstantTreeNode)nodes[d].Data).Value;
    178198              nodes[d].Enabled = false;
    179199              node.Arity--;
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r16218 r16255  
    123123  <ItemGroup>
    124124    <Compile Include="Analyzers\SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs" />
     125    <Compile Include="Analyzers\SymbolicDataAnalysisBuildingBlockAnalyzer.cs" />
    125126    <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs" />
    126127    <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs" />
Note: See TracChangeset for help on using the changeset viewer.