- Timestamp:
- 06/21/12 18:02:33 (13 years ago)
- Location:
- branches/GP-MoveOperators
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-MoveOperators
- Property svn:ignore
-
old new 20 20 bin 21 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/GP-MoveOperators/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding (added) merged: 7836,7955,7961,7964,7972
- Property svn:mergeinfo changed
-
branches/GP-MoveOperators/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs
r7259 r8085 161 161 .Where(s => seedNode.Grammar.IsAllowedChildSymbol(seedNode.Symbol, s, i)) 162 162 .ToList(); 163 var selectedSymbol = possibleSymbols.SelectRandom(random); 163 var weights = possibleSymbols.Select(s => s.InitialFrequency).ToList(); 164 var selectedSymbol = possibleSymbols.SelectRandom(weights, random); 164 165 var tree = selectedSymbol.CreateTreeNode(); 165 166 if (tree.HasLocalParameters) tree.ResetLocalParameters(random); … … 192 193 if (!possibleSymbols.Any()) 193 194 throw new InvalidOperationException("No symbols are available for the tree."); 194 195 var selectedSymbol = possibleSymbols.SelectRandom( random);195 var weights = possibleSymbols.Select(s => s.InitialFrequency).ToList(); 196 var selectedSymbol = possibleSymbols.SelectRandom(weights, random); 196 197 var tree = selectedSymbol.CreateTreeNode(); 197 198 if (tree.HasLocalParameters) tree.ResetLocalParameters(random); -
branches/GP-MoveOperators/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs
r7259 r8085 160 160 .Where(s => seedNode.Grammar.IsAllowedChildSymbol(seedNode.Symbol, s, i)) 161 161 .ToList(); 162 var selectedSymbol = possibleSymbols.SelectRandom(random); 162 var weights = possibleSymbols.Select(s => s.InitialFrequency).ToList(); 163 var selectedSymbol = possibleSymbols.SelectRandom(weights, random); 163 164 var tree = selectedSymbol.CreateTreeNode(); 164 165 if (tree.HasLocalParameters) tree.ResetLocalParameters(random); … … 178 179 throw new ArgumentException("Cannot grow node of arity zero. Expected a function node."); 179 180 180 var allowedSymbols = root.Grammar.AllowedSymbols 181 .Where(s => s.InitialFrequency > 0.0) 182 .ToList(); 181 var allowedSymbols = root.Grammar.AllowedSymbols.Where(s => s.InitialFrequency > 0.0).ToList(); 183 182 184 183 for (var i = 0; i < arity; i++) { … … 187 186 root.Grammar.GetMinimumExpressionDepth(s) - 1 <= maxDepth - currentDepth) 188 187 .ToList(); 188 189 189 if (!possibleSymbols.Any()) 190 190 throw new InvalidOperationException("No symbols are available for the tree."); 191 var selectedSymbol = possibleSymbols.SelectRandom(random); 191 var weights = possibleSymbols.Select(s => s.InitialFrequency).ToList(); 192 var selectedSymbol = possibleSymbols.SelectRandom(weights, random); 192 193 var tree = selectedSymbol.CreateTreeNode(); 193 194 if (tree.HasLocalParameters) tree.ResetLocalParameters(random); -
branches/GP-MoveOperators/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/OnePointShaker.cs
r7259 r8085 57 57 58 58 protected override void Manipulate(IRandom random, ISymbolicExpressionTree tree) { 59 OnePointShaker.Shake(random, tree, ShakingFactor); 60 } 61 62 public static void Shake(IRandom random, ISymbolicExpressionTree tree, double shakingFactor) { 59 63 List<ISymbolicExpressionTreeNode> parametricNodes = new List<ISymbolicExpressionTreeNode>(); 60 64 tree.Root.ForEachNodePostfix(n => { … … 63 67 if (parametricNodes.Count > 0) { 64 68 var selectedPoint = parametricNodes.SelectRandom(random); 65 selectedPoint.ShakeLocalParameters(random, ShakingFactor);69 selectedPoint.ShakeLocalParameters(random, shakingFactor); 66 70 } 67 71 }
Note: See TracChangeset
for help on using the changeset viewer.