Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/17/12 14:25:51 (13 years ago)
Author:
mkommend
Message:

#1682: Corrected gp-crossover code.

  • Changed ISymbolicExpressionTreeCrossover
  • Corrected SubtreeCrossover
  • Updated MultiSymbolicDataAnalysisCrossover
Location:
branches/HeuristicLab.Crossovers/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Crossovers/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs

    r7477 r7481  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    30 using HeuristicLab.PluginInfrastructure;
    3130
    3231namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
     
    3736  /// until a valid configuration is found.
    3837  /// </summary> 
    39   [Item("SubtreeCrossover", "An operator which performs subtree swapping crossover.")]
    40   [NonDiscoverableType]
     38  [Item("SubtreeSwappingCrossover", "An operator which performs subtree swapping crossover.")]
    4139  [StorableClass]
    4240  public class SubtreeCrossover : SymbolicExpressionTreeCrossover, ISymbolicExpressionTreeSizeConstraintOperator {
     
    4442    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
    4543    private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
    46     private const string SymbolicDataAnalysisEvaluationPartitionParameterName = "EvaluationPartition";
    4744
    4845    #region Parameter Properties
     
    5552    public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter {
    5653      get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }
    57     }
    58     public IValueLookupParameter<IntRange> SymbolicDataAnalysisEvaluationPartitionParameter {
    59       get { return (IValueLookupParameter<IntRange>)Parameters[SymbolicDataAnalysisEvaluationPartitionParameterName]; }
    6054    }
    6155    #endregion
     
    7973      Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0)."));
    8074      Parameters.Add(new ValueLookupParameter<PercentValue>(InternalCrossoverPointProbabilityParameterName, "The probability to select an internal crossover point (instead of a leaf node).", new PercentValue(0.9)));
    81       Parameters.Add(new ValueLookupParameter<IntRange>(SymbolicDataAnalysisEvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated."));
    8275    }
    8376
     
    8679    }
    8780
    88     protected override ISymbolicExpressionTree Cross(IRandom random,
     81    public override ISymbolicExpressionTree Crossover(IRandom random,
    8982      ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) {
    9083      return Cross(random, parent0, parent1, InternalCrossoverPointProbability.Value,
    9184        MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
    92     }
    93 
    94     public ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) {
    95       return Cross(random, parent0, parent1);
    9685    }
    9786
  • branches/HeuristicLab.Crossovers/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SymbolicExpressionTreeCrossover.cs

    r7259 r7481  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
    25 using HeuristicLab.Data;
    2625using HeuristicLab.Parameters;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    6665        throw new ArgumentException("Number of parents must be exactly two for symbolic expression tree crossover operators.");
    6766
    68       ISymbolicExpressionTree result = Cross(Random, Parents[0], Parents[1]);
     67      ISymbolicExpressionTree result = Crossover(Random, Parents[0], Parents[1]);
    6968
    7069      Child = result;
     
    7271    }
    7372
    74     protected abstract ISymbolicExpressionTree Cross(IRandom random,
    75       ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1);
     73    public abstract ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1);
    7674  }
    7775}
  • branches/HeuristicLab.Crossovers/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Interfaces/Operators/ISymbolicExpressionTreeCrossover.cs

    r7259 r7481  
    3030    ILookupParameter<ItemArray<ISymbolicExpressionTree>> ParentsParameter { get; }
    3131    ILookupParameter<ISymbolicExpressionTree> ChildParameter { get; }
     32    ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1);
    3233  }
    3334}
Note: See TracChangeset for help on using the changeset viewer.