Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape/MultiTrajectory/PreassignedRealVectorCreator.cs @ 17460

Last change on this file since 17460 was 16995, checked in by gkronber, 6 years ago

#2520 Update plugin dependencies and references for HL.FLA for new persistence

File size: 1.8 KB
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Core;
3using HeuristicLab.Data;
4using HeuristicLab.Encodings.RealVectorEncoding;
5using HeuristicLab.Parameters;
6using HEAL.Attic;
7
8namespace HeuristicLab.Analysis.FitnessLandscape.MultiTrajectory {
9
10  [StorableType("A690FC7E-A8B1-4CAB-AABD-18401330F01D")]
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(StorableConstructorFlag _) : base(_) { }
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.