Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/10 18:55:22 (14 years ago)
Author:
gkronber
Message:

Refactored cloning in SymbolicExpressionTreeEncoding. #922

Location:
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers
Files:
2 edited

Legend:

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

    r4106 r4674  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
     
    3738  [Item("SubtreeCrossover", "An operator which performs subtree swapping crossover.")]
    3839  [StorableClass]
    39   public class SubtreeCrossover : SymbolicExpressionTreeCrossover {
     40  public sealed class SubtreeCrossover : SymbolicExpressionTreeCrossover {
    4041    public IValueLookupParameter<PercentValue> InternalCrossoverPointProbabilityParameter {
    4142      get { return (IValueLookupParameter<PercentValue>)Parameters["InternalCrossoverPointProbability"]; }
    4243    }
    43 
     44    [StorableConstructor]
     45    private SubtreeCrossover(bool deserializing) : base(deserializing) { }
     46    private SubtreeCrossover(SubtreeCrossover original, Cloner cloner) : base(original, cloner) { }
    4447    public SubtreeCrossover()
    4548      : base() {
    4649      Parameters.Add(new ValueLookupParameter<PercentValue>("InternalCrossoverPointProbability", "The probability to select an internal crossover point (instead of a leaf node).", new PercentValue(0.9)));
     50    }
     51
     52    public override IDeepCloneable Clone(Cloner cloner) {
     53      return new SubtreeCrossover(this, cloner);
    4754    }
    4855
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SymbolicExpressionTreeCrossover.cs

    r4123 r4674  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    5051      get { return FailedCrossoverEventsParameter.Value; }
    5152    }
     53    [StorableConstructor]
     54    protected SymbolicExpressionTreeCrossover(bool deserializing) : base(deserializing) { }
     55    protected SymbolicExpressionTreeCrossover(SymbolicExpressionTreeCrossover original, Cloner cloner) : base(original, cloner) { }
    5256    protected SymbolicExpressionTreeCrossover()
    5357      : base() {
Note: See TracChangeset for help on using the changeset viewer.