Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/27/11 10:42:04 (14 years ago)
Author:
abeham
Message:

#1394

  • Separated NormalAllPositionsManipulator into FixedNormalAllPositionsManipulator and SelfAdaptiveNormalAllPositionsManipulator.cs
  • Classname and behavior of SelfAdaptiveNormalAllPositionsManipulator.cs remains to be the same as NormalAllPositionsManipulator for backwards compatibility reasons
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  
    111111    <Compile Include="BoundsChecker.cs" />
    112112    <Compile Include="Creators\UniformRandomRealVectorCreator.cs" />
     113    <Compile Include="Manipulators\SelfAdaptiveNormalAllPositionsManipulator.cs" />
    113114    <Compile Include="RealVectorCreator.cs" />
    114115    <Compile Include="RealVectorCrossover.cs" />
     
    140141    <Compile Include="Interfaces\IRealVectorMoveOperator.cs" />
    141142    <Compile Include="Manipulators\MultiRealVectorManipulator.cs" />
    142     <Compile Include="Manipulators\NormalAllPositionsManipulator.cs" />
     143    <Compile Include="Manipulators\FixedNormalAllPositionsManipulator.cs" />
    143144    <Compile Include="Moves\AdditiveMoveTabuChecker.cs" />
    144145    <Compile Include="Moves\AdditiveMoveTabuMaker.cs" />
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/SelfAdaptiveNormalAllPositionsManipulator.cs

    r5374 r5385  
    3737  /// 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.
    3838  /// </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.")]
    4040  [StorableClass]
     41  // BackwardsCompatibility3.3
     42  // Rename class to match file- and itemname when upgrading to 3.4
    4143  public class NormalAllPositionsManipulator : RealVectorManipulator, ISelfAdaptiveManipulator {
    4244    public Type StrategyParameterType {
     
    4648    /// Parameter for the strategy vector.
    4749    /// </summary>
    48     public IValueLookupParameter<RealVector> StrategyParameterParameter {
    49       get { return (IValueLookupParameter<RealVector>)Parameters["StrategyParameter"]; }
     50    public ILookupParameter<RealVector> StrategyParameterParameter {
     51      get { return (ILookupParameter<RealVector>)Parameters["StrategyParameter"]; }
    5052    }
    5153
     
    6365    public NormalAllPositionsManipulator()
    6466      : 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."));
    6668    }
    6769
     
    8284    public static void Apply(IRandom random, RealVector vector, RealVector strategyParameters) {
    8385      NormalDistributedRandom N = new NormalDistributedRandom(random, 0.0, 1.0);
    84       if (strategyParameters != null && strategyParameters.Length > 0) {
     86      if (strategyParameters != null) {
    8587        for (int i = 0; i < vector.Length; i++) {
    8688          vector[i] = vector[i] + (N.NextDouble() * strategyParameters[i % strategyParameters.Length]);
    8789        }
    8890      } 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)
    8994        for (int i = 0; i < vector.Length; i++) {
    9095          vector[i] = vector[i] + N.NextDouble();
    9196        }
     97        #endregion
    9298      }
    9399    }
Note: See TracChangeset for help on using the changeset viewer.