- Timestamp:
- 02/17/17 12:51:44 (7 years ago)
- 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 192 192 </ItemGroup> 193 193 <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> 194 199 <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj"> 195 200 <Project>{887425b4-4348-49ed-a457-b7d2c26ddbf9}</Project> -
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/MemPRContext.cs
r14666 r14678 25 25 using System.Runtime.CompilerServices; 26 26 using System.Threading; 27 using HeuristicLab.Algorithms.DataAnalysis;28 27 using HeuristicLab.Algorithms.MemPR.Interfaces; 29 using HeuristicLab.Analysis ;28 using HeuristicLab.Analysis.FitnessLandscape; 30 29 using HeuristicLab.Common; 31 30 using HeuristicLab.Core; … … 34 33 using HeuristicLab.Parameters; 35 34 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 36 using HeuristicLab.Problems.DataAnalysis;37 35 using HeuristicLab.Random; 38 36 using ExecutionContext = HeuristicLab.Core.ExecutionContext; … … 167 165 168 166 [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] 169 174 private IValueParameter<IRandom> random; 170 175 public IRandom Random { … … 221 226 public IEnumerable<Tuple<double, double>> AdaptivewalkingStat { 222 227 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 } 223 244 } 224 245 … … 245 266 byHillclimbing = cloner.Clone(original.byHillclimbing); 246 267 byAdaptivewalking = cloner.Clone(original.byAdaptivewalking); 268 relinkedPaths = cloner.Clone(original.relinkedPaths); 247 269 random = cloner.Clone(original.random); 248 270 breedingStat = original.breedingStat.Select(x => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4)).ToList(); … … 273 295 Parameters.Add(byHillclimbing = new ValueParameter<IntValue>("ByHillclimbing", new IntValue(0))); 274 296 Parameters.Add(byAdaptivewalking = new ValueParameter<IntValue>("ByAdaptivewalking", new IntValue(0))); 297 Parameters.Add(relinkedPaths = new ValueParameter<DirectedPath<TSolution>>("RelinkedPaths", new DirectedPath<TSolution>())); 275 298 Parameters.Add(random = new ValueParameter<IRandom>("Random", new MersenneTwister())); 276 299 -
branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3/Permutation/PermutationMemPR.cs
r14563 r14678 534 534 var evaluations = 0; 535 535 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 }; 537 542 best = double.NaN; 538 543 Encodings.PermutationEncoding.Permutation bestChild = null; … … 566 571 var idx2 = invChild[p2[idx1]]; 567 572 Swap(child, idx1, idx2); 573 thisPath.Add(Tuple.Create((Encodings.PermutationEncoding.Permutation)child.Clone(), (bestChange - Context.LowerBound) / (Context.AverageQuality - Context.LowerBound))); 568 574 invChild[child[idx1]] = idx1; 569 575 invChild[child[idx2]] = idx2; … … 582 588 } 583 589 Context.IncrementEvaluatedSolutions(evaluations); 590 if (thisPath.Count > 5) 591 Context.RelinkedPaths.AddPath(thisPath); 584 592 585 593 if (VALIDATE && bestChild != null && !bestChild.Validate()) throw new ArgumentException("Relinking produced invalid child");
Note: See TracChangeset
for help on using the changeset viewer.