Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4679


Ignore:
Timestamp:
10/29/10 19:31:19 (14 years ago)
Author:
swagner
Message:

Finished cloning refactoring of HeuristicLab.Optimization.Operators (#922)

Location:
branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/ChildrenCreator.cs

    r4068 r4679  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    5354    }
    5455
     56    [StorableConstructor]
     57    private ChildrenCreator(bool deserializing) : base(deserializing) { }
     58    private ChildrenCreator(ChildrenCreator original, Cloner cloner) : base(original, cloner) { }
    5559    public ChildrenCreator()
    5660      : base() {
    5761      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope whose sub-scopes represent the parents."));
    5862      Parameters.Add(new ValueLookupParameter<IntValue>("ParentsPerChild", "The number of parents that should be crossed per child. Note that some of the typical crossover operators require exactly two parents.", new IntValue(2)));
     63    }
     64
     65    public override IDeepCloneable Clone(Cloner cloner) {
     66      return new ChildrenCreator(this, cloner);
    5967    }
    6068
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/DiscreteDoubleValueModifier.cs

    r4068 r4679  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    7071    }
    7172
     73    [StorableConstructor]
     74    protected DiscreteDoubleValueModifier(bool deserializing) : base(deserializing) { }
     75    protected DiscreteDoubleValueModifier(DiscreteDoubleValueModifier original, Cloner cloner) : base(original, cloner) { }
    7276    /// <summary>
    7377    /// Initializes a new instance of <see cref="DiscreteDoubleValueModifier"/> with 6 parameters
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/ExponentialDiscreteDoubleValueModifier.cs

    r4068 r4679  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3132  [StorableClass]
    3233  public class ExponentialDiscreteDoubleValueModifier : DiscreteDoubleValueModifier {
     34    [StorableConstructor]
     35    protected ExponentialDiscreteDoubleValueModifier(bool deserializing) : base(deserializing) { }
     36    protected ExponentialDiscreteDoubleValueModifier(ExponentialDiscreteDoubleValueModifier original, Cloner cloner) : base(original, cloner) { }
     37    public ExponentialDiscreteDoubleValueModifier() : base() { }
     38
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new ExponentialDiscreteDoubleValueModifier(this, cloner);
     41    }
     42
    3343    /// <summary>
    3444    /// Calculates a new value based on exponential decay or growth.
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/LinearDiscreteDoubleValueModifier.cs

    r4068 r4679  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3031  [StorableClass]
    3132  public class LinearDiscreteDoubleValueModifier : DiscreteDoubleValueModifier {
     33    [StorableConstructor]
     34    protected LinearDiscreteDoubleValueModifier(bool deserializing) : base(deserializing) { }
     35    protected LinearDiscreteDoubleValueModifier(LinearDiscreteDoubleValueModifier original, Cloner cloner) : base(original, cloner) { }
     36    public LinearDiscreteDoubleValueModifier() : base() { }
     37
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new LinearDiscreteDoubleValueModifier(this, cloner);
     40    }
     41
    3242    protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
    3343      double k = (endValue - startValue) / (endIndex - startIndex);
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/ProbabilisticQualityComparator.cs

    r4068 r4679  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4546    }
    4647
     48    [StorableConstructor]
     49    protected ProbabilisticQualityComparator(bool deserializing) : base(deserializing) { }
     50    protected ProbabilisticQualityComparator(ProbabilisticQualityComparator original, Cloner cloner) : base(original, cloner) { }
    4751    public ProbabilisticQualityComparator()
    4852      : base() {
    4953      Parameters.Add(new LookupParameter<DoubleValue>("Dampening", "The dampening factor that influences the probability."));
    5054      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     55    }
     56
     57    public override IDeepCloneable Clone(Cloner cloner) {
     58      return new ProbabilisticQualityComparator(this, cloner);
    5159    }
    5260
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/QuadraticDiscreteDoubleValueModifier.cs

    r4068 r4679  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3031  [StorableClass]
    3132  public class QuadraticDiscreteDoubleValueModifier : DiscreteDoubleValueModifier {
     33    [StorableConstructor]
     34    protected QuadraticDiscreteDoubleValueModifier(bool deserializing) : base(deserializing) { }
     35    protected QuadraticDiscreteDoubleValueModifier(QuadraticDiscreteDoubleValueModifier original, Cloner cloner) : base(original, cloner) { }
     36    public QuadraticDiscreteDoubleValueModifier() : base() { }
     37
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new QuadraticDiscreteDoubleValueModifier(this, cloner);
     40    }
     41
    3242    protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
    3343      double a = (endValue - startValue) / ((endIndex - startIndex) * (endIndex - startIndex));
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/QualityComparator.cs

    r4068 r4679  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    4344    }
    4445
     46    [StorableConstructor]
     47    protected QualityComparator(bool deserializing) : base(deserializing) { }
     48    protected QualityComparator(QualityComparator original, Cloner cloner) : base(original, cloner) { }
    4549    public QualityComparator()
    4650      : base() {
     
    4953      Parameters.Add(new LookupParameter<BoolValue>("Result", "The result of the comparison."));
    5054      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
     55    }
     56
     57    public override IDeepCloneable Clone(Cloner cloner) {
     58      return new QualityComparator(this, cloner);
    5159    }
    5260
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/ResultsCollector.cs

    r4068 r4679  
    2121
    2222using System.Collections;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4647    }
    4748
     49    [StorableConstructor]
     50    protected ResultsCollector(bool deserializing) : base(deserializing) { }
     51    protected ResultsCollector(ResultsCollector original, Cloner cloner) : base(original, cloner) { }
    4852    public ResultsCollector()
    4953      : base() {
    5054      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the collected values should be stored."));
    5155      Parameters.Add(new ValueParameter<BoolValue>("CopyValue", "True if the collected result value should be copied, otherwise false.", new BoolValue(false)));
     56    }
     57
     58    public override IDeepCloneable Clone(Cloner cloner) {
     59      return new ResultsCollector(this, cloner);
    5260    }
    5361
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/SASEGASAReunificator.cs

    r4489 r4679  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    4142    }
    4243
     44    [StorableConstructor]
     45    protected SASEGASAReunificator(bool deserializing) : base(deserializing) { }
     46    protected SASEGASAReunificator(SASEGASAReunificator original, Cloner cloner) : base(original, cloner) { }
    4347    public SASEGASAReunificator()
    4448      : base() {
    4549      Parameters.Add(new LookupParameter<IntValue>("VillageCount", "The number of villages left after the reunification."));
    4650    }
     51
     52    public override IDeepCloneable Clone(Cloner cloner) {
     53      return new SASEGASAReunificator(this, cloner);
     54    }
     55
    4756    /// <summary>
    4857    /// Joins all sub sub scopes of the given <paramref name="scope"/>, reduces the number of sub
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/SolutionsCreator.cs

    r4068 r4679  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    5354    }
    5455
     56    [StorableConstructor]
     57    private SolutionsCreator(bool deserializing) : base(deserializing) { }
     58    private SolutionsCreator(SolutionsCreator original, Cloner cloner) : base(original, cloner) { }
    5559    public SolutionsCreator()
    5660      : base() {
     
    5963      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator which is used to evaluate new solutions."));
    6064      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new solutions are added as sub-scopes."));
     65    }
     66
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new SolutionsCreator(this, cloner);
    6169    }
    6270
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/SquareRootDiscreteDoubleValueModifier.cs

    r4068 r4679  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3132  [StorableClass]
    3233  public class SquareRootDiscreteDoubleValueModifier : DiscreteDoubleValueModifier {
     34    [StorableConstructor]
     35    protected SquareRootDiscreteDoubleValueModifier(bool deserializing) : base(deserializing) { }
     36    protected SquareRootDiscreteDoubleValueModifier(SquareRootDiscreteDoubleValueModifier original, Cloner cloner) : base(original, cloner) { }
     37    public SquareRootDiscreteDoubleValueModifier() : base() { }
     38
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new SquareRootDiscreteDoubleValueModifier(this, cloner);
     41    }
     42
    3343    protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
    3444      double a = (endValue - startValue) / Math.Sqrt(endIndex - startIndex);
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/TabuMaker.cs

    r4068 r4679  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    4950    }
    5051
     52    [StorableConstructor]
     53    protected TabuMaker(bool deserializing) : base(deserializing) { }
     54    protected TabuMaker(TabuMaker original, Cloner cloner) : base(original, cloner) { }
    5155    protected TabuMaker()
    5256      : base() {
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/UnidirectionalRingMigrator.cs

    r4477 r4679  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Operators;
     
    3233  [StorableClass]
    3334  public class UnidirectionalRingMigrator : SingleSuccessorOperator, IMigrator {
     35    [StorableConstructor]
     36    protected UnidirectionalRingMigrator(bool deserializing) : base(deserializing) { }
     37    protected UnidirectionalRingMigrator(UnidirectionalRingMigrator original, Cloner cloner) : base(original, cloner) { }
     38    public UnidirectionalRingMigrator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new UnidirectionalRingMigrator(this, cloner);
     42    }
     43
    3444    /// <summary>
    3545    /// Migrates every first sub scope of each child to its left neighbour (like a ring).
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/UserDefinedCrossover.cs

    r3871 r4679  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    2728  [StorableClass]
    2829  public class UserDefinedCrossover : UserDefinedOperator, ICrossover {
     30    [StorableConstructor]
     31    protected UserDefinedCrossover(bool deserializing) : base(deserializing) { }
     32    protected UserDefinedCrossover(UserDefinedCrossover original, Cloner cloner) : base(original, cloner) { }
     33    public UserDefinedCrossover() : base() { }
     34
     35    public override IDeepCloneable Clone(Cloner cloner) {
     36      return new UserDefinedCrossover(this, cloner);
     37    }
    2938  }
    3039}
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/UserDefinedEvaluator.cs

    r3871 r4679  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    3334    }
    3435
     36    [StorableConstructor]
     37    protected UserDefinedEvaluator(bool deserializing) : base(deserializing) { }
     38    protected UserDefinedEvaluator(UserDefinedEvaluator original, Cloner cloner) : base(original, cloner) { }
    3539    public UserDefinedEvaluator()
    3640      : base() {
    3741      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value of the solution."));
    3842    }
     43
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new UserDefinedEvaluator(this, cloner);
     46    }
    3947  }
    4048}
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/UserDefinedManipulator.cs

    r3871 r4679  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    2728  [StorableClass]
    2829  public class UserDefinedManipulator : UserDefinedOperator, IManipulator {
     30    [StorableConstructor]
     31    protected UserDefinedManipulator(bool deserializing) : base(deserializing) { }
     32    protected UserDefinedManipulator(UserDefinedManipulator original, Cloner cloner) : base(original, cloner) { }
     33    public UserDefinedManipulator() : base() { }
     34
     35    public override IDeepCloneable Clone(Cloner cloner) {
     36      return new UserDefinedManipulator(this, cloner);
     37    }
    2938  }
    3039}
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/UserDefinedOperator.cs

    r3871 r4679  
    2121
    2222using System.Linq;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Operators;
     
    2930  [StorableClass]
    3031  public abstract class UserDefinedOperator : CheckedMultiOperator<IOperator> {
     32    [StorableConstructor]
     33    protected UserDefinedOperator(bool deserializing) : base(deserializing) { }
     34    protected UserDefinedOperator(UserDefinedOperator original, Cloner cloner) : base(original, cloner) { }
     35    public UserDefinedOperator() : base() { }
     36
    3137    public override IOperation Apply() {
    3238      OperationCollection result = new OperationCollection();
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/UserDefinedSolutionCreator.cs

    r3871 r4679  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    2728  [StorableClass]
    2829  public class UserDefinedSolutionCreator : UserDefinedOperator, ISolutionCreator {
     30    [StorableConstructor]
     31    protected UserDefinedSolutionCreator(bool deserializing) : base(deserializing) { }
     32    protected UserDefinedSolutionCreator(UserDefinedSolutionCreator original, Cloner cloner) : base(original, cloner) { }
     33    public UserDefinedSolutionCreator() : base() { }
     34
     35    public override IDeepCloneable Clone(Cloner cloner) {
     36      return new UserDefinedSolutionCreator(this, cloner);
     37    }
    2938  }
    3039}
  • branches/CloningRefactoring/HeuristicLab.Optimization.Operators/3.3/WeightedParentsQualityComparator.cs

    r3868 r4679  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
     
    4950    }
    5051
     52    [StorableConstructor]
     53    protected WeightedParentsQualityComparator(bool deserializing) : base(deserializing) { }
     54    protected WeightedParentsQualityComparator(WeightedParentsQualityComparator original, Cloner cloner) : base(original, cloner) { }
    5155    public WeightedParentsQualityComparator()
    5256      : base() {
     
    5660      Parameters.Add(new LookupParameter<BoolValue>("Result", "The result of the comparison: True means Quality is better, False means it is worse than parents."));
    5761      Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactor", "Determines if the quality should be compared to the better parent (1.0), to the worse (0.0) or to any linearly interpolated value between them."));
     62    }
     63
     64    public override IDeepCloneable Clone(Cloner cloner) {
     65      return new WeightedParentsQualityComparator(this, cloner);
    5866    }
    5967
Note: See TracChangeset for help on using the changeset viewer.