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

Location:
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Configuration
Files:
2 edited

Legend:

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

    r14875 r14897  
    11namespace HeuristicLab.Problems.ProgramSynthesis.Push.Configuration {
    22  using System.Collections.Generic;
    3 
    4   using HeuristicLab.Common;
    5   using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Interfaces;
    6   using HeuristicLab.Problems.ProgramSynthesis.Push.Stack;
     3  using Base.Erc;
     4  using Common;
     5  using Stack;
    76
    87  public interface IReadOnlyPushConfiguration : IDeepCloneable {
     
    1211    int MaxStringLength { get; }
    1312    int MaxVectorLength { get; }
     13    int MinPointsInProgram { get; }
    1414    int MaxPointsInProgram { get; }
    1515    int MaxPointsInRandomExpression { get; }
  • 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.