Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/28/17 22:52:08 (8 years ago)
Author:
pkimmesw
Message:

#2665 Dynamic ErcValues, Separate Push from BenchmarkSuite Push

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Configuration/PushConfiguration.cs

    r14875 r14897  
    55  using Attributes;
    66  using Base.Erc;
    7   using Base.Erc.Interfaces;
    87  using Common;
    98  using Core;
     
    1413  [StorableClass]
    1514  public class PushConfiguration : ParameterizedNamedItem, IReadOnlyPushConfiguration, IEnabledExpressionsConfiguration {
    16 
    17 
    18 
    1915    public PushConfiguration() {
    2016      Name = "Push Configuration";
     
    2521      ErcOptions = new ErcOptions();
    2622      EvalPushLimit = 1024;
    27       MaxPointsInProgram = 128;
     23      MinPointsInProgram = 25;
     24      MaxPointsInProgram = 200;
    2825      TopLevelPushCode = true;
    2926      TopLevelPopCode = false;
    3027      MaxPointsInRandomExpression = 64;
    31       MaxStringLength = 32;
     28      MaxStringLength = 128;
    3229      MaxVectorLength = 64;
    3330      MaxDepth = 32;
     
    3835    private void InitEnabledStacks(bool state = true) {
    3936      foreach (StackTypes type in Enum.GetValues(typeof(StackTypes))) {
    40         if (!enabledStacks.ContainsKey(type))
     37        if (!enabledStacks.ContainsKey(type) && type != StackTypes.None)
    4138          enabledStacks.Add(type, state);
    4239      }
     
    5451      ErcOptions = cloner.Clone(origin.ErcOptions);
    5552      EvalPushLimit = origin.EvalPushLimit;
     53      MinPointsInProgram = origin.MinPointsInProgram;
    5654      MaxPointsInProgram = origin.MaxPointsInProgram;
    5755      MaxPointsInRandomExpression = origin.MaxPointsInRandomExpression;
     
    7270
    7371    [Storable]
    74     private Dictionary<StackTypes, bool> enabledStacks;
     72    private readonly Dictionary<StackTypes, bool> enabledStacks;
    7573
    7674    public IReadOnlyDictionary<StackTypes, bool> EnabledStacks { get { return enabledStacks; } }
     
    122120
    123121    /// <summary>
     122    ///     This is the minimum size of an item on the CODE stack, expressed as a number of points.
     123    ///     A point is an instruction, a literal, or a pair of parentheses. Any instruction that would cause this limit to be
     124    ///     exceeded should instead act as a NOOP, leaving all stacks in the states that they were in before the execution of the
     125    ///     instruction.
     126    /// </summary>
     127    [Storable]
     128    public int MinPointsInProgram { get; set; }
     129
     130    /// <summary>
    124131    ///     This is the maximum size of an item on the CODE stack, expressed as a number of points.
    125132    ///     A point is an instruction, a literal, or a pair of parentheses. Any instruction that would cause this limit to be
    126     ///     exceeded
    127     ///     should instead act as a NOOP, leaving all stacks in the states that they were in before the execution of the
     133    ///     exceeded should instead act as a NOOP, leaving all stacks in the states that they were in before the execution of the
    128134    ///     instruction.
    129135    /// </summary>
     
    155161    [Storable]
    156162    public int MaxVectorLength { get; set; }
     163
     164
     165    public void SetEnabledStacks(StackTypes types) {
     166      // Disable all
     167      EnabledExpressions.Clear();
     168
     169      // Enable those are required
     170      foreach (StackTypes type in Enum.GetValues(types.GetType())) {
     171        if (type == StackTypes.None) continue;
     172
     173        enabledStacks[type] = false;
     174
     175        if (types.HasFlag(type))
     176          EnableStack(type, true);
     177      }
     178    }
    157179
    158180    public void EnableExpressionOfStack(StackTypes types) {
Note: See TracChangeset for help on using the changeset viewer.