#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("Up/Down Walk Calculator", "Calculates characteristics from an up/down walk.")] [StorableType("3DDC32D3-A1F8-4A59-9AF1-48AFFC50B4E4")] public sealed class UpDownWalkCalculator : AlgorithmCharacteristicCalculator { [StorableConstructor] private UpDownWalkCalculator(StorableConstructorFlag _) : base(_) { } private UpDownWalkCalculator(UpDownWalkCalculator original, Cloner cloner) : base(original, cloner) { } public UpDownWalkCalculator() : this(new UpDownWalk()) { } public UpDownWalkCalculator(UpDownWalk walker) : base(walker) { Name = ItemName; Description = ItemDescription; characteristics = new CheckedItemList( new[] { "AutoCorrelation1", "CorrelationLength", "InformationContent", "PartialInformationContent", "DensityBasinInformation", "InformationStability", "Diversity", "Regularity", "TotalEntropy", "PeakInformationContent", "PeakDensityBasinInformation", "DownWalkLength", "UpWalkLength", "UpWalkLenVar", "DownWalkLenVar", "LowerVariance", "UpperVariance" }.Select(x => new StringValue(x))); } public override IDeepCloneable Clone(Cloner cloner) { return new UpDownWalkCalculator(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("UpDownWalk." + Algorithm.MutatorParameter.Value.Name + "." + result.Name, result.Value); } } }