Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/10/12 15:23:39 (12 years ago)
Author:
bburlacu
Message:

#1682: Override of the CanChangeName property, added friendly names for the crossover operators.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDepthConstrainedCrossover.cs

    r7193 r7303  
    6060      DepthRangeParameter.ValidValues.Add(new StringValue(Enum.GetName(typeof(Ranges), Ranges.Standard)));
    6161      DepthRangeParameter.ValidValues.Add(new StringValue(Enum.GetName(typeof(Ranges), Ranges.Lowlevel)));
     62      Name = "DepthConstrainedCrossover";
    6263    }
    6364    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionDepthConstrainedCrossover<T>(this, cloner); }
     
    8889      int depth = parent0.Root.GetDepth();
    8990      var depthRange = new DoubleRange();
     91      const int depthOffset = 2; // skip the first 2 levels (root + startNode)
    9092      switch ((int)Enum.Parse(typeof(Ranges), mode)) {
    9193        case (int)Ranges.HighLevel:
    92           depthRange.Start = 0;
    93           depthRange.End = Math.Round(depth * 0.25);
     94          depthRange.Start = depthOffset; // skip the first 2 levels (root + startNode)
     95          depthRange.End = depthRange.Start + Math.Round(depth * 0.25);
    9496          break;
    9597        case (int)Ranges.Standard:
    96           depthRange.Start = Math.Round(depth * 0.25);
    97           depthRange.End = Math.Round(depth * 0.75);
     98          depthRange.Start = depthOffset + Math.Round(depth * 0.25);
     99          depthRange.End = depthRange.Start + Math.Round(depth * 0.5);
    98100          break;
    99101        case (int)Ranges.Lowlevel:
    100           depthRange.Start = Math.Round(depth * 0.75);
    101           depthRange.End = depth;
     102          depthRange.Start = depthOffset + Math.Round(depth * 0.75);
     103          depthRange.End = Math.Max(depthRange.Start, depth);
    102104          break;
    103105      }
     
    110112                                    select new CutPoint(n, s));
    111113      });
     114
     115      if (crossoverPoints0.Count == 0)
     116        throw new Exception("No crossover points available in the first parent");
     117
    112118      CutPoint crossoverPoint0 = crossoverPoints0.SelectRandom(random);
    113119      int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child);
Note: See TracChangeset for help on using the changeset viewer.