#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 HEAL.Attic;
using HeuristicLab.Common;
using HeuristicLab.Core;
using HeuristicLab.Data;
using HeuristicLab.Parameters;
namespace HeuristicLab.Analysis.FitnessLandscape {
[Item("Up/Down Walk", "An up/down walk attempts to take the best of the sample until no better can be found and then switch to take the worse until no worse can be found.")]
[StorableType("81877EC4-294E-474A-8E48-6E37D0B702BC")]
[Creatable(CreatableAttribute.Categories.TestingAndAnalysis + CreatableAttribute.Categories.SplitToken + "1" + CreatableAttribute.Categories.OrderToken + "FLA", Priority = 302)]
public sealed class UpDownWalk : LocalAnalysis {
public IFixedValueParameter SampleSizeParameter {
get { return (IFixedValueParameter)Parameters["SampleSize"]; }
}
[StorableConstructor]
private UpDownWalk(StorableConstructorFlag _) : base(_) { }
private UpDownWalk(UpDownWalk original, Cloner cloner) : base(original, cloner) { }
public UpDownWalk()
: base(new UpDownSelector()) {
Parameters.Add(new FixedValueParameter("SampleSize", "Number of moves that MultiMoveGenerators should create. This is ignored for Exhaustive- and SingleMoveGenerators.", new IntValue(10)));
VariableCreator.CollectedValues.Add(new ValueParameter("MoveTowardsOptimum", new BoolValue(true)));
VariableCreator.CollectedValues.Add(new ValueParameter("BaseQuality", new DoubleValue(double.NaN)));
SelectorParameter.Value.BaseQualityParameter.ActualName = "BaseQuality";
SelectorParameter.Value.MoveTowardsOptimumParameter.ActualName = "MoveTowardsOptimum";
}
protected override void Parameterize() {
base.Parameterize();
if (Problem == null) return;
SelectorParameter.Value.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
}
public override IDeepCloneable Clone(Cloner cloner) {
return new UpDownWalk(this, cloner);
}
}
}