using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Data; using HeuristicLab.Encodings.RealVectorEncoding; using HeuristicLab.Parameters; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Analysis.FitnessLandscape.MultiTrajectory { [StorableClass] public class PreassignedRealVectorCreator : PreassignedSolutionCreator, IRealVectorCreator { public IValueLookupParameter BoundsParameter { get { return (IValueLookupParameter)Parameters["Bounds"]; } } public IValueLookupParameter LengthParameter { get { return (IValueLookupParameter)Parameters["Length"]; } } public ILookupParameter RealVectorParameter { get { return (ILookupParameter)Parameters["RealVector"]; } } [StorableConstructor] protected PreassignedRealVectorCreator(bool deserializing) : base(deserializing) { } protected PreassignedRealVectorCreator(PreassignedRealVectorCreator original, Cloner cloner) : base(original, cloner) { } public override IDeepCloneable Clone(Cloner cloner) { return new PreassignedRealVectorCreator(this, cloner); } public PreassignedRealVectorCreator() { Parameters.Add(new ValueLookupParameter("Bounds", "Bounds of the real vector to create.")); Parameters.Add(new ValueLookupParameter("Length", "Length of the real vector.")); Parameters.Add(new LookupParameter("RealVector", "The created real vector")); } public override void Create(IScope scope) { if (scope.Variables.ContainsKey(RealVectorParameter.ActualName)) RealVectorParameter.ActualValue = scope.Variables[RealVectorParameter.ActualName].Value as RealVector; } } }