Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/11/20 13:36:02 (5 years ago)
Author:
bburlacu
Message:

#1772: Merge trunk changes and fix all errors and compilation warnings.

Location:
branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/EmptySymbolicExpressionTreeGrammar.cs

    r16130 r17434  
    22
    33/* HeuristicLab
    4  * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    55 *
    66 * This file is part of HeuristicLab.
     
    2727using HeuristicLab.Common;
    2828using HeuristicLab.Core;
    29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
    3232
    33   [StorableClass]
     33  [StorableType("59B5B5B9-0F49-4994-B221-856AA43C28B4")]
    3434  internal sealed class EmptySymbolicExpressionTreeGrammar : NamedItem, ISymbolicExpressionTreeGrammar {
    3535    [Storable]
     
    3737
    3838    [StorableConstructor]
    39     private EmptySymbolicExpressionTreeGrammar(bool deserializing) : base(deserializing) { }
     39    private EmptySymbolicExpressionTreeGrammar(StorableConstructorFlag _) : base(_) { }
    4040    internal EmptySymbolicExpressionTreeGrammar(ISymbolicExpressionGrammar grammar)
    4141      : base() {
  • branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/GrammarUtils.cs

    r16130 r17434  
    22
    33/* HeuristicLab
    4  * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    55 *
    66 * This file is part of HeuristicLab.
  • branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/SimpleSymbolicExpressionGrammar.cs

    r16130 r17434  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using System.Collections.Generic;
    2323using HeuristicLab.Common;
    24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     24using HEAL.Attic;
    2525
    2626namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
    27   [StorableClass]
     27  [StorableType("70D190B2-22F4-41E5-9938-EFD1B14ECF43")]
    2828  public sealed class SimpleSymbolicExpressionGrammar : SymbolicExpressionGrammar {
    2929    [StorableConstructor]
    30     private SimpleSymbolicExpressionGrammar(bool deserializing) : base(deserializing) { }
     30    private SimpleSymbolicExpressionGrammar(StorableConstructorFlag _) : base(_) { }
    3131    private SimpleSymbolicExpressionGrammar(SimpleSymbolicExpressionGrammar original, Cloner cloner) : base(original, cloner) { }
    3232    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/SymbolicExpressionGrammar.cs

    r16130 r17434  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2626using HeuristicLab.Common;
    2727using HeuristicLab.Core;
    28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
    31   [StorableClass]
     31  [StorableType("925BDEE9-0D46-48DB-BA1B-DCE82C0480B3")]
    3232  public abstract class SymbolicExpressionGrammar : SymbolicExpressionGrammarBase, ISymbolicExpressionGrammar {
    3333    #region fields & properties
     
    121121
    122122    [StorableConstructor]
    123     protected SymbolicExpressionGrammar(bool deserializing)
    124       : base(deserializing) {
     123    protected SymbolicExpressionGrammar(StorableConstructorFlag _) : base(_) {
    125124      emptyGrammar = new EmptySymbolicExpressionTreeGrammar(this);
    126125    }
  • branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/SymbolicExpressionGrammarBase.cs

    r16130 r17434  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828
    2929namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
     
    3434  /// in the sub-trees of a symbol (can be specified for each sub-tree index separately).
    3535  /// </summary>
    36   [StorableClass]
     36  [StorableType("E76C087C-4E10-488A-86D0-295A4265DA53")]
    3737  public abstract class SymbolicExpressionGrammarBase : NamedItem, ISymbolicExpressionGrammarBase {
    3838
    3939    #region properties for separation between implementation and persistence
     40    private IEnumerable<ISymbol> storableSymbols;
    4041    [Storable(Name = "Symbols")]
    4142    private IEnumerable<ISymbol> StorableSymbols {
    4243      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;
    4648    [Storable(Name = "SymbolSubtreeCount")]
    4749    private IEnumerable<KeyValuePair<ISymbol, Tuple<int, int>>> StorableSymbolSubtreeCount {
    4850      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;
    5255    [Storable(Name = "AllowedChildSymbols")]
    5356    private IEnumerable<KeyValuePair<ISymbol, IEnumerable<ISymbol>>> StorableAllowedChildSymbols {
    5457      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;
    5862    [Storable(Name = "AllowedChildSymbolsPerIndex")]
    5963    private IEnumerable<KeyValuePair<Tuple<ISymbol, int>, IEnumerable<ISymbol>>> StorableAllowedChildSymbolsPerIndex {
    6064      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; }
    6566    }
    6667    #endregion
     
    8081
    8182    [StorableConstructor]
    82     protected SymbolicExpressionGrammarBase(bool deserializing)
    83       : base(deserializing) {
     83    protected SymbolicExpressionGrammarBase(StorableConstructorFlag _) : base(_) {
    8484
    8585      symbols = new Dictionary<string, ISymbol>();
     
    8989
    9090      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;
    91105    }
    92106
  • branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/SymbolicExpressionTreeGrammar.cs

    r16130 r17434  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2323using System.Collections.Generic;
    2424using HeuristicLab.Common;
    25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HEAL.Attic;
    2626
    2727namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
    28   [StorableClass]
     28  [StorableType("ADB1DF1C-BE39-49F7-BADD-978F495EEA4D")]
    2929  internal sealed class SymbolicExpressionTreeGrammar : SymbolicExpressionGrammarBase, ISymbolicExpressionTreeGrammar {
    3030    [StorableConstructor]
    31     private SymbolicExpressionTreeGrammar(bool deserializing) : base(deserializing) { }
     31    private SymbolicExpressionTreeGrammar(StorableConstructorFlag _) : base(_) { }
    3232    private SymbolicExpressionTreeGrammar(SymbolicExpressionTreeGrammar original, Cloner cloner)
    3333      : base(original, cloner) {
Note: See TracChangeset for help on using the changeset viewer.