Changeset 12422 for trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/ReplaceBranchManipulation.cs
- Timestamp:
- 06/10/15 11:29:34 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/ReplaceBranchManipulation.cs
r12012 r12422 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Linq; 23 24 using HeuristicLab.Common; … … 26 27 using HeuristicLab.Parameters; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using System.Collections.Generic;29 29 30 30 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { … … 78 78 int tries = 0; 79 79 do { 80 #pragma warning disable 612, 618 80 81 parent = symbolicExpressionTree.Root.IterateNodesPrefix().Skip(1).Where(n => n.SubtreeCount > 0).SelectRandom(random); 82 #pragma warning restore 612, 618 83 81 84 childIndex = random.Next(parent.SubtreeCount); 82 85 var child = parent.GetSubtree(childIndex); … … 99 102 if (tries < MAX_TRIES) { 100 103 var weights = allowedSymbols.Select(s => s.InitialFrequency).ToList(); 104 #pragma warning disable 612, 618 101 105 var seedSymbol = allowedSymbols.SelectRandom(weights, random); 106 #pragma warning restore 612, 618 107 102 108 // replace the old node with the new node 103 109 var seedNode = seedSymbol.CreateTreeNode();
Note: See TracChangeset
for help on using the changeset viewer.