Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7119


Ignore:
Timestamp:
12/04/11 23:41:25 (13 years ago)
Author:
bburlacu
Message:

#1682: Implemented the MultiSymbolicDataAnalysisExpressionTreeCrossover

Location:
branches/gp-crossover
Files:
2 added
7 edited

Legend:

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

    r7035 r7119  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.PluginInfrastructure;
    3031
    3132namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
     
    3738  /// </summary> 
    3839  [Item("SubtreeCrossover", "An operator which performs subtree swapping crossover.")]
     40  [NonDiscoverableType]
    3941  [StorableClass]
    40   public sealed class SubtreeCrossover : SymbolicExpressionTreeCrossover, ISymbolicExpressionTreeSizeConstraintOperator {
     42  public class SubtreeCrossover : SymbolicExpressionTreeCrossover, ISymbolicExpressionTreeSizeConstraintOperator {
    4143    private const string InternalCrossoverPointProbabilityParameterName = "InternalCrossoverPointProbability";
    4244    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
    4345    private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
     46    private const string SymbolicDataAnalysisEvaluationPartitionParameterName = "EvaluationPartition";
     47
    4448    #region Parameter Properties
    4549    public IValueLookupParameter<PercentValue> InternalCrossoverPointProbabilityParameter {
     
    5155    public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter {
    5256      get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }
     57    }
     58    public IValueLookupParameter<IntRange> SymbolicDataAnalysisEvaluationPartitionParameter {
     59      get { return (IValueLookupParameter<IntRange>)Parameters[SymbolicDataAnalysisEvaluationPartitionParameterName]; }
    5360    }
    5461    #endregion
     
    6572    #endregion
    6673    [StorableConstructor]
    67     private SubtreeCrossover(bool deserializing) : base(deserializing) { }
    68     private SubtreeCrossover(SubtreeCrossover original, Cloner cloner) : base(original, cloner) { }
     74    protected SubtreeCrossover(bool deserializing) : base(deserializing) { }
     75    protected SubtreeCrossover(SubtreeCrossover original, Cloner cloner) : base(original, cloner) { }
    6976    public SubtreeCrossover()
    7077      : base() {
     
    7279      Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0)."));
    7380      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."));
    7482    }
    7583
     
    8290      return Cross(random, parent0, parent1, InternalCrossoverPointProbability.Value,
    8391        MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
     92    }
     93
     94    public ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) {
     95      return Cross(random, parent0, parent1);
    8496    }
    8597
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionContextAwareCrossover.cs

    r7109 r7119  
    3232namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3333
    34   [Item("ContextAwareCrossover", "A crossover operator which deterministically choses the best insertion point for a randomly selected node.")]
     34  [Item("ContextAwareCrossover", "An operator which deterministically choses the best insertion point for a randomly selected node.")]
    3535  public sealed class SymbolicDataAnalysisExpressionContextAwareCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
    3636    [StorableConstructor]
     
    5454      return Cross(random, parent0, parent1, this.ExecutionContext, evaluator, problemData, rows, MaximumSymbolicExpressionTreeDepth.Value, MaximumSymbolicExpressionTreeLength.Value);
    5555    }
     56
     57    public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) {
     58      return Cross(random, parent0, parent1);
     59    }
     60
    5661    /// <summary>
    5762    /// Takes two parent individuals P0 and P1.
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionCrossover.cs

    r7089 r7119  
    111111      if (rootNode.HasLocalParameters) rootNode.ResetLocalParameters(random);
    112112
    113       //if (node.Symbol.Name == startSymbol.Name) {
    114       //  rootNode.AddSubtree(node);
    115       //} else {
    116       //  var startNode = new SymbolicExpressionTreeTopLevelNode(startSymbol);
    117       //  if (startNode.HasLocalParameters) startNode.ResetLocalParameters(random);
    118 
    119       //  startNode.AddSubtree(node);
    120       //  rootNode.AddSubtree(startNode);
    121       //}
    122113      var startNode = new SymbolicExpressionTreeTopLevelNode(startSymbol);
    123114      if (startNode.HasLocalParameters) startNode.ResetLocalParameters(random);
     
    153144      return rows.Where(i => i < testPartitionStart || testPartitionEnd <= i);
    154145    }
     146
     147    protected abstract override ISymbolicExpressionTree Cross(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1);
     148    public abstract ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1);
    155149  }
    156150}
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDepthConstrainedCrossover.cs

    r7089 r7119  
    3232namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3333
    34   [Item("DepthConstrainedCrossover", "An operator which performs subtree swapping only within a specific depth range.")]
     34  [Item("DepthConstrainedCrossover", "An operator which performs subtree swapping restricted to a specific depth range.")]
    3535  public sealed class SymbolicDataAnalysisExpressionDepthConstrainedCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
    3636    [StorableConstructor]
     
    4646      T problemData = ProblemDataParameter.ActualValue;
    4747      return Cross(random, parent0, parent1, MaximumSymbolicExpressionTreeDepth.Value, MaximumSymbolicExpressionTreeLength.Value);
     48    }
     49
     50    public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) {
     51      return Cross(random, parent0, parent1);
    4852    }
    4953
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDeterministicBestCrossover.cs

    r7110 r7119  
    3232namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3333
    34   [Item("DeterministicBestCrossover", "An operator which performs subtree swapping in a deterministic way: it chooses the child from the second parent who would produce the best result if replaced in the first parent")]
     34  [Item("DeterministicBestCrossover", "An operator which performs subtree swapping in a deterministic way, by choosing the best subtree to be swapped in a certain position.")]
    3535  public sealed class SymbolicDataAnalysisExpressionDeterministicBestCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
    3636    [StorableConstructor]
     
    5353
    5454      return Cross(random, parent0, parent1, this.ExecutionContext, evaluator, problemData, rows, MaximumSymbolicExpressionTreeDepth.Value, MaximumSymbolicExpressionTreeLength.Value);
     55    }
     56
     57    public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) {
     58      return Cross(random, parent0, parent1);
    5559    }
    5660    /// <summary>
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover.cs

    r7105 r7119  
    3232namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3333
    34   [Item("ProbabilisticFunctionalCrossover", "An operator which performs subtree swapping based on behavioral similarity")]
     34  [Item("ProbabilisticFunctionalCrossover", "An operator which performs subtree swapping based on the behavioral similarity between subtrees.")]
    3535  public sealed class SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
    3636    [StorableConstructor]
     
    4848      return Cross(random, parent0, parent1, interpreter, problemData,
    4949                   rows, MaximumSymbolicExpressionTreeDepth.Value, MaximumSymbolicExpressionTreeLength.Value);
     50    }
     51
     52    public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) {
     53      return Cross(random, parent0, parent1);
    5054    }
    5155
  • branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs

    r7106 r7119  
    3333namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3434
    35   [Item("SemanticSimilarityCrossover", "An operator which performs subtree swapping based on semantic similarity.")]
     35  [Item("SemanticSimilarityCrossover", "An operator which performs subtree swapping based on the semantic similarity between subtrees.")]
    3636  public sealed class SymbolicDataAnalysisExpressionSemanticSimilarityCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
    3737    private const string SemanticSimilarityLowerBoundParameterName = "SemanticSimilarityLowerBound";
     
    7676      return Cross(random, parent0, parent1, interpreter, problemData, rows, MaximumSymbolicExpressionTreeDepth.Value, MaximumSymbolicExpressionTreeLength.Value, SemanticSimilarityLowerBoundParameter.Value.Value, SemanticSimilarityUpperBoundParameter.Value.Value);
    7777    }
     78
     79    public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) {
     80      return Cross(random, parent0, parent1);
     81    }
     82
    7883    /// <summary>
    7984    /// Takes two parent individuals P0 and P1.
     
    157162      }
    158163    }
    159 
    160164  }
    161165}
Note: See TracChangeset for help on using the changeset viewer.