Ignore:
Timestamp:
08/29/18 18:16:05 (23 months ago)
Author:
abeham
Message:

#2457:

  • Changed calculation of correlation length (using limit introduced Hordijk 1996)
  • Changed RuggednessCalculator (no more a HL item)
  • Added additional, information-analysis-based features for directed walks
  • Added generic DirectedWalk algorithm (as described in thesis)
  • Made OneSizeInstanceProvider parametrizable
  • Adapted program for analyzing problem instance reidentification
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2457_ExpertSystem/HeuristicLab.Analysis.FitnessLandscape/3.3/Analysis/RuggednessAnalyzer.cs

    r13583 r16096  
    2020#endregion
    2121
     22using System.Linq;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2728using HeuristicLab.Parameters;
    2829using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using System.Linq;
    3030
    3131namespace HeuristicLab.Analysis.FitnessLandscape {
    32   [Item("Ruggedness Analyzer", "Analyzes autocorrelation for one mutation step and correlation length.")]
     32  [Item("Ruggedness Analyzer", "Analyzes autocorrelation for one mutation step and correlation length. Correlation length is calculated according to the statistical correlation length defined by Hordijk, W., 1996. A measure of landscapes. Evolutionary computation, 4(4), pp.335-360.")]
    3333  [StorableClass]
    3434  public class RuggednessAnalyzer : SingleSuccessorOperator, IQualityTrailAnalyzer {
     
    5050      get { return (LookupParameter<IntValue>)Parameters["CorrelationLength"]; }
    5151    }
     52    public ValueLookupParameter<DoubleValue> LimitParameter {
     53      get { return (ValueLookupParameter<DoubleValue>)Parameters["Limit"]; }
     54    }
    5255    #endregion
    5356
     
    6063      Parameters.Add(new LookupParameter<DoubleValue>("AutoCorrelation1", "Autocorrelation for one mutation step."));
    6164      Parameters.Add(new LookupParameter<IntValue>("CorrelationLength", "The correlation length."));
     65      Parameters.Add(new ValueLookupParameter<DoubleValue>("Limit", "The limit for the statistical correlation length, if left empty 2 / sqrt(n), where n = length of walk will be used, as defined by Hordijk 1996."));
    6266    }
    6367
     
    7074      if (qualityTrail == null || qualityTrail.Rows.Count <= 0) return base.Apply();
    7175      var results = ResultsParameter.ActualValue;
     76      var limit = LimitParameter.ActualValue?.Value;
    7277      double[] autocorrelationValues;
    73       var correlationLength = RuggednessCalculator.CalculateCorrelationLength(qualityTrail.Rows.First().Values.ToArray(), out autocorrelationValues);
     78      var correlationLength = RuggednessCalculator.CalculateCorrelationLength(qualityTrail.Rows.First().Values.ToArray(), out autocorrelationValues, limit);
    7479      var cl = new IntValue(correlationLength);
    7580      CorrelationLengthParameter.ActualValue = cl;
    76       AddOrUpdateResult(results, CorrelationLengthParameter.Name, cl);
     81      results.AddOrUpdateResult(CorrelationLengthParameter.Name, cl);
    7782      var ac1 = new DoubleValue(autocorrelationValues.Length > 1 ? autocorrelationValues[1] : 0.0);
    7883      AutoCorrelation1Parameter.ActualValue = ac1;
    79       AddOrUpdateResult(results, AutoCorrelation1Parameter.Name, ac1);
     84      results.AddOrUpdateResult(AutoCorrelation1Parameter.Name, ac1);
    8085      return base.Apply();
    81     }
    82 
    83     private static void AddOrUpdateResult(ResultCollection results, string name, IItem item, bool clone = false) {
    84       IResult r;
    85       if (!results.TryGetValue(name, out r)) {
    86         results.Add(new Result(name, clone ? (IItem)item.Clone() : item));
    87       } else r.Value = clone ? (IItem)item.Clone() : item;
    8886    }
    8987  }
Note: See TracChangeset for help on using the changeset viewer.