Free cookie consent management tool by TermsFeed Policy Generator

# Changeset 14471

Ignore:
Timestamp:
12/09/16 15:56:22 (8 years ago)
Message:
• Updated GraphColoringProblem and Problems.Instances
• Added new fitness function from literature
Location:
branches/MemPRAlgorithm
Files:
7 edited
4 copied

Unmodified
Removed
• ## branches/MemPRAlgorithm/HeuristicLab 3.3.sln

 r14466 {E0B45023-CB84-48A1-A1B7-8295B64B7BAD} = {E0B45023-CB84-48A1-A1B7-8295B64B7BAD} {C633FB23-BAE6-448E-BF5D-E1F9A839B5ED} = {C633FB23-BAE6-448E-BF5D-E1F9A839B5ED} {9943FF23-8619-459C-B84A-E7FBDCBA04E6} = {9943FF23-8619-459C-B84A-E7FBDCBA04E6} {CDA28124-ACD0-4231-8EB0-C510B361F84E} = {CDA28124-ACD0-4231-8EB0-C510B361F84E} {14AB8D24-25BC-400C-A846-4627AA945192} = {14AB8D24-25BC-400C-A846-4627AA945192} {BBF2CCC8-4D87-4297-8E18-8241FF93F966} = {BBF2CCC8-4D87-4297-8E18-8241FF93F966} {59F354CB-FE13-4253-AED2-AD86372BEC27} = {59F354CB-FE13-4253-AED2-AD86372BEC27} {4B76E2CB-A990-4959-B080-1D81D418D325} = {4B76E2CB-A990-4959-B080-1D81D418D325} {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372} = {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372} {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086} = {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086} EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.GraphColoring-3.3", "HeuristicLab.Problems.GraphColoring\3.3\HeuristicLab.Problems.GraphColoring-3.3.csproj", "{4B76E2CB-A990-4959-B080-1D81D418D325}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.DIMACS-3.3", "HeuristicLab.Problems.Instances.DIMACS\3.3\HeuristicLab.Problems.Instances.DIMACS-3.3.csproj", "{9943FF23-8619-459C-B84A-E7FBDCBA04E6}" EndProject Global {4B76E2CB-A990-4959-B080-1D81D418D325}.Release|x86.ActiveCfg = Release|Any CPU {4B76E2CB-A990-4959-B080-1D81D418D325}.Release|x86.Build.0 = Release|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|Any CPU.Build.0 = Debug|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|x64.ActiveCfg = Debug|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|x64.Build.0 = Debug|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|x86.ActiveCfg = Debug|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|x86.Build.0 = Debug|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|Any CPU.Build.0 = Release|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|x64.ActiveCfg = Release|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|x64.Build.0 = Release|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|x86.ActiveCfg = Release|Any CPU {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution

 r14466 protected override bool Eq(ISingleObjectiveSolutionScope a, ISingleObjectiveSolutionScope b) { return a.Solution.SequenceEqual(b.Solution); var s1 = a.Solution; var s2 = b.Solution; if (s1.Length != s2.Length) return false; for (var i = 0; i < s1.Length; i++) if (s1[i] != s2[i]) return false; return true; } protected override double Dist(ISingleObjectiveSolutionScope a, ISingleObjectiveSolutionScope b) { if (a.Solution.Length != b.Solution.Length) throw new ArgumentException("Comparing encodings of unequal length"); var dist = 0; for (var i = 0; i < a.Solution.Length; i++) { if (a.Solution[i] != b.Solution[i]) dist++; } return dist / (double)a.Solution.Length; return HammingSimilarityCalculator.CalculateSimilarity(a.Solution, b.Solution); } protected override int TabuWalk(ISingleObjectiveSolutionScope scope, int maxEvals, CancellationToken token, ISolutionSubspace subspace = null) { return 0; /*Func eval = new EvaluationWrapper(Context.Problem, scope).Evaluate; var quality = scope.Fitness; var lle = scope.Solution; var random = Context.Random; var evaluations = 0; var maximization = Context.Problem.Maximization; if (double.IsNaN(quality)) { quality = eval(lle, random); evaluations++; } Encodings.LinearLinkageEncoding.LinearLinkage bestOfTheWalk = null; double bestOfTheWalkF = double.NaN; var current = (Encodings.LinearLinkageEncoding.LinearLinkage)lle.Clone(); var currentF = quality; var overallImprovement = false; var tabu = new double[current.Length, current.Length]; for (var i = 0; i < current.Length; i++) { for (var j = i; j < current.Length; j++) { tabu[i, j] = tabu[j, i] = double.MaxValue; } tabu[i, current[i]] = currentF; } var steps = 0; var stepsUntilBestOfWalk = 0; for (var iter = 0; iter < int.MaxValue; iter++) { var allTabu = true; var bestOfTheRestF = double.NaN; object bestOfTheRest = null; var improved = false; foreach () { if (subspace != null && !(subspace[swap.Index1, 0] && subspace[swap.Index2, 0])) continue; var q = eval(current, random); evaluations++; if (FitnessComparer.IsBetter(maximization, q, quality)) { overallImprovement = true; quality = q; for (var i = 0; i < current.Length; i++) lle[i] = current[i]; } // check if it would not be an improvement to swap these into their positions var isTabu = !FitnessComparer.IsBetter(maximization, q, tabu[swap.Index1, current[swap.Index1]]) && !FitnessComparer.IsBetter(maximization, q, tabu[swap.Index2, current[swap.Index2]]); if (!isTabu) allTabu = false; if (FitnessComparer.IsBetter(maximization, q, currentF) && !isTabu) { if (FitnessComparer.IsBetter(maximization, q, bestOfTheWalkF)) { bestOfTheWalk = (Encodings.LinearLinkageEncoding.LinearLinkage)current.Clone(); bestOfTheWalkF = q; stepsUntilBestOfWalk = steps; } steps++; improved = true; // perform the move currentF = q; // mark that to move them to their previous position requires to make an improvement tabu[swap.Index1, current[swap.Index2]] = maximization ? Math.Max(q, tabu[swap.Index1, current[swap.Index2]]) : Math.Min(q, tabu[swap.Index1, current[swap.Index2]]); tabu[swap.Index2, current[swap.Index1]] = maximization ? Math.Max(q, tabu[swap.Index2, current[swap.Index1]]) : Math.Min(q, tabu[swap.Index2, current[swap.Index1]]); } else { // undo the move if (!isTabu && FitnessComparer.IsBetter(maximization, q, bestOfTheRestF)) { bestOfTheRest = swap; bestOfTheRestF = q; } current[swap.Index2] = current[swap.Index1]; current[swap.Index1] = h; } if (evaluations >= maxEvals) break; } if (!allTabu && !improved && bestOfTheRest != null) { tabu[bestOfTheRest.Index1, current[bestOfTheRest.Index1]] = maximization ? Math.Max(currentF, tabu[bestOfTheRest.Index1, current[bestOfTheRest.Index1]]) : Math.Min(currentF, tabu[bestOfTheRest.Index1, current[bestOfTheRest.Index1]]); tabu[bestOfTheRest.Index2, current[bestOfTheRest.Index2]] = maximization ? Math.Max(currentF, tabu[bestOfTheRest.Index2, current[bestOfTheRest.Index2]]) : Math.Min(currentF, tabu[bestOfTheRest.Index2, current[bestOfTheRest.Index2]]); var h = current[bestOfTheRest.Index1]; current[bestOfTheRest.Index1] = current[bestOfTheRest.Index2]; current[bestOfTheRest.Index2] = h; currentF = bestOfTheRestF; steps++; } else if (allTabu) break; if (evaluations >= maxEvals) break; } Context.IncrementEvaluatedSolutions(evaluations); if (!overallImprovement && bestOfTheWalk != null) { quality = bestOfTheWalkF; for (var i = 0; i < current.Length; i++) lle[i] = bestOfTheWalk[i]; } return stepsUntilBestOfWalk;*/ }

 r12650

• ## branches/MemPRAlgorithm/HeuristicLab.Problems.GraphColoring/3.3/HeuristicLab.Problems.GraphColoring-3.3.csproj

 r14466 {887425B4-4348-49ED-A457-B7D2C26DDBF9} HeuristicLab.Analysis-3.3 False {958b43bc-cc5c-4fa2-8628-2b3b01d890b6} {23da7ff4-d5b8-41b6-aa96-f0561d24f3ee} HeuristicLab.Operators-3.3 False {25087811-f74c-4128-bc86-8324271da13e} HeuristicLab.Optimization.Operators-3.3 False
• ## branches/MemPRAlgorithm/HeuristicLab.Problems.GraphColoring/3.3/Plugin.cs.frame

 r14466 [Plugin("HeuristicLab.Problems.GraphColoring", "3.3.14.$WCREV$")] [PluginFile("HeuristicLab.Problems.GraphColoring-3.3.dll", PluginFileType.Assembly)] [PluginDependency("HeuristicLab.Analysis", "3.3")] [PluginDependency("HeuristicLab.Collections", "3.3")] [PluginDependency("HeuristicLab.Common", "3.3")] [PluginDependency("HeuristicLab.Operators", "3.3")] [PluginDependency("HeuristicLab.Optimization", "3.3")] [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")] [PluginDependency("HeuristicLab.Parameters", "3.3")] [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] [PluginDependency("HeuristicLab.Persistence", "3.3")] public class HeuristicLabProblemsGraphColoringPlugin : PluginBase {

 r14429 #endregion namespace HeuristicLab.Problems.Instances.QAPLIB { internal class QAPLIBDataDescriptor : IDataDescriptor { namespace HeuristicLab.Problems.Instances.DIMACS { internal class GcolDataDescriptor : IDataDescriptor { public string Name { get; internal set; } public string Description { get; internal set; } internal string InstanceIdentifier { get; set; } internal string SolutionIdentifier { get; set; } internal QAPLIBDataDescriptor(string name, string description, string instanceIdentifier, string solutionIdentifier) { internal GcolDataDescriptor(string name, string description, string instanceIdentifier) { this.Name = name; this.Description = description; this.InstanceIdentifier = instanceIdentifier; this.SolutionIdentifier = solutionIdentifier; } }