Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/10/17 00:27:31 (7 years ago)
Author:
pkimmesw
Message:

#2665 LexicaseSelector, Performance improvements, UI Fixes, Debugger only shows used stacks, fixed Debugger stepping, Added vector expressions, ERCOptions,

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/ExpressionTable.cs

    r14777 r14834  
    1414    public static readonly IDictionary<int, string> IndexToNameTable = new Dictionary<int, string>();
    1515    public static readonly IDictionary<Type, string> TypeToNameTable = new Dictionary<Type, string>();
     16    public static readonly IDictionary<Type, PushExpressionAttribute> TypeToAttributeTable = new Dictionary<Type, PushExpressionAttribute>();
    1617    public static readonly IDictionary<StackTypes, IList<string>> StackDependencyToNamesTable = new Dictionary<StackTypes, IList<string>>();
    1718    public static readonly string[] ExpressionNames;
     
    5657        var attribute = (PushExpressionAttribute)Attribute.GetCustomAttribute(type, typeof(PushExpressionAttribute));
    5758
     59        TypeToAttributeTable.Add(type, attribute);
    5860        dictionary.Add(attribute.ExpressionName, expression);
    5961        IndexToNameTable.Add(IndexToNameTable.Keys.Count, attribute.ExpressionName);
    6062        TypeToNameTable.Add(type, attribute.ExpressionName);
    6163
    62         if (!StackTypeToNamesTable.ContainsKey(attribute.StackTypes)) {
    63           StackTypeToNamesTable.Add(attribute.StackTypes, new List<string>());
    64         }
    65 
    66         StackTypeToNamesTable[attribute.StackTypes].Add(attribute.ExpressionName);
    67 
    68         var dependencies = attribute.StackTypes | attribute.AdditionalStackDependencies;
     64        if (!StackTypeToNamesTable.ContainsKey(attribute.StackType)) {
     65          StackTypeToNamesTable.Add(attribute.StackType, new List<string>());
     66        }
     67
     68        StackTypeToNamesTable[attribute.StackType].Add(attribute.ExpressionName);
     69
     70        var dependencies = attribute.StackType | attribute.AdditionalStackDependencies;
    6971        if (!StackDependencyToNamesTable.ContainsKey(dependencies)) {
    7072          StackDependencyToNamesTable.Add(dependencies, new List<string>());
     
    8890        var attribute = (PushExpressionAttribute)Attribute.GetCustomAttribute(type, typeof(PushExpressionAttribute));
    8991
     92        TypeToAttributeTable.Add(type, attribute);
    9093        dictionary.Add(attribute.ExpressionName, creator);
    9194        IndexToNameTable.Add(IndexToNameTable.Keys.Count, attribute.ExpressionName);
    9295        TypeToNameTable.Add(type, attribute.ExpressionName);
    9396
    94         if (!StackTypeToNamesTable.ContainsKey(attribute.StackTypes)) {
    95           StackTypeToNamesTable.Add(attribute.StackTypes, new List<string>());
    96         }
    97 
    98         StackTypeToNamesTable[attribute.StackTypes].Add(attribute.ExpressionName);
    99 
    100         var dependencies = attribute.StackTypes | attribute.AdditionalStackDependencies;
     97        if (!StackTypeToNamesTable.ContainsKey(attribute.StackType)) {
     98          StackTypeToNamesTable.Add(attribute.StackType, new List<string>());
     99        }
     100
     101        StackTypeToNamesTable[attribute.StackType].Add(attribute.ExpressionName);
     102
     103        var dependencies = attribute.StackType | attribute.AdditionalStackDependencies;
    101104        if (!StackDependencyToNamesTable.ContainsKey(dependencies)) {
    102105          StackDependencyToNamesTable.Add(dependencies, new List<string>());
     
    142145    }
    143146
    144     public static IReadOnlyList<string> GetEnabledExpressionsByStackTypes(StackTypes allowedTypes) {
     147    public static IReadOnlyList<string> GetExpressionsByStackTypes(StackTypes allowedTypes) {
    145148      return StackDependencyToNamesTable
    146149          .Where(entry => (entry.Key & ~allowedTypes) == StackTypes.None)
Note: See TracChangeset for help on using the changeset viewer.