Free cookie consent management tool by TermsFeed Policy Generator

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

#2457: worked on problem instance detection

Location:
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/HeuristicLab.Algorithms.MemPR-3.3.csproj

    r14666 r14678  
    192192  </ItemGroup>
    193193  <ItemGroup>
     194    <ProjectReference Include="..\..\HeuristicLab.Analysis.FitnessLandscape\3.3\HeuristicLab.Analysis.FitnessLandscape-3.3.csproj">
     195      <Project>{5fbdcd4a-3c2a-4ec6-83ce-34b29f43621a}</Project>
     196      <Name>HeuristicLab.Analysis.FitnessLandscape-3.3</Name>
     197      <Private>False</Private>
     198    </ProjectReference>
    194199    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
    195200      <Project>{887425b4-4348-49ed-a457-b7d2c26ddbf9}</Project>
  • branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/MemPRContext.cs

    r14666 r14678  
    2525using System.Runtime.CompilerServices;
    2626using System.Threading;
    27 using HeuristicLab.Algorithms.DataAnalysis;
    2827using HeuristicLab.Algorithms.MemPR.Interfaces;
    29 using HeuristicLab.Analysis;
     28using HeuristicLab.Analysis.FitnessLandscape;
    3029using HeuristicLab.Common;
    3130using HeuristicLab.Core;
     
    3433using HeuristicLab.Parameters;
    3534using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    36 using HeuristicLab.Problems.DataAnalysis;
    3735using HeuristicLab.Random;
    3836using ExecutionContext = HeuristicLab.Core.ExecutionContext;
     
    167165
    168166    [Storable]
     167    private IValueParameter<DirectedPath<TSolution>> relinkedPaths;
     168    public DirectedPath<TSolution> RelinkedPaths {
     169      get { return relinkedPaths.Value; }
     170      set { relinkedPaths.Value = value; }
     171    }
     172
     173    [Storable]
    169174    private IValueParameter<IRandom> random;
    170175    public IRandom Random {
     
    221226    public IEnumerable<Tuple<double, double>> AdaptivewalkingStat {
    222227      get { return adaptivewalkingStat; }
     228    }
     229
     230    public double AverageQuality {
     231      get {
     232        return Problem.Parameters.ContainsKey("AverageQuality")
     233          ? ((IValueParameter<DoubleValue>)Problem.Parameters["AverageQuality"]).Value.Value
     234          : double.NaN;
     235      }
     236    }
     237
     238    public double LowerBound {
     239      get {
     240        return Problem.Parameters.ContainsKey("LowerBound")
     241          ? ((IValueParameter<DoubleValue>)Problem.Parameters["LowerBound"]).Value.Value
     242          : double.NaN;
     243      }
    223244    }
    224245
     
    245266      byHillclimbing = cloner.Clone(original.byHillclimbing);
    246267      byAdaptivewalking = cloner.Clone(original.byAdaptivewalking);
     268      relinkedPaths = cloner.Clone(original.relinkedPaths);
    247269      random = cloner.Clone(original.random);
    248270      breedingStat = original.breedingStat.Select(x => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4)).ToList();
     
    273295      Parameters.Add(byHillclimbing = new ValueParameter<IntValue>("ByHillclimbing", new IntValue(0)));
    274296      Parameters.Add(byAdaptivewalking = new ValueParameter<IntValue>("ByAdaptivewalking", new IntValue(0)));
     297      Parameters.Add(relinkedPaths = new ValueParameter<DirectedPath<TSolution>>("RelinkedPaths", new DirectedPath<TSolution>()));
    275298      Parameters.Add(random = new ValueParameter<IRandom>("Random", new MersenneTwister()));
    276299
  • branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/Permutation/PermutationMemPR.cs

    r14563 r14678  
    534534      var evaluations = 0;
    535535      var child = (Encodings.PermutationEncoding.Permutation)p1.Clone();
    536 
     536      var childF = eval(child, token);
     537      evaluations++;
     538
     539      var thisPath = new List<Tuple<Encodings.PermutationEncoding.Permutation, double>>() {
     540        Tuple.Create((Encodings.PermutationEncoding.Permutation)child.Clone(), (childF - Context.LowerBound) / (Context.AverageQuality - Context.LowerBound))
     541      };
    537542      best = double.NaN;
    538543      Encodings.PermutationEncoding.Permutation bestChild = null;
     
    566571          var idx2 = invChild[p2[idx1]];
    567572          Swap(child, idx1, idx2);
     573          thisPath.Add(Tuple.Create((Encodings.PermutationEncoding.Permutation)child.Clone(), (bestChange - Context.LowerBound) / (Context.AverageQuality - Context.LowerBound)));
    568574          invChild[child[idx1]] = idx1;
    569575          invChild[child[idx2]] = idx2;
     
    582588      }
    583589      Context.IncrementEvaluatedSolutions(evaluations);
     590      if (thisPath.Count > 5)
     591        Context.RelinkedPaths.AddPath(thisPath);
    584592
    585593      if (VALIDATE && bestChild != null && !bestChild.Validate()) throw new ArgumentException("Relinking produced invalid child");
Note: See TracChangeset for help on using the changeset viewer.