- Timestamp:
- 10/24/18 18:48:10 (6 years ago)
- Location:
- trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashExtensions.cs
r16252 r16255 120 120 121 121 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 122 124 for (int i = 0; i < nodes.Length; ++i) { 123 125 var node = nodes[i]; … … 136 138 var sorted = new HashNode<T>[size]; 137 139 var indices = nodes.IterateChildren(i); 138 Array.Sort(indices, (a, b) => nodes[a].CompareTo(nodes[b]));140 Array.Sort(indices, sort); 139 141 140 142 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 22 using System.Collections.Generic; 2 23 using System.Linq; 3 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 103 124 var variableTreeNode = (VariableTreeNode)treeNodes[i]; 104 125 variableTreeNode.VariableName = variable.VariableName; 105 variableTreeNode.Weight = 1;126 variableTreeNode.Weight = variable.Weight; 106 127 } else if (node.Data is ConstantTreeNode @const) { 107 128 var constantTreeNode = (ConstantTreeNode)treeNodes[i]; … … 175 196 var d = children[k]; 176 197 if (nodes[d].Data.Symbol is Constant) { 177 ((ConstantTreeNode)child.Data).Value *= ((ConstantTreeNode)nodes[d].Data).Value;178 198 nodes[d].Enabled = false; 179 199 node.Arity--;
Note: See TracChangeset
for help on using the changeset viewer.