Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7303 for branches


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

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

Location:
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers
Files:
8 edited

Legend:

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

    r7119 r7303  
    3737  public class MultiSymbolicDataAnalysisExpressionCrossover<T> : StochasticMultiBranch<ISymbolicDataAnalysisExpressionCrossover<T>>,
    3838    ISymbolicDataAnalysisExpressionCrossover<T>,
    39     ISymbolicExpressionTreeSizeConstraintOperator, 
    40     ISymbolicExpressionTreeGrammarBasedOperator where T: class, IDataAnalysisProblemData {
     39    ISymbolicExpressionTreeSizeConstraintOperator,
     40    ISymbolicExpressionTreeGrammarBasedOperator where T : class, IDataAnalysisProblemData {
    4141    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
    4242    private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
     
    4949
    5050    public override bool CanChangeName {
    51       get { return false; }
     51      get { return true; }
    5252    }
    5353    protected override bool CreateChildOperation {
     
    9797      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(ChildParameterName, "The child symbolic expression tree resulting from the crossover."));
    9898
    99       var list = new List<ISymbolicDataAnalysisExpressionCrossover<T>>();
    100       foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(ISymbolicDataAnalysisExpressionCrossover<T>))) {
    101         if (this.GetType().Assembly != type.Assembly) continue;
    102         if (typeof(IMultiOperator<ISymbolicDataAnalysisExpressionCrossover<T>>).IsAssignableFrom(type)) 
    103           continue;
    104         list.Add((ISymbolicDataAnalysisExpressionCrossover<T>)Activator.CreateInstance(type));
    105       }
     99      var list = (from type in ApplicationManager.Manager.GetTypes(typeof(ISymbolicDataAnalysisExpressionCrossover<T>))
     100                  where this.GetType().Assembly == type.Assembly
     101                  where !typeof(IMultiOperator<ISymbolicDataAnalysisExpressionCrossover<T>>).IsAssignableFrom(type)
     102                  select (ISymbolicDataAnalysisExpressionCrossover<T>)Activator.CreateInstance(type)).ToList();
     103
    106104      var checkedItemList = new CheckedItemList<ISymbolicDataAnalysisExpressionCrossover<T>>();
    107105      checkedItemList.AddRange(list.OrderBy(op => op.Name));
    108106      Operators = checkedItemList.AsReadOnly();
    109107      Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs<IndexedItem<ISymbolicDataAnalysisExpressionCrossover<T>>>(Operators.CheckedItems));
    110 
     108      Name = "MultiCrossover";
    111109    }
    112110
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionContextAwareCrossover.cs

    r7193 r7303  
    3939    public SymbolicDataAnalysisExpressionContextAwareCrossover()
    4040      : base() {
     41      Name = "ContextAwareCrossover";
    4142    }
    4243    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionCrossover.cs

    r7193 r7303  
    4343    private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
    4444
    45     public override bool CanChangeName { get { return false; } }
     45    public override bool CanChangeName { get { return true; } }
    4646
    4747    #region Parameter properties
  • 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);
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDeterministicBestCrossover.cs

    r7193 r7303  
    3939    public SymbolicDataAnalysisExpressionDeterministicBestCrossover()
    4040      : base() {
     41      Name = "DeterministicBestCrossover";
    4142    }
    4243    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover.cs

    r7193 r7303  
    3636    private SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover(SymbolicDataAnalysisExpressionCrossover<T> original, Cloner cloner)
    3737      : base(original, cloner) { }
    38     public SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover() : base() { }
     38    public SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover()
     39      : base() {
     40      Name = "ProbabilisticFunctionalCrossover";
     41    }
    3942    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover<T>(this, cloner); }
    4043
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs

    r7193 r7303  
    5353      : base() {
    5454      Parameters.Add(new ValueLookupParameter<DoubleRange>(SemanticSimilarityRangeParameterName, "Semantic similarity interval.", new DoubleRange(0.0001, 10)));
     55      Name = "SemanticSimilarityCrossover";
    5556    }
    5657    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionSemanticSimilarityCrossover<T>(this, cloner); }
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSizefairCrossover.cs

    r7193 r7303  
    1212    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionSizefairCrossover<T>(this, cloner); }
    1313
     14    public override bool CanChangeName {
     15      get { return true; }
     16    }
     17
    1418    public SymbolicDataAnalysisExpressionSizefairCrossover()
    1519      : base() {
    1620      SymbolicDataAnalysisEvaluationPartitionParameter.Hidden = true;
     21      Name = "SizeFairCrossover";
    1722    }
    1823  }
Note: See TracChangeset for help on using the changeset viewer.