Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/16/13 15:32:29 (11 years ago)
Author:
abeham
Message:

#1961: implemented reviewer comments

Location:
branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMALinearweightedRecombinator.cs

    r9297 r9709  
    2525
    2626namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
    27   [Item("CMA Linear-weighted Recombinator", "Calculates weighted mean using linear increasing weights.")]
     27  [Item("CMA Linear-weighted Recombinator", "Calculates weighted mean using linear decreasing weights.")]
    2828  [StorableClass]
    2929  public class CMALinearweightedRecombinator : CMARecombinator {
  • branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMALogweightedRecombinator.cs

    r9297 r9709  
    2020#endregion
    2121
     22using System;
     23using System.Linq;
    2224using HeuristicLab.Common;
    2325using HeuristicLab.Core;
    2426using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    25 using System;
    26 using System.Linq;
    2727
    2828namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
    29   [Item("CMA Log-weighted Recombinator", "Calculates weighted mean based on a logarithmic increasing weights.")]
     29  [Item("CMA Log-weighted Recombinator", "Calculates weighted mean based on a logarithmic decreasing weights.")]
    3030  [StorableClass]
    3131  public class CMALogweightedRecombinator : CMARecombinator {
  • branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAMutator.cs

    r9303 r9709  
    7373    }
    7474
    75     public IValueParameter<IntValue> MaxTriesParameter {
    76       get { return (IValueParameter<IntValue>)Parameters["MaxTries"]; }
     75    public IFixedValueParameter<IntValue> MaxTriesParameter {
     76      get { return (IFixedValueParameter<IntValue>)Parameters["MaxTries"]; }
     77    }
     78
     79    public IFixedValueParameter<BoolValue> TruncateAtBoundsParameter {
     80      get { return (IFixedValueParameter<BoolValue>)Parameters["TruncateAtBounds"]; }
    7781    }
    7882    #endregion
     
    9195      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The bounds for the dimensions."));
    9296      Parameters.Add(new LookupParameter<CMAParameters>("StrategyParameters", "The CMA-ES strategy parameters used for mutation."));
    93       Parameters.Add(new ValueParameter<IntValue>("MaxTries", "The maximum number of tries a mutation should be performed if it was outside the bounds.", new IntValue(1000)));
     97      Parameters.Add(new FixedValueParameter<IntValue>("MaxTries", "The maximum number of tries a mutation should be performed if it was outside the bounds.", new IntValue(100)));
     98      Parameters.Add(new FixedValueParameter<BoolValue>("TruncateAtBounds", "Whether the point should be truncated at the bounds if none of the tries resulted in a point within the bounds.", new BoolValue(true)));
    9499    }
    95100
     
    100105    public override IOperation Apply() {
    101106      var maxTries = MaxTriesParameter.Value.Value;
     107      var truncateAtBounds = TruncateAtBoundsParameter.Value.Value;
    102108      var random = RandomParameter.ActualValue;
    103109      var lambda = PopulationSizeParameter.ActualValue.Value;
     
    128134              if (!inRange) tries++;
    129135            } while (!inRange && tries < maxTries);
    130             if (!inRange && maxTries > 1) {
     136            if (!inRange && truncateAtBounds) {
    131137              if (bounds[k % bounds.Rows, 0] > arx[i][k]) arx[i][k] = bounds[k % bounds.Rows, 0];
    132138              else if (bounds[k % bounds.Rows, 1] < arx[i][k]) arx[i][k] = bounds[k % bounds.Rows, 1];
     
    152158            }
    153159          } while (!inRange && tries < maxTries);
    154           if (!inRange && maxTries > 1) {
     160          if (!inRange && truncateAtBounds) {
    155161            for (int k = 0; k < length; k++) {
    156162              if (bounds[k % bounds.Rows, 0] > arx[i][k]) arx[i][k] = bounds[k % bounds.Rows, 0];
Note: See TracChangeset for help on using the changeset viewer.