Changeset 4068 for trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/RealVectorToRealVectorEncoder.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/RealVectorToRealVectorEncoder.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 using HeuristicLab.Optimization;27 using HeuristicLab.Operators;28 22 using HeuristicLab.Core; 29 23 using HeuristicLab.Data; 24 using HeuristicLab.Encodings.RealVectorEncoding; 25 using HeuristicLab.Operators; 30 26 using HeuristicLab.Parameters; 31 using HeuristicLab.Encodings.RealVectorEncoding;32 27 33 namespace HeuristicLab.Problems.TestFunctions 34 { 35 public class RealVectorToRealVectorEncoder : SingleSuccessorOperator, IRealVectorPSOEncoder, IRealVectorOperator 36 { 37 #region Parameters 28 namespace HeuristicLab.Problems.TestFunctions { 29 public class RealVectorToRealVectorEncoder : SingleSuccessorOperator, IRealVectorPSOEncoder, IRealVectorOperator { 30 #region Parameters 38 31 39 40 41 32 public IParameter OriginalRealVectorParameter { 33 get { return (IParameter)Parameters["OriginalRealVector"]; } 34 } 42 35 43 44 45 36 public IParameter RealVectorParameter { 37 get { return (IParameter)Parameters["RealVector"]; } 38 } 46 39 47 48 49 40 public ILookupParameter<IntValue> LengthParameter { 41 get { return (ILookupParameter<IntValue>)Parameters["Length"]; } 42 } 50 43 51 52 53 44 public IValueLookupParameter<DoubleMatrix> BoundsParameter { 45 get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; } 46 } 54 47 55 56 57 58 48 protected ScopeParameter CurrentScopeParameter { 49 get { return (ScopeParameter)Parameters["CurrentScope"]; } 50 } 51 #endregion 59 52 60 61 62 53 public IScope CurrentScope { 54 get { return CurrentScopeParameter.ActualValue; } 55 } 63 56 64 public RealVectorToRealVectorEncoder() : base() { 65 Parameters.Add(new LookupParameter<RealVector>("OriginalRealVector", "The original real vector.")); 66 Parameters.Add(new LookupParameter<RealVector>("RealVector", "The resulting reference to the original real vector.")); 67 Parameters.Add(new LookupParameter<IntValue>("Length", "Vector length.")); 68 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope bounds matrix should be cloned.")); 69 Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension.")); 70 } 57 public RealVectorToRealVectorEncoder() 58 : base() { 59 Parameters.Add(new LookupParameter<RealVector>("OriginalRealVector", "The original real vector.")); 60 Parameters.Add(new LookupParameter<RealVector>("RealVector", "The resulting reference to the original real vector.")); 61 Parameters.Add(new LookupParameter<IntValue>("Length", "Vector length.")); 62 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope bounds matrix should be cloned.")); 63 Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension.")); 64 } 71 65 72 73 74 IItem value = (IItem)BoundsParameter.ActualValue.Clone();75 76 77 66 public override IOperation Apply() { 67 RealVectorParameter.ActualValue = OriginalRealVectorParameter.ActualValue; 68 IItem value = (IItem)BoundsParameter.ActualValue.Clone(); 69 CurrentScope.Variables.Add(new Variable("ParticleBounds", BoundsParameter.Description, value == null ? null : (IItem)value.Clone())); 70 return base.Apply(); 71 } 78 72 79 public override bool CanChangeName { 80 get { return false; } 81 } 73 public override bool CanChangeName { 74 get { return false; } 82 75 } 76 } 83 77 }
Note: See TracChangeset
for help on using the changeset viewer.