Changeset 5385 for trunk/sources/HeuristicLab.Encodings.RealVectorEncoding
- Timestamp:
- 01/27/11 10:42:04 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3
- Files:
-
- 1 added
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj
r5381 r5385 111 111 <Compile Include="BoundsChecker.cs" /> 112 112 <Compile Include="Creators\UniformRandomRealVectorCreator.cs" /> 113 <Compile Include="Manipulators\SelfAdaptiveNormalAllPositionsManipulator.cs" /> 113 114 <Compile Include="RealVectorCreator.cs" /> 114 115 <Compile Include="RealVectorCrossover.cs" /> … … 140 141 <Compile Include="Interfaces\IRealVectorMoveOperator.cs" /> 141 142 <Compile Include="Manipulators\MultiRealVectorManipulator.cs" /> 142 <Compile Include="Manipulators\ NormalAllPositionsManipulator.cs" />143 <Compile Include="Manipulators\FixedNormalAllPositionsManipulator.cs" /> 143 144 <Compile Include="Moves\AdditiveMoveTabuChecker.cs" /> 144 145 <Compile Include="Moves\AdditiveMoveTabuMaker.cs" /> -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/SelfAdaptiveNormalAllPositionsManipulator.cs
r5374 r5385 37 37 /// The strategy vector can be of smaller length than the solution vector, in which case values are taken from the beginning again once the end of the strategy vector is reached. 38 38 /// </remarks> 39 [Item(" NormalAllPositionsManipulator", "This manipulation operator adds a value sigma_i * N(0,1) to the current value in each position i. The values for sigma_i are taken from the strategy vector, if there are less elements in the strategy vector than positions, then the strategy vector is cycled. It is implemented as described in Beyer, H.-G. and Schwefel, H.-P. 2002. Evolution Strategies - A Comprehensive Introduction Natural Computing, 1, pp. 3-52.")]39 [Item("SelfAdaptiveNormalAllPositionsManipulator", "This manipulation operator adds a value sigma_i * N(0,1) to the current value in each position i. The values for sigma_i are looked up dynamically. If there are less elements in the strategy vector than positions, then the strategy vector is cycled. It is implemented as described in Beyer, H.-G. and Schwefel, H.-P. 2002. Evolution Strategies - A Comprehensive Introduction Natural Computing, 1, pp. 3-52.")] 40 40 [StorableClass] 41 // BackwardsCompatibility3.3 42 // Rename class to match file- and itemname when upgrading to 3.4 41 43 public class NormalAllPositionsManipulator : RealVectorManipulator, ISelfAdaptiveManipulator { 42 44 public Type StrategyParameterType { … … 46 48 /// Parameter for the strategy vector. 47 49 /// </summary> 48 public I ValueLookupParameter<RealVector> StrategyParameterParameter {49 get { return (I ValueLookupParameter<RealVector>)Parameters["StrategyParameter"]; }50 public ILookupParameter<RealVector> StrategyParameterParameter { 51 get { return (ILookupParameter<RealVector>)Parameters["StrategyParameter"]; } 50 52 } 51 53 … … 63 65 public NormalAllPositionsManipulator() 64 66 : base() { 65 Parameters.Add(new ValueLookupParameter<RealVector>("StrategyParameter", "The vector containing the endogenous strategy parameters."));67 Parameters.Add(new LookupParameter<RealVector>("StrategyParameter", "The vector containing the endogenous strategy parameters.")); 66 68 } 67 69 … … 82 84 public static void Apply(IRandom random, RealVector vector, RealVector strategyParameters) { 83 85 NormalDistributedRandom N = new NormalDistributedRandom(random, 0.0, 1.0); 84 if (strategyParameters != null && strategyParameters.Length > 0) {86 if (strategyParameters != null) { 85 87 for (int i = 0; i < vector.Length; i++) { 86 88 vector[i] = vector[i] + (N.NextDouble() * strategyParameters[i % strategyParameters.Length]); 87 89 } 88 90 } else { 91 // BackwardsCompatibility3.3 92 #region Backwards compatible region (remove with 3.4) 93 // when upgrading to 3.4 remove the whole condition and just put the if-branch in place (you should then also throw an ArgumentException when strategyParameters is null or has length 0) 89 94 for (int i = 0; i < vector.Length; i++) { 90 95 vector[i] = vector[i] + N.NextDouble(); 91 96 } 97 #endregion 92 98 } 93 99 }
Note: See TracChangeset
for help on using the changeset viewer.