Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/04/18 21:06:14 (7 years ago)
Author:
abeham
Message:

#1614:

  • Scale directed walk fitness values
  • Performance improvements to RLD view
  • Changed CPLEX to use a single thread only
  • Set the context to null when algorithm is stopped
Location:
branches/1614_GeneralizedQAP/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/1614_GeneralizedQAP/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/DoubleMatrixCharacteristicCalculator.cs

    r14678 r15718  
    2020#endregion
    2121
     22using System;
     23using System.Linq;
    2224using HeuristicLab.Common;
    2325using HeuristicLab.Data;
    24 using System;
    25 using System.Linq;
    2626
    2727namespace HeuristicLab.Analysis.FitnessLandscape {
     
    3030      var avg = m.Average();
    3131      var stdDev = m.StandardDeviation();
     32      return stdDev / avg;
     33    }
     34
     35    public static double CoeffVariationNonZeroes(DoubleMatrix m) {
     36      var nonzeroes = m.Where(x => !x.IsAlmost(0));
     37      var avg = nonzeroes.Average();
     38      var stdDev = nonzeroes.StandardDeviation();
    3239      return stdDev / avg;
    3340    }
  • branches/1614_GeneralizedQAP/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/GQAP/GQAPCharacteristicCalculator.cs

    r15713 r15718  
    6666          yield return new Result(chara, new DoubleValue(inst.Capacities.Length / (double)inst.Demands.Length));
    6767        if (chara == "FlowDominance")
    68           yield return new Result(chara, new DoubleValue(DoubleMatrixCharacteristicCalculator.CoeffVariation(inst.Weights)));
     68          yield return new Result(chara, new DoubleValue(DoubleMatrixCharacteristicCalculator.CoeffVariationNonZeroes(inst.Weights)));
    6969        if (chara == "DistanceDominance")
    70           yield return new Result(chara, new DoubleValue(DoubleMatrixCharacteristicCalculator.CoeffVariation(inst.Distances)));
     70          yield return new Result(chara, new DoubleValue(DoubleMatrixCharacteristicCalculator.CoeffVariationNonZeroes(inst.Distances)));
    7171        if (chara == "FlowSparsity")
    7272          yield return new Result(chara, new DoubleValue(DoubleMatrixCharacteristicCalculator.Sparsity(inst.Weights)));
  • branches/1614_GeneralizedQAP/HeuristicLab.Analysis.FitnessLandscape/3.3/ProblemCharacteristicAnalysis/GQAP/GQAPDirectedWalk.cs

    r15713 r15718  
    134134    public static IEnumerable<List<Tuple<IntegerVector, double>>> Run(IRandom random, GQAP gqap, IEnumerable<IntegerVector> points, bool bestImprovement = true) {
    135135      var iter = points.GetEnumerator();
    136       if (!iter.MoveNext()) yield break;
     136      if (!iter.MoveNext()) return new List<Tuple<IntegerVector, double>>[0];
    137137
    138138      var start = iter.Current;
     139      var walks = new List<List<Tuple<IntegerVector, double>>>();
    139140      while (iter.MoveNext()) {
    140141        var end = iter.Current;
    141142
    142143        var walk = (bestImprovement ? BestDirectedWalk(gqap, start, end) : FirstDirectedWalk(random, gqap, start, end)).ToList();
    143         yield return walk.ToList();
     144        walks.Add(walk);
    144145        start = end;
    145146      } // end paths
     147
     148      var min = walks.SelectMany(x => x.Select(y => y.Item2)).Min();
     149      var max = walks.SelectMany(x => x.Select(y => y.Item2)).Max();
     150
     151      if (min == max) max = min + 1;
     152      return walks.Select(w => w.Select(x => Tuple.Create(x.Item1, (x.Item2 - min) / (max - min))).ToList());
    146153    }
    147154
Note: See TracChangeset for help on using the changeset viewer.