Changeset 17226 for branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars
- Timestamp:
- 08/29/19 15:57:35 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
- Property svn:mergeinfo changed
/branches/2435-alglib_3_15/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding (added) merged: 17034 /trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding merged: 17020,17037,17180,17184
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/EmptySymbolicExpressionTreeGrammar.cs
r16723 r17226 2 2 3 3 /* HeuristicLab 4 * Copyright (C) 2002-2019Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 5 5 * 6 6 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/GrammarUtils.cs
r16723 r17226 2 2 3 3 /* HeuristicLab 4 * Copyright (C) 2002-2019Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 5 5 * 6 6 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/SimpleSymbolicExpressionGrammar.cs
r16723 r17226 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2019Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/SymbolicExpressionGrammar.cs
r16723 r17226 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2019Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/SymbolicExpressionGrammarBase.cs
r16723 r17226 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2019Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { … … 38 38 39 39 #region properties for separation between implementation and persistence 40 private IEnumerable<ISymbol> storableSymbols; 40 41 [Storable(Name = "Symbols")] 41 42 private IEnumerable<ISymbol> StorableSymbols { 42 43 get { return symbols.Values.ToArray(); } 43 set { foreach (var s in value) symbols.Add(s.Name, s); } 44 } 45 44 set { storableSymbols = value; } 45 } 46 47 private IEnumerable<KeyValuePair<ISymbol, Tuple<int, int>>> storableSymbolSubtreeCount; 46 48 [Storable(Name = "SymbolSubtreeCount")] 47 49 private IEnumerable<KeyValuePair<ISymbol, Tuple<int, int>>> StorableSymbolSubtreeCount { 48 50 get { return symbolSubtreeCount.Select(x => new KeyValuePair<ISymbol, Tuple<int, int>>(GetSymbol(x.Key), x.Value)).ToArray(); } 49 set { foreach (var pair in value) symbolSubtreeCount.Add(pair.Key.Name, pair.Value); } 50 } 51 51 set { storableSymbolSubtreeCount = value; } 52 } 53 54 private IEnumerable<KeyValuePair<ISymbol, IEnumerable<ISymbol>>> storableAllowedChildSymbols; 52 55 [Storable(Name = "AllowedChildSymbols")] 53 56 private IEnumerable<KeyValuePair<ISymbol, IEnumerable<ISymbol>>> StorableAllowedChildSymbols { 54 57 get { return allowedChildSymbols.Select(x => new KeyValuePair<ISymbol, IEnumerable<ISymbol>>(GetSymbol(x.Key), x.Value.Select(GetSymbol).ToArray())).ToArray(); } 55 set { foreach (var pair in value) allowedChildSymbols.Add(pair.Key.Name, pair.Value.Select(y => y.Name).ToList()); } 56 } 57 58 set { storableAllowedChildSymbols = value; } 59 } 60 61 private IEnumerable<KeyValuePair<Tuple<ISymbol, int>, IEnumerable<ISymbol>>> storableAllowedChildSymbolsPerIndex; 58 62 [Storable(Name = "AllowedChildSymbolsPerIndex")] 59 63 private IEnumerable<KeyValuePair<Tuple<ISymbol, int>, IEnumerable<ISymbol>>> StorableAllowedChildSymbolsPerIndex { 60 64 get { return allowedChildSymbolsPerIndex.Select(x => new KeyValuePair<Tuple<ISymbol, int>, IEnumerable<ISymbol>>(Tuple.Create(GetSymbol(x.Key.Item1), x.Key.Item2), x.Value.Select(GetSymbol).ToArray())).ToArray(); } 61 set { 62 foreach (var pair in value) 63 allowedChildSymbolsPerIndex.Add(Tuple.Create(pair.Key.Item1.Name, pair.Key.Item2), pair.Value.Select(y => y.Name).ToList()); 64 } 65 set { storableAllowedChildSymbolsPerIndex = value; } 65 66 } 66 67 #endregion … … 88 89 89 90 suppressEvents = false; 91 } 92 93 [StorableHook(HookType.AfterDeserialization)] 94 private void AfterDeserialization() { 95 foreach (var s in storableSymbols) symbols.Add(s.Name, s); 96 foreach (var pair in storableSymbolSubtreeCount) symbolSubtreeCount.Add(pair.Key.Name, pair.Value); 97 foreach (var pair in storableAllowedChildSymbols) allowedChildSymbols.Add(pair.Key.Name, pair.Value.Select(y => y.Name).ToList()); 98 foreach (var pair in storableAllowedChildSymbolsPerIndex) 99 allowedChildSymbolsPerIndex.Add(Tuple.Create(pair.Key.Item1.Name, pair.Key.Item2), pair.Value.Select(y => y.Name).ToList()); 100 101 storableSymbols = null; 102 storableSymbolSubtreeCount = null; 103 storableAllowedChildSymbols = null; 104 storableAllowedChildSymbolsPerIndex = null; 90 105 } 91 106 -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/SymbolicExpressionTreeGrammar.cs
r16723 r17226 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2019Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.