Free cookie consent management tool by TermsFeed Policy Generator

source: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape/MultiTrajectory/PreassignedRealVectorCreator.cs @ 11017

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

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

File size: 1.8 KB
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Core;
3using HeuristicLab.Data;
4using HeuristicLab.Encodings.RealVectorEncoding;
5using HeuristicLab.Parameters;
6using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7
8namespace HeuristicLab.Analysis.FitnessLandscape.MultiTrajectory {
9
10  [StorableClass]
11  public class PreassignedRealVectorCreator : PreassignedSolutionCreator, IRealVectorCreator {
12
13    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
14      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
15    }
16    public IValueLookupParameter<IntValue> LengthParameter {
17      get { return (IValueLookupParameter<IntValue>)Parameters["Length"]; }
18    }
19    public ILookupParameter<RealVector> RealVectorParameter {
20      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
21    }
22
23    [StorableConstructor]
24    protected PreassignedRealVectorCreator(bool deserializing) : base(deserializing) { }
25    protected PreassignedRealVectorCreator(PreassignedRealVectorCreator original, Cloner cloner)
26      : base(original, cloner) {
27    }
28    public override IDeepCloneable Clone(Cloner cloner) {
29      return new PreassignedRealVectorCreator(this, cloner);
30    }
31
32    public PreassignedRealVectorCreator() {
33      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "Bounds of the real vector to create."));
34      Parameters.Add(new ValueLookupParameter<IntValue>("Length", "Length of the real vector."));
35      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The created real vector"));
36    }
37
38    public override void Create(IScope scope) {
39      if (scope.Variables.ContainsKey(RealVectorParameter.ActualName))
40        RealVectorParameter.ActualValue = scope.Variables[RealVectorParameter.ActualName].Value as RealVector;
41    }
42
43  }
44}
Note: See TracBrowser for help on using the repository browser.