using HeuristicLab.Operators; using HeuristicLab.Optimization; using HeuristicLab.Core; using HeuristicLab.Parameters; using HeuristicLab.Common; using HeuristicLab.Data; using HEAL.Attic; namespace HeuristicLab.Problems.MetaOptimization { [StorableType("FF6DCDF5-434C-4D47-8D67-5BD52BAB2D01")] public class AverageIntValueCrossover : SingleSuccessorOperator, IIntValueCrossover, IStochasticOperator { public ILookupParameter RandomParameter { get { return (LookupParameter)Parameters["Random"]; } } public AverageIntValueCrossover() { } [StorableConstructor] protected AverageIntValueCrossover(StorableConstructorFlag _) : base(_) { } protected AverageIntValueCrossover(AverageIntValueCrossover original, Cloner cloner) : base(original, cloner) { } public override IDeepCloneable Clone(Cloner cloner) { return new AverageIntValueCrossover(this, cloner); } public void Apply(IRandom random, IntValue value, IntValue other, IntValueRange range) { ApplyStatic(random, value, other, range); } public static void ApplyStatic(IRandom random, IntValue value, IntValue other, IntValueRange range) { value.Value = (value.Value + other.Value) / 2; } } }