Free cookie consent management tool by TermsFeed Policy Generator

source: branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/ExponentialWeightsInitializer.cs @ 11163

Last change on this file since 11163 was 7128, checked in by epitzer, 13 years ago

#1696 Integrate fitness landscape analysis plugins from Heureka! repository.

File size: 1.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Core;
6using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7using HeuristicLab.Common;
8
9namespace HeuristicLab.Problems.NK.WeightInitializers {
10
11  [Item("ExponentialWeightsInitializer", "Assigned exponentially increasing weights.")]
12  public class ExponentialWeightsInitializer : NamedItem, IWeightsInitializer {
13
14    public override bool CanChangeName { get { return false; } }
15    public override bool CanChangeDescription { get { return false; } }
16
17    [StorableConstructor]
18    protected ExponentialWeightsInitializer(bool deserializing) : base(deserializing) { }
19    protected ExponentialWeightsInitializer(ExponentialWeightsInitializer original, Cloner cloner)
20      : base(original, cloner) {
21    }
22    public ExponentialWeightsInitializer() {
23      name = ItemName;
24      description = ItemDescription;
25    }
26    public override IDeepCloneable Clone(Cloner cloner) {
27      return new ExponentialWeightsInitializer(this, cloner);
28    }
29
30    #region IWeightsInitializer Members
31
32    public IEnumerable<double> GetWeights(int nComponents) {
33      for (int i = 0; i<nComponents; i++)
34        yield return Math.Pow(2, i);
35    }
36
37    #endregion
38  }
39
40}
Note: See TracBrowser for help on using the repository browser.