Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (14 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentCreater.cs

    r4524 r4722  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using System.Linq;
     25using HeuristicLab.Common;
    2426using HeuristicLab.Core;
    2527using HeuristicLab.Data;
    2628using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
    2729using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using System;
    2930
    3031namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
     
    3637  [StorableClass]
    3738  public sealed class ArgumentCreater : SymbolicExpressionTreeArchitectureManipulator {
     39    [StorableConstructor]
     40    private ArgumentCreater(bool deserializing) : base(deserializing) { }
     41    private ArgumentCreater(ArgumentCreater original, Cloner cloner) : base(original, cloner) { }
     42    public ArgumentCreater() : base() { }
    3843    public override sealed void ModifyArchitecture(
    3944      IRandom random,
     
    4449      out bool success) {
    4550      success = CreateNewArgument(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, maxFunctionDefiningBranches.Value, maxFunctionArguments.Value);
     51    }
     52
     53    public override IDeepCloneable Clone(Cloner cloner) {
     54      return new ArgumentCreater(this, cloner);
    4655    }
    4756
     
    91100      }
    92101    }
    93 
    94102
    95103    private static bool CreateNewArgumentForDefun(IRandom random, SymbolicExpressionTree tree, DefunTreeNode defunBranch, ArgumentTreeNode newArgumentNode) {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentDeleter.cs

    r4068 r4722  
    2121
    2222using System.Linq;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    3334  [StorableClass]
    3435  public sealed class ArgumentDeleter : SymbolicExpressionTreeArchitectureManipulator {
     36    [StorableConstructor]
     37    private ArgumentDeleter(bool deserializing) : base(deserializing) { }
     38    private ArgumentDeleter(ArgumentDeleter original, Cloner cloner) : base(original, cloner) { }
     39    public ArgumentDeleter() : base() { }
     40
    3541    public override sealed void ModifyArchitecture(
    3642      IRandom random,
     
    4147      out bool success) {
    4248      success = DeleteArgument(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, maxFunctionDefiningBranches.Value, maxFunctionArguments.Value);
     49    }
     50
     51    public override IDeepCloneable Clone(Cloner cloner) {
     52      return new ArgumentDeleter(this, cloner);
    4353    }
    4454
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentDuplicater.cs

    r4524 r4722  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
    2224using System.Linq;
     25using HeuristicLab.Common;
    2326using HeuristicLab.Core;
    2427using HeuristicLab.Data;
    2528using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
    2629using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    27 using System.Collections.Generic;
    28 using System;
    2930
    3031namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
     
    3637  [StorableClass]
    3738  public sealed class ArgumentDuplicater : SymbolicExpressionTreeArchitectureManipulator {
     39    [StorableConstructor]
     40    private ArgumentDuplicater(bool deserializing) : base(deserializing) { }
     41    private ArgumentDuplicater(ArgumentDuplicater original, Cloner cloner) : base(original, cloner) { }
     42    public ArgumentDuplicater() : base() { }
     43
    3844    public override sealed void ModifyArchitecture(
    3945      IRandom random,
     
    4450      out bool success) {
    4551      success = DuplicateArgument(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, maxFunctionDefiningBranches.Value, maxFunctionArguments.Value);
     52    }
     53
     54    public override IDeepCloneable Clone(Cloner cloner) {
     55      return new ArgumentDuplicater(this, cloner);
    4656    }
    4757
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/MultiSymbolicExpressionTreeArchitectureManipulator.cs

    r4068 r4722  
    2323using System.Linq;
    2424using HeuristicLab.Collections;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
     
    3536  [Item("MultiSymbolicExpressionTreeArchitectureManipulator", "Randomly selects and applies one of its architecture manipulators every time it is called.")]
    3637  [StorableClass]
    37   public class MultiSymbolicExpressionTreeArchitectureManipulator : StochasticMultiBranch<ISymbolicExpressionTreeArchitectureManipulator>, ISymbolicExpressionTreeArchitectureManipulator, IStochasticOperator {
     38  public sealed class MultiSymbolicExpressionTreeArchitectureManipulator : StochasticMultiBranch<ISymbolicExpressionTreeArchitectureManipulator>, ISymbolicExpressionTreeArchitectureManipulator, IStochasticOperator {
    3839    private const string MaxTreeSizeParameterName = "MaxTreeSize";
    3940    private const string MaxTreeHeightParameterName = "MaxTreeHeight";
     
    5859    #endregion
    5960
    60 
    6161    #region ISymbolicExpressionTreeManipulator Members
    6262    public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
     
    8080    [StorableConstructor]
    8181    private MultiSymbolicExpressionTreeArchitectureManipulator(bool deserializing) : base(deserializing) { }
     82    private MultiSymbolicExpressionTreeArchitectureManipulator(MultiSymbolicExpressionTreeArchitectureManipulator original, Cloner cloner) : base(original, cloner) { }
    8283    public MultiSymbolicExpressionTreeArchitectureManipulator()
    8384      : base() {
     
    9394          Operators.Add((ISymbolicExpressionTreeArchitectureManipulator)Activator.CreateInstance(type), true);
    9495      }
     96    }
     97
     98    public override IDeepCloneable Clone(Cloner cloner) {
     99      return new MultiSymbolicExpressionTreeArchitectureManipulator(this, cloner);
    95100    }
    96101
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineCreater.cs

    r4249 r4722  
    2424using System.Linq;
    2525using System.Text;
     26using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Data;
     
    3940  public sealed class SubroutineCreater : SymbolicExpressionTreeArchitectureManipulator {
    4041    private const double ARGUMENT_CUTOFF_PROBABILITY = 0.05;
     42
     43    [StorableConstructor]
     44    private SubroutineCreater(bool deserializing) : base(deserializing) { }
     45    private SubroutineCreater(SubroutineCreater original, Cloner cloner) : base(original, cloner) { }
     46    public SubroutineCreater() : base() { }
     47
     48    public override IDeepCloneable Clone(Cloner cloner) {
     49      return new SubroutineCreater(this, cloner);
     50    }
    4151
    4252    public override sealed void ModifyArchitecture(
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDeleter.cs

    r4068 r4722  
    2222using System;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3637  [StorableClass]
    3738  public sealed class SubroutineDeleter : SymbolicExpressionTreeArchitectureManipulator {
     39    [StorableConstructor]
     40    private SubroutineDeleter(bool deserializing) : base(deserializing) { }
     41    private SubroutineDeleter(SubroutineDeleter original, Cloner cloner) : base(original, cloner) { }
     42    public SubroutineDeleter() : base() { }
     43
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new SubroutineDeleter(this, cloner);
     46    }
     47
    3848    public override sealed void ModifyArchitecture(
    3949      IRandom random,
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDuplicater.cs

    r4249 r4722  
    2424using System.Linq;
    2525using System.Text;
     26using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Data;
     
    3738  [StorableClass]
    3839  public sealed class SubroutineDuplicater : SymbolicExpressionTreeArchitectureManipulator {
     40    [StorableConstructor]
     41    private SubroutineDuplicater(bool deserializing) : base(deserializing) { }
     42    private SubroutineDuplicater(SubroutineDuplicater original, Cloner cloner)
     43      : base(original, cloner) {
     44    }
     45    public SubroutineDuplicater() : base() { }
     46
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new SubroutineDuplicater(this, cloner);
     49    }
     50
    3951    public override sealed void ModifyArchitecture(
    4052      IRandom random,
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SymbolicExpressionTreeArchitectureManipulator.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    5152      get { return MaxFunctionArgumentsParameter.ActualValue; }
    5253    }
     54    [StorableConstructor]
     55    protected SymbolicExpressionTreeArchitectureManipulator(bool deserializing) : base(deserializing) { }
     56    protected SymbolicExpressionTreeArchitectureManipulator(SymbolicExpressionTreeArchitectureManipulator original, Cloner cloner) : base(original, cloner) { }
    5357    public SymbolicExpressionTreeArchitectureManipulator()
    5458      : base() {
Note: See TracChangeset for help on using the changeset viewer.