Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/17/17 12:51:44 (8 years ago)
Author:
abeham
Message:

#2457: worked on problem instance detection

Location:
branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis
Files:
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/CharacteristicCalculator.cs

    r13667 r14678  
    2727using System.Collections.Generic;
    2828
    29 namespace HeuristicLab.Problems.CharacteristicAnalysis {
     29namespace HeuristicLab.Analysis.FitnessLandscape {
    3030  [Item("Characteristic Calculator", "")]
    3131  [StorableClass]
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/DoubleMatrixCharacteristicCalculator.cs

    r13667 r14678  
    2525using System.Linq;
    2626
    27 namespace HeuristicLab.Problems.CharacteristicAnalysis {
     27namespace HeuristicLab.Analysis.FitnessLandscape {
    2828  public static class DoubleMatrixCharacteristicCalculator {
    2929    public static double CoeffVariation(DoubleMatrix m) {
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/QAP/QAPCharacteristicCalculator.cs

    r13667 r14678  
    3030using System.Linq;
    3131
    32 namespace HeuristicLab.Problems.CharacteristicAnalysis.QAP {
     32namespace HeuristicLab.Analysis.FitnessLandscape {
    3333  [Item("QAP Characteristic Calculator", "")]
    3434  [StorableClass]
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/QAP/QAPDirectedWalk.cs

    r14429 r14678  
    3333using System.Linq;
    3434
    35 namespace HeuristicLab.Problems.CharacteristicAnalysis.QAP {
     35namespace HeuristicLab.Analysis.FitnessLandscape {
    3636  [Item("Directed Walk (QAP-specific)", "")]
    3737  [StorableClass]
     
    110110    }
    111111
     112    public static IEnumerable<IResult> Calculate(List<List<Tuple<Permutation, double>>> trajectories) {
     113      var firstDerivatives = trajectories.Select(path => ApproximateDerivative(path).ToList()).ToList();
     114      var secondDerivatives = firstDerivatives.Select(d1 => ApproximateDerivative(d1).ToList()).ToList();
     115
     116      var props = GetCharacteristics(trajectories, firstDerivatives, secondDerivatives).ToDictionary(x => x.Item1, x => x.Item2);
     117      yield return new Result("Swap2.Sharpness", new DoubleValue(props["Sharpness"]));
     118      yield return new Result("Swap2.Bumpiness", new DoubleValue(props["Bumpiness"]));
     119      yield return new Result("Swap2.Flatness", new DoubleValue(props["Flatness"]));
     120      yield return new Result("Swap2.Steadiness", new DoubleValue(props["Steadiness"]));
     121    }
     122
    112123    public static IEnumerable<List<Tuple<Permutation, double>>> Run(IRandom random, QuadraticAssignmentProblem qap, IEnumerable<Permutation> permutations, bool bestImprovement = true) {
    113124      var iter = permutations.GetEnumerator();
    114125      if (!iter.MoveNext()) yield break;
    115126
     127      var min = qap.LowerBound.Value;
     128      var max = qap.AverageQuality.Value;
     129
    116130      var start = iter.Current;
    117131      while (iter.MoveNext()) {
     
    119133
    120134        var walk = (bestImprovement ? BestDirectedWalk(qap, start, end) : FirstDirectedWalk(random, qap, start, end)).ToList();
    121         var max = walk.Max(x => x.Item2);
    122         var min = walk.Min(x => x.Item2);
    123         if (max > min)
    124           yield return walk.Select(x => Tuple.Create(x.Item1, (x.Item2 - min) / (max - min))).ToList();
    125         else yield return walk.Select(x => Tuple.Create(x.Item1, 0.0)).ToList();
     135        yield return walk.Select(x => Tuple.Create(x.Item1, (x.Item2 - min) / (max - min))).ToList();
    126136        start = end;
    127137      } // end paths
    128138    }
    129139
    130     private IEnumerable<Tuple<string, double>> GetCharacteristics(List<List<Tuple<Permutation, double>>> f, List<List<Tuple<Permutation, double>>> f1, List<List<Tuple<Permutation, double>>> f2) {
     140    private static IEnumerable<Tuple<string, double>> GetCharacteristics(List<List<Tuple<Permutation, double>>> f, List<List<Tuple<Permutation, double>>> f1, List<List<Tuple<Permutation, double>>> f2) {
    131141      var sharpness = f2.Average(x => Area(x));
    132142      var bumpiness = 0.0;
Note: See TracChangeset for help on using the changeset viewer.