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
Files:
5 added
6 edited
1 moved

Legend:

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

    r13583 r14678  
    212212      private string asString;
    213213      public override string ToString() {
    214         return asString ?? (asString = string.Join("", slopes.Select(s => (s == Slope.Down ? "v" : (s == Slope.Up ? "^" : "-")))));
     214        return asString ?? (asString = string.Join("", slopes.Select(s => (s == Slope.Down ? "\\" : (s == Slope.Up ? "/" : "-")))));
    215215      }
    216216    }
    217217
    218218    private static IEnumerable<Slope> Slopes(double eps, IEnumerable<double> differences) {
    219       return differences.Select(d => (d > eps ? Slope.Up : (d < -eps ? Slope.Down : 0)));
     219      return differences.Select(d => (d > eps ? Slope.Up : (d < -eps ? Slope.Down : Slope.Flat)));
    220220    }
    221221
  • branches/PerformanceComparison/HeuristicLab.Analysis.FitnessLandscape/3.3/HeuristicLab.Analysis.FitnessLandscape-3.3.csproj

    r13668 r14678  
    152152      <Private>False</Private>
    153153    </Reference>
     154    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     155      <SpecificVersion>False</SpecificVersion>
     156      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
     157      <Private>False</Private>
     158    </Reference>
     159    <Reference Include="HeuristicLab.Problems.QuadraticAssignment-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     160      <SpecificVersion>False</SpecificVersion>
     161      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.QuadraticAssignment-3.3.dll</HintPath>
     162      <Private>False</Private>
     163    </Reference>
    154164    <Reference Include="HeuristicLab.Random-3.3">
    155165      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
     
    196206    <Compile Include="CharacteristicCalculator\UpDownWalkCalculator.cs" />
    197207    <Compile Include="CharacteristicCalculator\RandomWalkCalculator.cs" />
     208    <Compile Include="ProblemCharacteristicAnalysis\CharacteristicCalculator.cs" />
     209    <Compile Include="ProblemCharacteristicAnalysis\DoubleMatrixCharacteristicCalculator.cs" />
     210    <Compile Include="ProblemCharacteristicAnalysis\QAP\QAPCharacteristicCalculator.cs" />
     211    <Compile Include="ProblemCharacteristicAnalysis\QAP\QAPDirectedWalk.cs" />
     212    <Compile Include="ProblemInstanceAnalysis\DirectedPath.cs" />
     213    <Compile Include="ProblemInstanceAnalysis\ProblemInstanceAnalyzer.cs" />
     214    <Compile Include="ProblemInstanceAnalysis\PRProblemInstanceAnalyzer.cs" />
     215    <Compile Include="ProblemInstanceAnalysis\QAPPRProblemInstanceAnalyzer.cs" />
    198216    <Compile Include="UpDownSelector.cs" />
    199217    <Compile Include="DistanceCalculators\RealVectorDistanceCalculator.cs" />
  • 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.