1 | using HeuristicLab.Common;
|
---|
2 | using HeuristicLab.Core;
|
---|
3 | using HeuristicLab.Data;
|
---|
4 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
5 | using HeuristicLab.Parameters;
|
---|
6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
7 |
|
---|
8 | namespace 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 | }
|
---|