Last change
on this file since 12547 was
12483,
checked in by ascheibe, 10 years ago
|
#2306 added a new project for NK landscapes and ported it to BasicProblem
|
File size:
1.3 KB
|
Rev | Line | |
---|
[12483] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using HeuristicLab.Core;
|
---|
| 6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 7 | using HeuristicLab.Common;
|
---|
| 8 |
|
---|
| 9 | namespace HeuristicLab.Problems.NK.WeightInitializers {
|
---|
| 10 |
|
---|
| 11 | [Item("ReverseLienarWeightsInitializer", "Assigned exponentially decreasing weights.")]
|
---|
| 12 | public class ReverseLinearWeightsInitializer : NamedItem, IWeightsInitializer {
|
---|
| 13 |
|
---|
| 14 | public override bool CanChangeName { get { return false; } }
|
---|
| 15 | public override bool CanChangeDescription { get { return false; } }
|
---|
| 16 |
|
---|
| 17 | [StorableConstructor]
|
---|
| 18 | protected ReverseLinearWeightsInitializer(bool deserializing) : base(deserializing) { }
|
---|
| 19 | protected ReverseLinearWeightsInitializer(ReverseLinearWeightsInitializer original, Cloner cloner)
|
---|
| 20 | : base(original, cloner) {
|
---|
| 21 | }
|
---|
| 22 | public ReverseLinearWeightsInitializer() {
|
---|
| 23 | name = ItemName;
|
---|
| 24 | description = ItemDescription;
|
---|
| 25 | }
|
---|
| 26 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 27 | return new ReverseLinearWeightsInitializer(this, cloner);
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | #region IWeightsInitializer Members
|
---|
| 31 |
|
---|
| 32 | public IEnumerable<double> GetWeights(int nComponents) {
|
---|
| 33 | for (int i = nComponents-1; i>=0; i--)
|
---|
| 34 | yield return i;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | #endregion
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.