Index: branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/PGE.cs
===================================================================
--- branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/PGE.cs	(revision 16195)
+++ branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/PGE.cs	(revision 16196)
@@ -2,22 +2,18 @@
 using System.Runtime.InteropServices;
 using System.Threading;
-using HeuristicLab.Common; // required for parameters collection
-using HeuristicLab.Core; // required for parameters collection
-using HeuristicLab.Data; // IntValue, ...
-using HeuristicLab.Optimization; // BasicAlgorithm
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization; 
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Problems.DataAnalysis;
-using HeuristicLab.Random; // MersenneTwister
+using HeuristicLab.Problems.DataAnalysis;     
 
 namespace PGE {
-  // each HL item needs to have a name and a description (BasicAlgorithm is an Item)
-  // The name and description of items is shown in the GUI
   [Item(Name = "Priorizied Grammar Enumeration (PGE)", Description = "Priorizied grammar enumeration algorithm. Worm, T. and Chiu K., 'Prioritized Grammar Enumeration: Symbolic Regression by Dynamic Programming'. GECCO 2013")]
 
-  // If the algorithm should be shown in the "New..." dialog it must be creatable. Entries in the new dialog are grouped to categories and ordered by priorities
   [Creatable(Category = CreatableAttribute.Categories.Algorithms, Priority = 999)]
 
-  [StorableClass] // for persistence (storing your algorithm to a files or transfer to HeuristicLab.Hive)
+  [StorableClass] 
   public unsafe class PGE : BasicAlgorithm {
 
@@ -46,9 +42,34 @@
     public new RegressionProblem Problem { get { return (RegressionProblem)base.Problem; } }
 
-    #region parameters
-    // If an algorithm has parameters then we usually also add properties to access these parameters.
-    // This is not strictly required but considered good shape.
+    #region parameter names
+    private static readonly string MaxIterationsParameterName = "MaxIterations";
+    private static readonly string NumberOfUsableVariablesParameterName = "umberOfUsableVariables";
+    private static readonly string MaxGenParameterName = "MaxGen";
+    private static readonly string EvalrCountParameterName = "EvalrCount";
+    private static readonly string MaxSizeParameterName = "MaxSize";
+    private static readonly string MinSizeParameterName = "MinSize";
+    private static readonly string MaxDepthParameterName = "MaxDepth";
+    private static readonly string SearchVarParameterName = "SearchVar";
+    private static readonly string MinDepthParameterName = "MinDepth";
+    private static readonly string PgeRptEpochParameterName = "PgeRptEpoch";
+    private static readonly string PgeRptCountParameterName = "PgeRptCount";
+    private static readonly string PgeArchiveCapParameterName = "PgeArchiveCap";
+    private static readonly string PeelCntParameterName = "PeelCnt";
+    private static readonly string ZeroEpsilonParameterName = "ZeroEpsilon";
+    private static readonly string HitRatioParameterName = "HitRatio";
+    private static readonly string IndependedNamesParameterName = "IndependedNames";
+    private static readonly string DependedNamesParameterName = "DependedNames";
+    private static readonly string InitMethodParameterName = "InitMethod";
+    private static readonly string GrowMethodParameterName = "GrowMethod";
+    private static readonly string RootsParameterName = "Roots";
+    private static readonly string NodesParameterName = "Nodes";
+    private static readonly string NonTrigParameterName = "NonTrig";
+    private static readonly string LeafsParameterName = "Leafs";
+
+    #endregion
+
+    #region parameters                                            
     private IFixedValueParameter<IntValue> MaxIterationsParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["MaxIterations"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[MaxIterationsParameterName]; }
     }
     public int MaxIterations {
@@ -57,14 +78,14 @@
     }
 
-    private IFixedValueParameter<IntValue> nUsableVarsParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["nUsableVars"]; }
+    private IFixedValueParameter<IntValue> NumberOfUsableVariables {
+      get { return (IFixedValueParameter<IntValue>)Parameters[NumberOfUsableVariablesParameterName]; }
     }
-    public int nUsableVars {
-      get { return nUsableVarsParameter.Value.Value; }
-      set { nUsableVarsParameter.Value.Value = value; }
+    public int NumberOfUseableVariables {
+      get { return NumberOfUsableVariables.Value.Value; }
+      set { NumberOfUsableVariables.Value.Value = value; }
     }
 
     private IFixedValueParameter<IntValue> MaxGenParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["MaxGen"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[MaxGenParameterName]; }
     }
     public int MaxGen {
@@ -74,5 +95,5 @@
 
     private IFixedValueParameter<IntValue> EvalrCountParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["EvalrCount"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[EvalrCountParameterName]; }
     }
     public int EvalrCount {
@@ -82,5 +103,5 @@
 
     private IFixedValueParameter<IntValue> MaxSizeParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["MaxSize"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[MaxSizeParameterName]; }
     }
     public int MaxSize {
@@ -90,5 +111,5 @@
 
     private IFixedValueParameter<IntValue> MinSizeParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["MinSize"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[MinSizeParameterName]; }
     }
     public int MinSize {
@@ -98,5 +119,5 @@
 
     private IFixedValueParameter<IntValue> MaxDepthParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["MaxDepth"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[MaxDepthParameterName]; }
     }
     public int MaxDepth {
@@ -106,5 +127,5 @@
 
     private IFixedValueParameter<IntValue> SearchVarParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["SearchVar"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[SearchVarParameterName]; }
     }
     public int SearchVar {
@@ -114,5 +135,5 @@
 
     private IFixedValueParameter<IntValue> MinDepthParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["MinDepth"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[MinDepthParameterName]; }
     }
     public int MinDepth {
@@ -122,5 +143,5 @@
 
     private IFixedValueParameter<IntValue> PgeRptEpochParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["PgeRptEpoch"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[PgeRptEpochParameterName]; }
     }
     public int PgeRptEpoch {
@@ -130,5 +151,5 @@
 
     private IFixedValueParameter<IntValue> PgeRptCountParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["PgeRptCount"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[PgeRptCountParameterName]; }
     }
     public int PgeRptCount {
@@ -138,5 +159,5 @@
 
     private IFixedValueParameter<IntValue> PgeArchiveCapParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["PgeArchiveCap"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[PgeArchiveCapParameterName]; }
     }
     public int PgeArchiveCap {
@@ -146,5 +167,5 @@
 
     private IFixedValueParameter<IntValue> PeelCntParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["PeelCnt"]; }
+      get { return (IFixedValueParameter<IntValue>)Parameters[PeelCntParameterName]; }
     }
     public int PeelCnt {
@@ -154,5 +175,5 @@
 
     private IFixedValueParameter<DoubleValue> ZeroEpsilonParameter {
-      get { return (IFixedValueParameter<DoubleValue>)Parameters["ZeroEpsilon"]; }
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[ZeroEpsilonParameterName]; }
     }
     public double ZeroEpsilon {
@@ -162,5 +183,5 @@
 
     private IFixedValueParameter<DoubleValue> HitRatioParameter {
-      get { return (IFixedValueParameter<DoubleValue>)Parameters["HitRatio"]; }
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[HitRatioParameterName]; }
     }
     public double HitRatio {
@@ -170,5 +191,5 @@
 
     private IFixedValueParameter<StringValue> IndependedNamesParameter {
-      get { return (IFixedValueParameter<StringValue>)Parameters["IndependedNames"]; }
+      get { return (IFixedValueParameter<StringValue>)Parameters[IndependedNamesParameterName]; }
     }
     public string IndependedNames {
@@ -178,5 +199,5 @@
 
     private IFixedValueParameter<StringValue> DependedNamesParameter {
-      get { return (IFixedValueParameter<StringValue>)Parameters["DependedNames"]; }
+      get { return (IFixedValueParameter<StringValue>)Parameters[DependedNamesParameterName]; }
     }
     public string DependedNames {
@@ -186,5 +207,5 @@
 
     private IFixedValueParameter<StringValue> InitMethodParameter {
-      get { return (IFixedValueParameter<StringValue>)Parameters["InitMethod"]; }
+      get { return (IFixedValueParameter<StringValue>)Parameters[InitMethodParameterName]; }
     }
     public string InitMethod {
@@ -194,5 +215,5 @@
 
     private IFixedValueParameter<StringValue> GrowMethodParameter {
-      get { return (IFixedValueParameter<StringValue>)Parameters["GrowMethod"]; }
+      get { return (IFixedValueParameter<StringValue>)Parameters[GrowMethodParameterName]; }
     }
     public string GrowMethod {
@@ -202,5 +223,5 @@
 
     private IFixedValueParameter<StringValue> RootsParameter {
-      get { return (IFixedValueParameter<StringValue>)Parameters["Roots"]; }
+      get { return (IFixedValueParameter<StringValue>)Parameters[RootsParameterName]; }
     }
     public string Roots {
@@ -210,5 +231,5 @@
 
     private IFixedValueParameter<StringValue> NodesParameter {
-      get { return (IFixedValueParameter<StringValue>)Parameters["Nodes"]; }
+      get { return (IFixedValueParameter<StringValue>)Parameters[NodesParameterName]; }
     }
     public string Nodes {
@@ -218,5 +239,5 @@
 
     private IFixedValueParameter<StringValue> NonTrigParameter {
-      get { return (IFixedValueParameter<StringValue>)Parameters["NonTrig"]; }
+      get { return (IFixedValueParameter<StringValue>)Parameters[NonTrigParameterName]; }
     }
     public string NonTrig {
@@ -226,5 +247,5 @@
 
     private IFixedValueParameter<StringValue> LeafsParameter {
-      get { return (IFixedValueParameter<StringValue>)Parameters["Leafs"]; }
+      get { return (IFixedValueParameter<StringValue>)Parameters[LeafsParameterName]; }
     }
     public string Leafs {
@@ -234,33 +255,32 @@
     #endregion
 
-    // createable items must have a default ctor
     public PGE() {
       // algorithm parameters are shown in the GUI
-      Parameters.Add(new FixedValueParameter<IntValue>("MaxIterations", new IntValue(50)));
-      Parameters.Add(new FixedValueParameter<IntValue>("SearchVar", new IntValue(0)));
-      Parameters.Add(new FixedValueParameter<IntValue>("MinDepth", new IntValue(1)));
-      Parameters.Add(new FixedValueParameter<IntValue>("MaxDepth", new IntValue(6)));
-      Parameters.Add(new FixedValueParameter<IntValue>("MinSize", new IntValue(4)));
-      Parameters.Add(new FixedValueParameter<IntValue>("MaxSize", new IntValue(50)));
-      Parameters.Add(new FixedValueParameter<IntValue>("EvalrCount", new IntValue(2)));
-      Parameters.Add(new FixedValueParameter<IntValue>("PeelCnt", new IntValue(3)));
-      Parameters.Add(new FixedValueParameter<IntValue>("PgeArchiveCap", new IntValue(256)));
-      Parameters.Add(new FixedValueParameter<IntValue>("PgeRptCount", new IntValue(20)));
-      Parameters.Add(new FixedValueParameter<IntValue>("PgeRptEpoch", new IntValue(1)));
-      Parameters.Add(new FixedValueParameter<IntValue>("MaxGen", new IntValue(200)));
-      Parameters.Add(new FixedValueParameter<IntValue>("nUsableVars", new IntValue(5)));
+      Parameters.Add(new FixedValueParameter<IntValue>(MaxIterationsParameterName, new IntValue(50)));
+      Parameters.Add(new FixedValueParameter<IntValue>(SearchVarParameterName, new IntValue(0)));
+      Parameters.Add(new FixedValueParameter<IntValue>(MinDepthParameterName, new IntValue(1)));
+      Parameters.Add(new FixedValueParameter<IntValue>(MaxDepthParameterName, new IntValue(6)));
+      Parameters.Add(new FixedValueParameter<IntValue>(MinSizeParameterName, new IntValue(4)));
+      Parameters.Add(new FixedValueParameter<IntValue>(MaxSizeParameterName, new IntValue(50)));
+      Parameters.Add(new FixedValueParameter<IntValue>(EvalrCountParameterName, new IntValue(2)));
+      Parameters.Add(new FixedValueParameter<IntValue>(PeelCntParameterName, new IntValue(3)));
+      Parameters.Add(new FixedValueParameter<IntValue>(PgeArchiveCapParameterName, new IntValue(256)));
+      Parameters.Add(new FixedValueParameter<IntValue>(PgeRptCountParameterName, new IntValue(20)));
+      Parameters.Add(new FixedValueParameter<IntValue>(PgeRptEpochParameterName, new IntValue(1)));
+      Parameters.Add(new FixedValueParameter<IntValue>(MaxGenParameterName, new IntValue(200)));
+      Parameters.Add(new FixedValueParameter<IntValue>(NumberOfUsableVariablesParameterName, new IntValue(5)));
 
-      Parameters.Add(new FixedValueParameter<StringValue>("IndependedNames", new StringValue("x y z v w")));
-      Parameters.Add(new FixedValueParameter<StringValue>("DependedNames", new StringValue("f(xs)")));
-      Parameters.Add(new FixedValueParameter<StringValue>("InitMethod", new StringValue("method1")));
-      Parameters.Add(new FixedValueParameter<StringValue>("GrowMethod", new StringValue("method1")));
+      Parameters.Add(new FixedValueParameter<StringValue>(IndependedNamesParameterName, new StringValue("x y z v w")));      // TODO
+      Parameters.Add(new FixedValueParameter<StringValue>(DependedNamesParameterName, new StringValue("f(xs)")));            // TODO
+      Parameters.Add(new FixedValueParameter<StringValue>(InitMethodParameterName, new StringValue("method1")));  // TODO Dropdown
+      Parameters.Add(new FixedValueParameter<StringValue>(GrowMethodParameterName, new StringValue("method1")));
 
-      Parameters.Add(new FixedValueParameter<StringValue>("Roots", new StringValue("Add")));
-      Parameters.Add(new FixedValueParameter<StringValue>("Nodes", new StringValue("Add Mul")));
-      Parameters.Add(new FixedValueParameter<StringValue>("NonTrig", new StringValue("Add Mul")));
-      Parameters.Add(new FixedValueParameter<StringValue>("Leafs", new StringValue("Var ConstantF")));
+      Parameters.Add(new FixedValueParameter<StringValue>(RootsParameterName, new StringValue("Add")));
+      Parameters.Add(new FixedValueParameter<StringValue>(NodesParameterName, new StringValue("Add Mul")));
+      Parameters.Add(new FixedValueParameter<StringValue>(NonTrigParameterName, new StringValue("Add Mul")));
+      Parameters.Add(new FixedValueParameter<StringValue>(LeafsParameterName, new StringValue("Var ConstantF")));
 
-      Parameters.Add(new FixedValueParameter<DoubleValue>("ZeroEpsilon", new DoubleValue(0.00001)));
-      Parameters.Add(new FixedValueParameter<DoubleValue>("HitRatio", new DoubleValue(0.01)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(ZeroEpsilonParameterName, new DoubleValue(0.00001)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(HitRatioParameterName, new DoubleValue(0.01)));
     }
 
@@ -329,5 +349,5 @@
       addTrainData(CindepNames, CdepndNames, TrainData, nTrainData);
 
-      IntPtr UsableVars = GetUsableVars(nUsableVars);
+      IntPtr UsableVars = GetUsableVars(NumberOfUseableVariables);
 
       Console.WriteLine("InitSearch");
@@ -335,5 +355,5 @@
 
       Console.WriteLine("InitTree");
-      initTreeParams(Croots, Cnodes, CnonTrig, Cleafs, UsableVars, nUsableVars, MaxSize, MinSize, MaxDepth, MinDepth);
+      initTreeParams(Croots, Cnodes, CnonTrig, Cleafs, UsableVars, NumberOfUseableVariables, MaxSize, MinSize, MaxDepth, MinDepth);
 
       Console.WriteLine("InitProblem");
@@ -344,7 +364,7 @@
       var curItersItem = new IntValue();
 
-      double[] coeffmem = new double[nUsableVars];
-      IntPtr Coeff = Marshal.AllocHGlobal(sizeof(Double) * nUsableVars);
-      Marshal.Copy(coeffmem, 0, Coeff, nUsableVars);
+      double[] coeffmem = new double[NumberOfUseableVariables];
+      IntPtr Coeff = Marshal.AllocHGlobal(sizeof(Double) * NumberOfUseableVariables);
+      Marshal.Copy(coeffmem, 0, Coeff, NumberOfUseableVariables);
 
       for (int iter = 1; iter <= MaxIter; iter++) {
