Changeset 14897 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Configuration
- Timestamp:
- 04/28/17 22:52:08 (8 years ago)
- 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 1 1 namespace HeuristicLab.Problems.ProgramSynthesis.Push.Configuration { 2 2 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; 7 6 8 7 public interface IReadOnlyPushConfiguration : IDeepCloneable { … … 12 11 int MaxStringLength { get; } 13 12 int MaxVectorLength { get; } 13 int MinPointsInProgram { get; } 14 14 int MaxPointsInProgram { get; } 15 15 int MaxPointsInRandomExpression { get; } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Configuration/PushConfiguration.cs
r14875 r14897 5 5 using Attributes; 6 6 using Base.Erc; 7 using Base.Erc.Interfaces;8 7 using Common; 9 8 using Core; … … 14 13 [StorableClass] 15 14 public class PushConfiguration : ParameterizedNamedItem, IReadOnlyPushConfiguration, IEnabledExpressionsConfiguration { 16 17 18 19 15 public PushConfiguration() { 20 16 Name = "Push Configuration"; … … 25 21 ErcOptions = new ErcOptions(); 26 22 EvalPushLimit = 1024; 27 MaxPointsInProgram = 128; 23 MinPointsInProgram = 25; 24 MaxPointsInProgram = 200; 28 25 TopLevelPushCode = true; 29 26 TopLevelPopCode = false; 30 27 MaxPointsInRandomExpression = 64; 31 MaxStringLength = 32;28 MaxStringLength = 128; 32 29 MaxVectorLength = 64; 33 30 MaxDepth = 32; … … 38 35 private void InitEnabledStacks(bool state = true) { 39 36 foreach (StackTypes type in Enum.GetValues(typeof(StackTypes))) { 40 if (!enabledStacks.ContainsKey(type) )37 if (!enabledStacks.ContainsKey(type) && type != StackTypes.None) 41 38 enabledStacks.Add(type, state); 42 39 } … … 54 51 ErcOptions = cloner.Clone(origin.ErcOptions); 55 52 EvalPushLimit = origin.EvalPushLimit; 53 MinPointsInProgram = origin.MinPointsInProgram; 56 54 MaxPointsInProgram = origin.MaxPointsInProgram; 57 55 MaxPointsInRandomExpression = origin.MaxPointsInRandomExpression; … … 72 70 73 71 [Storable] 74 private Dictionary<StackTypes, bool> enabledStacks;72 private readonly Dictionary<StackTypes, bool> enabledStacks; 75 73 76 74 public IReadOnlyDictionary<StackTypes, bool> EnabledStacks { get { return enabledStacks; } } … … 122 120 123 121 /// <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> 124 131 /// This is the maximum size of an item on the CODE stack, expressed as a number of points. 125 132 /// 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 128 134 /// instruction. 129 135 /// </summary> … … 155 161 [Storable] 156 162 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 } 157 179 158 180 public void EnableExpressionOfStack(StackTypes types) {
Note: See TracChangeset
for help on using the changeset viewer.