using System; using System.Collections.Generic; using System.Linq; using System.Text; using HeuristicLab.Core; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; using HeuristicLab.Common; namespace HeuristicLab.Problems.NK.WeightInitializers { [Item("EqualWeightsInitializer", "Initializes all weights to 1.0")] public class EqualWeightsInitializer : NamedItem, IWeightsInitializer { public override bool CanChangeName { get { return false; } } public override bool CanChangeDescription { get { return false; } } [StorableConstructor] protected EqualWeightsInitializer(bool deserializing) : base(deserializing) { } protected EqualWeightsInitializer(EqualWeightsInitializer original, Cloner cloner) : base(original, cloner) { } public EqualWeightsInitializer() { name = ItemName; description = ItemDescription; } public override IDeepCloneable Clone(Cloner cloner) { return new EqualWeightsInitializer(this, cloner); } #region IWeightsInitializer Members public IEnumerable GetWeights(int nComponents) { return new[] { 1.0 }; } #endregion } }