#region License Information
/* HeuristicLab
* Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using HEAL.Attic;
using HeuristicLab.Common;
using HeuristicLab.Core;
using HeuristicLab.Data;
using HeuristicLab.Optimization;
namespace HeuristicLab.Analysis.FitnessLandscape {
[Item("Adaptive Walk Calculator", "Calculates characteristics from an adaptive walk.")]
[StorableType("C7E8743D-572E-43DC-A4F3-8044CA4E412E")]
public sealed class AdaptiveWalkCalculator : AlgorithmCharacteristicCalculator {
[StorableConstructor]
private AdaptiveWalkCalculator(StorableConstructorFlag _) : base(_) { }
private AdaptiveWalkCalculator(AdaptiveWalkCalculator original, Cloner cloner)
: base(original, cloner) { }
public AdaptiveWalkCalculator() : this(new AdaptiveWalk()) { }
public AdaptiveWalkCalculator(AdaptiveWalk walker) : base(walker) {
characteristics = new CheckedItemList(
new[] { "AutoCorrelation1", "CorrelationLength", "InformationContent",
"PartialInformationContent", "DensityBasinInformation", "InformationStability",
"Diversity", "Regularity", "TotalEntropy", "PeakInformationContent",
"PeakDensityBasinInformation" }.Select(x => new StringValue(x)));
}
public override IDeepCloneable Clone(Cloner cloner) {
return new AdaptiveWalkCalculator(this, cloner);
}
public override bool CanCalculate() {
return base.CanCalculate() && Problem.Operators.Any(x => x is IManipulator);
}
public override IEnumerable Calculate() {
foreach (var result in base.Calculate())
yield return new Result("AdaptiveWalk." + Algorithm.MutatorParameter.Value.Name + "." + result.Name, result.Value);
}
}
}