Changeset 14471 for branches/MemPRAlgorithm
- Timestamp:
- 12/09/16 15:56:22 (8 years ago)
- Location:
- branches/MemPRAlgorithm
- Files:
-
- 13 added
- 7 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/MemPRAlgorithm/HeuristicLab 3.3.sln
r14466 r14471 35 35 {E0B45023-CB84-48A1-A1B7-8295B64B7BAD} = {E0B45023-CB84-48A1-A1B7-8295B64B7BAD} 36 36 {C633FB23-BAE6-448E-BF5D-E1F9A839B5ED} = {C633FB23-BAE6-448E-BF5D-E1F9A839B5ED} 37 {9943FF23-8619-459C-B84A-E7FBDCBA04E6} = {9943FF23-8619-459C-B84A-E7FBDCBA04E6} 37 38 {CDA28124-ACD0-4231-8EB0-C510B361F84E} = {CDA28124-ACD0-4231-8EB0-C510B361F84E} 38 39 {14AB8D24-25BC-400C-A846-4627AA945192} = {14AB8D24-25BC-400C-A846-4627AA945192} … … 132 133 {BBF2CCC8-4D87-4297-8E18-8241FF93F966} = {BBF2CCC8-4D87-4297-8E18-8241FF93F966} 133 134 {59F354CB-FE13-4253-AED2-AD86372BEC27} = {59F354CB-FE13-4253-AED2-AD86372BEC27} 135 {4B76E2CB-A990-4959-B080-1D81D418D325} = {4B76E2CB-A990-4959-B080-1D81D418D325} 134 136 {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372} = {D1EFA4CC-909F-41D5-9C1F-C3AF1957A372} 135 137 {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086} = {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086} … … 454 456 EndProject 455 457 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}" 458 EndProject 459 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}" 456 460 EndProject 457 461 Global … … 2217 2221 {4B76E2CB-A990-4959-B080-1D81D418D325}.Release|x86.ActiveCfg = Release|Any CPU 2218 2222 {4B76E2CB-A990-4959-B080-1D81D418D325}.Release|x86.Build.0 = Release|Any CPU 2223 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 2224 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|Any CPU.Build.0 = Debug|Any CPU 2225 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|x64.ActiveCfg = Debug|Any CPU 2226 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|x64.Build.0 = Debug|Any CPU 2227 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|x86.ActiveCfg = Debug|Any CPU 2228 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Debug|x86.Build.0 = Debug|Any CPU 2229 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|Any CPU.ActiveCfg = Release|Any CPU 2230 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|Any CPU.Build.0 = Release|Any CPU 2231 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|x64.ActiveCfg = Release|Any CPU 2232 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|x64.Build.0 = Release|Any CPU 2233 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|x86.ActiveCfg = Release|Any CPU 2234 {9943FF23-8619-459C-B84A-E7FBDCBA04E6}.Release|x86.Build.0 = Release|Any CPU 2219 2235 EndGlobalSection 2220 2236 GlobalSection(SolutionProperties) = preSolution -
branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/LinearLinkage/LinearLinkageMemPR.cs
r14466 r14471 58 58 59 59 protected override bool Eq(ISingleObjectiveSolutionScope<Encodings.LinearLinkageEncoding.LinearLinkage> a, ISingleObjectiveSolutionScope<Encodings.LinearLinkageEncoding.LinearLinkage> b) { 60 return a.Solution.SequenceEqual(b.Solution); 60 var s1 = a.Solution; 61 var s2 = b.Solution; 62 if (s1.Length != s2.Length) return false; 63 for (var i = 0; i < s1.Length; i++) 64 if (s1[i] != s2[i]) return false; 65 return true; 61 66 } 62 67 63 68 protected override double Dist(ISingleObjectiveSolutionScope<Encodings.LinearLinkageEncoding.LinearLinkage> a, ISingleObjectiveSolutionScope<Encodings.LinearLinkageEncoding.LinearLinkage> b) { 64 if (a.Solution.Length != b.Solution.Length) throw new ArgumentException("Comparing encodings of unequal length"); 65 var dist = 0; 66 for (var i = 0; i < a.Solution.Length; i++) { 67 if (a.Solution[i] != b.Solution[i]) dist++; 68 } 69 return dist / (double)a.Solution.Length; 69 return HammingSimilarityCalculator.CalculateSimilarity(a.Solution, b.Solution); 70 70 } 71 71 … … 94 94 protected override int TabuWalk(ISingleObjectiveSolutionScope<Encodings.LinearLinkageEncoding.LinearLinkage> scope, int maxEvals, CancellationToken token, ISolutionSubspace<Encodings.LinearLinkageEncoding.LinearLinkage> subspace = null) { 95 95 return 0; 96 /*Func<Encodings.LinearLinkageEncoding.LinearLinkage, IRandom, double> eval = new EvaluationWrapper<Encodings.LinearLinkageEncoding.LinearLinkage>(Context.Problem, scope).Evaluate; 97 var quality = scope.Fitness; 98 var lle = scope.Solution; 99 var random = Context.Random; 100 var evaluations = 0; 101 var maximization = Context.Problem.Maximization; 102 if (double.IsNaN(quality)) { 103 quality = eval(lle, random); 104 evaluations++; 105 } 106 Encodings.LinearLinkageEncoding.LinearLinkage bestOfTheWalk = null; 107 double bestOfTheWalkF = double.NaN; 108 var current = (Encodings.LinearLinkageEncoding.LinearLinkage)lle.Clone(); 109 var currentF = quality; 110 var overallImprovement = false; 111 var tabu = new double[current.Length, current.Length]; 112 for (var i = 0; i < current.Length; i++) { 113 for (var j = i; j < current.Length; j++) { 114 tabu[i, j] = tabu[j, i] = double.MaxValue; 115 } 116 tabu[i, current[i]] = currentF; 117 } 118 119 var steps = 0; 120 var stepsUntilBestOfWalk = 0; 121 for (var iter = 0; iter < int.MaxValue; iter++) { 122 var allTabu = true; 123 var bestOfTheRestF = double.NaN; 124 object bestOfTheRest = null; 125 var improved = false; 126 foreach () { 127 if (subspace != null && !(subspace[swap.Index1, 0] && subspace[swap.Index2, 0])) 128 continue; 129 130 131 var q = eval(current, random); 132 evaluations++; 133 if (FitnessComparer.IsBetter(maximization, q, quality)) { 134 overallImprovement = true; 135 quality = q; 136 for (var i = 0; i < current.Length; i++) lle[i] = current[i]; 137 } 138 // check if it would not be an improvement to swap these into their positions 139 var isTabu = !FitnessComparer.IsBetter(maximization, q, tabu[swap.Index1, current[swap.Index1]]) 140 && !FitnessComparer.IsBetter(maximization, q, tabu[swap.Index2, current[swap.Index2]]); 141 if (!isTabu) allTabu = false; 142 if (FitnessComparer.IsBetter(maximization, q, currentF) && !isTabu) { 143 if (FitnessComparer.IsBetter(maximization, q, bestOfTheWalkF)) { 144 bestOfTheWalk = (Encodings.LinearLinkageEncoding.LinearLinkage)current.Clone(); 145 bestOfTheWalkF = q; 146 stepsUntilBestOfWalk = steps; 147 } 148 steps++; 149 improved = true; 150 // perform the move 151 currentF = q; 152 // mark that to move them to their previous position requires to make an improvement 153 tabu[swap.Index1, current[swap.Index2]] = maximization ? Math.Max(q, tabu[swap.Index1, current[swap.Index2]]) 154 : Math.Min(q, tabu[swap.Index1, current[swap.Index2]]); 155 tabu[swap.Index2, current[swap.Index1]] = maximization ? Math.Max(q, tabu[swap.Index2, current[swap.Index1]]) 156 : Math.Min(q, tabu[swap.Index2, current[swap.Index1]]); 157 } else { // undo the move 158 if (!isTabu && FitnessComparer.IsBetter(maximization, q, bestOfTheRestF)) { 159 bestOfTheRest = swap; 160 bestOfTheRestF = q; 161 } 162 current[swap.Index2] = current[swap.Index1]; 163 current[swap.Index1] = h; 164 } 165 if (evaluations >= maxEvals) break; 166 } 167 if (!allTabu && !improved && bestOfTheRest != null) { 168 tabu[bestOfTheRest.Index1, current[bestOfTheRest.Index1]] = maximization ? Math.Max(currentF, tabu[bestOfTheRest.Index1, current[bestOfTheRest.Index1]]) 169 : Math.Min(currentF, tabu[bestOfTheRest.Index1, current[bestOfTheRest.Index1]]); 170 tabu[bestOfTheRest.Index2, current[bestOfTheRest.Index2]] = maximization ? Math.Max(currentF, tabu[bestOfTheRest.Index2, current[bestOfTheRest.Index2]]) 171 : Math.Min(currentF, tabu[bestOfTheRest.Index2, current[bestOfTheRest.Index2]]); 172 173 var h = current[bestOfTheRest.Index1]; 174 current[bestOfTheRest.Index1] = current[bestOfTheRest.Index2]; 175 current[bestOfTheRest.Index2] = h; 176 177 currentF = bestOfTheRestF; 178 steps++; 179 } else if (allTabu) break; 180 if (evaluations >= maxEvals) break; 181 } 182 Context.IncrementEvaluatedSolutions(evaluations); 183 if (!overallImprovement && bestOfTheWalk != null) { 184 quality = bestOfTheWalkF; 185 for (var i = 0; i < current.Length; i++) lle[i] = bestOfTheWalk[i]; 186 } 187 return stepsUntilBestOfWalk;*/ 96 188 } 97 189 -
branches/MemPRAlgorithm/HeuristicLab.Encodings.LinearLinkageEncoding/3.3/HeuristicLab.Encodings.LinearLinkageEncoding-3.3.csproj
r12650 r14471 182 182 <Compile Include="Moves\Swap\Swap2MoveMaker.cs" /> 183 183 <Compile Include="ShakingOperators\LLEShakingOperator.cs" /> 184 <Compile Include="SimilarityCalculators\HammingSimilarityCalculator.cs" /> 184 185 <None Include="HeuristicLab.snk" /> 185 186 <None Include="Plugin.cs.frame" /> -
branches/MemPRAlgorithm/HeuristicLab.Problems.GraphColoring/3.3/GraphColoringProblem.cs
r14466 r14471 21 21 22 22 using System; 23 using System.Linq; 24 using HeuristicLab.Analysis; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Core; … … 26 28 using HeuristicLab.Encodings.LinearLinkageEncoding; 27 29 using HeuristicLab.Optimization; 30 using HeuristicLab.Optimization.Operators; 28 31 using HeuristicLab.Parameters; 29 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 33 using HeuristicLab.Problems.Instances; 30 34 31 35 namespace HeuristicLab.Problems.GraphColoring { 36 public enum FitnessFunction { Prioritized, Penalized } 32 37 [Item("Graph Coloring Problem (GCP)", "Attempts to find a coloring using a minimal number of colors that doesn't produce a conflict.")] 38 [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 135)] 33 39 [StorableClass] 34 public sealed class GraphColoringProblem : SingleObjectiveBasicProblem<LinearLinkageEncoding> {40 public sealed class GraphColoringProblem : SingleObjectiveBasicProblem<LinearLinkageEncoding>, IProblemInstanceConsumer<GCPData> { 35 41 36 42 public override bool Maximization { … … 38 44 } 39 45 40 private IValueParameter<BoolMatrix> adjacencyMatrixParameter; 41 public IValueParameter<BoolMatrix> AdjacencyMatrixParameter { 42 get { return adjacencyMatrixParameter; } 46 [Storable] 47 private IValueParameter<IntMatrix> adjacencyListParameter; 48 public IValueParameter<IntMatrix> AdjacencyListParameter { 49 get { return adjacencyListParameter; } 50 } 51 [Storable] 52 private IValueParameter<EnumValue<FitnessFunction>> fitnessFunctionParameter; 53 public IValueParameter<EnumValue<FitnessFunction>> FitnessFunctionParameter { 54 get { return fitnessFunctionParameter; } 43 55 } 44 56 … … 47 59 private GraphColoringProblem(GraphColoringProblem original, Cloner cloner) 48 60 : base(original, cloner) { 49 adjacencyMatrixParameter = cloner.Clone(original.adjacencyMatrixParameter); 61 adjacencyListParameter = cloner.Clone(original.adjacencyListParameter); 62 fitnessFunctionParameter = cloner.Clone(original.fitnessFunctionParameter); 63 RegisterEventHandlers(); 50 64 } 51 65 public GraphColoringProblem() { 52 Encoding = new LinearLinkageEncoding("lle") { Length = 32 }; 53 Parameters.Add(adjacencyMatrixParameter = new ValueParameter<BoolMatrix>("AdjacencyMatrix", "The matrix that describes whether two nodes are linked.")); 54 55 var rand = new System.Random(0); 56 var matrix = new BoolMatrix(32, 32); 57 for (var i = 0; i < 31; i++) { 58 for (var j = i + 1; j < 32; j++) { 59 matrix[i, j] = rand.NextDouble() < 0.2; 60 matrix[j, i] = matrix[i, j]; 61 } 66 Encoding = new LinearLinkageEncoding("lle"); 67 Parameters.Add(adjacencyListParameter = new ValueParameter<IntMatrix>("Adjacency List", "The adjacency list that describes the (symmetric) edges in the graph with nodes from 0 to N-1.")); 68 Parameters.Add(fitnessFunctionParameter = new ValueParameter<EnumValue<FitnessFunction>>("Fitness Function", "The function to use for evaluating the quality of a solution.", new EnumValue<FitnessFunction>(FitnessFunction.Prioritized))); 69 70 var imat = new IntMatrix(defaultInstance.Length, 2); 71 for (var i = 0; i < defaultInstance.Length; i++) { 72 imat[i, 0] = defaultInstance[i].Item1 - 1; 73 imat[i, 1] = defaultInstance[i].Item2 - 1; 62 74 } 63 AdjacencyMatrixParameter.Value = matrix; 75 Encoding.Length = defaultInstanceNodes; 76 AdjacencyListParameter.Value = imat; 77 BestKnownQuality = 7; 78 79 InitializeOperators(); 80 RegisterEventHandlers(); 64 81 } 65 82 … … 68 85 } 69 86 87 protected override void OnEncodingChanged() { 88 base.OnEncodingChanged(); 89 90 Parameterize(); 91 } 92 93 [StorableHook(HookType.AfterDeserialization)] 94 private void AfterDeserialization() { 95 RegisterEventHandlers(); 96 } 97 98 private void RegisterEventHandlers() { 99 fitnessFunctionParameter.ValueChanged += FitnessFunctionParameterOnValueChanged; 100 fitnessFunctionParameter.Value.ValueChanged += FitnessFunctionOnValueChanged; 101 } 102 103 private void FitnessFunctionParameterOnValueChanged(object sender, EventArgs eventArgs) { 104 fitnessFunctionParameter.Value.ValueChanged += FitnessFunctionOnValueChanged; 105 OnReset(); 106 } 107 108 private void FitnessFunctionOnValueChanged(object sender, EventArgs eventArgs) { 109 BestKnownQualityParameter.Value = null; 110 OnReset(); 111 } 112 70 113 public override double Evaluate(Individual individual, IRandom random) { 71 var matrix = adjacencyMatrixParameter.Value; 72 var lle = individual.LinearLinkage("lle"); 73 var groups = lle.GetGroups(); 114 var fitFun = FitnessFunctionParameter.Value.Value; 115 var adjList = adjacencyListParameter.Value; 116 var lle = individual.LinearLinkage(Encoding.Name).ToLLEe(); // LLE-e encoding uses the highest indexed member as group number 117 118 switch (fitFun) { 119 case FitnessFunction.Prioritized: { 120 var conflicts = 0; 121 var colors = lle.Distinct().Count(); 122 for (var r = 0; r < adjList.Rows; r++) { 123 if (lle[adjList[r, 0]] == lle[adjList[r, 1]]) conflicts++; // both nodes are adjacent and have the same color (are in the same group) 124 } 125 // number of conflicts is the integer part of the quality 126 // number of colors constitutes the fractional part 127 // the number of fractional digits is defined by the maximum number of possible colors (each node its own color) 128 var mag = Math.Pow(10, -(int)Math.Ceiling(Math.Log10(lle.Length))); 129 // the value is e.g. 4.03 for 4 conflicts with 3 colors (and less than 100 nodes) 130 return conflicts + colors * mag; 131 } 132 case FitnessFunction.Penalized: { 133 // Fitness function from 134 // David S. Johnson, Cecilia R. Aragon, Lyle A. McGeoch, and Catherine Schevon. 1991. 135 // Optimization by simulated annealing: An experimental evaluation; part II, graph coloring and number partitioning. 136 // Operations Research 39(3), pp. 378–406. 137 // All local optima of this function correspond to legal colorings. 138 var colors = lle.GroupBy(x => x).ToDictionary(x => x.Key, x => new EvaluationHelper() { ColorCount = x.Count() }); 139 for (var r = 0; r < adjList.Rows; r++) { 140 var color1 = lle[adjList[r, 0]]; 141 var color2 = lle[adjList[r, 1]]; 142 if (color1 == color2) colors[color1].ConflictCount++; 143 } 144 return 2 * colors.Sum(x => x.Value.ColorCount * x.Value.ConflictCount) - colors.Sum(x => x.Value.ColorCount * x.Value.ColorCount); 145 } 146 default: throw new InvalidOperationException(string.Format("Unknown fitness function {0}.", fitFun)); 147 } 148 } 149 150 private class EvaluationHelper { 151 public int ColorCount { get; set; } 152 public int ConflictCount { get; set; } 153 } 154 155 public override void Analyze(Individual[] individuals, double[] qualities, ResultCollection results, IRandom random) { 156 var orderedIndividuals = individuals.Zip(qualities, (i, q) => new { Individual = i, Quality = q }).OrderBy(z => z.Quality); 157 var best = Maximization ? orderedIndividuals.Last().Individual.LinearLinkage(Encoding.Name) : orderedIndividuals.First().Individual.LinearLinkage(Encoding.Name); 158 159 var adjList = AdjacencyListParameter.Value; 160 var lle = best.ToLLEe(); 74 161 var conflicts = 0; 75 var colors = 0; 76 foreach (var g in groups) { 77 colors++; 78 for (var i = 0; i < g.Count - 1; i++) { 79 for (var j = i + 1; j < g.Count; j++) { 80 if (matrix[g[i], g[j]]) conflicts++; // both nodes are adjacent and have the same color (are in the same group) 81 } 82 } 162 var colors = lle.Distinct().Count(); 163 for (var r = 0; r < adjList.Rows; r++) { 164 if (lle[adjList[r, 0]] == lle[adjList[r, 1]]) conflicts++; // both nodes are adjacent and have the same color (are in the same group) 83 165 } 84 166 85 var mag = Math.Pow(10, -(int)Math.Ceiling(Math.Log10(matrix.Rows))); 86 return conflicts + colors * mag; 87 } 167 IResult res; 168 if (!results.TryGetValue("Best Solution Colors", out res)) { 169 res = new Result("Best Solution Colors", new IntValue(colors)); 170 results.Add(res); 171 } else ((IntValue)res.Value).Value = colors; 172 if (!results.TryGetValue("Best Solution Conflicts", out res)) { 173 res = new Result("Best Solution Conflicts", new IntValue(conflicts)); 174 results.Add(res); 175 } else ((IntValue)res.Value).Value = conflicts; 176 } 177 178 public void Load(GCPData data) { 179 Encoding.Length = data.Nodes; 180 AdjacencyListParameter.Value = new IntMatrix(data.Adjacencies); 181 if (FitnessFunctionParameter.Value.Value == FitnessFunction.Prioritized && data.BestKnownColors.HasValue) { 182 var mag = Math.Pow(10, -(int)Math.Ceiling(Math.Log10(data.Nodes))); 183 // the value is e.g. 4.03 for 4 conflicts with 3 colors (and less than 100 nodes) 184 BestKnownQuality = data.BestKnownColors.Value * mag; 185 } else BestKnownQualityParameter.Value = null; 186 Name = data.Name; 187 Description = data.Description; 188 OnReset(); 189 } 190 191 private void InitializeOperators() { 192 Operators.Add(new HammingSimilarityCalculator()); 193 Operators.Add(new QualitySimilarityCalculator()); 194 Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>())); 195 196 Parameterize(); 197 } 198 199 private void Parameterize() { 200 foreach (var simCalc in Operators.OfType<ISolutionSimilarityCalculator>()) { 201 simCalc.SolutionVariableName = Encoding.Name; 202 simCalc.QualityVariableName = Evaluator.QualityParameter.ActualName; 203 } 204 } 205 206 #region Default Instance (myciel6.col) 207 private static readonly int defaultInstanceNodes = 95; 208 private static readonly Tuple<int, int>[] defaultInstance = { 209 Tuple.Create(1, 2), 210 Tuple.Create(1, 4), 211 Tuple.Create(1, 7), 212 Tuple.Create(1, 9), 213 Tuple.Create(1, 13), 214 Tuple.Create(1, 15), 215 Tuple.Create(1, 18), 216 Tuple.Create(1, 20), 217 Tuple.Create(1, 25), 218 Tuple.Create(1, 27), 219 Tuple.Create(1, 30), 220 Tuple.Create(1, 32), 221 Tuple.Create(1, 36), 222 Tuple.Create(1, 38), 223 Tuple.Create(1, 41), 224 Tuple.Create(1, 43), 225 Tuple.Create(1, 49), 226 Tuple.Create(1, 51), 227 Tuple.Create(1, 54), 228 Tuple.Create(1, 56), 229 Tuple.Create(1, 60), 230 Tuple.Create(1, 62), 231 Tuple.Create(1, 65), 232 Tuple.Create(1, 67), 233 Tuple.Create(1, 72), 234 Tuple.Create(1, 74), 235 Tuple.Create(1, 77), 236 Tuple.Create(1, 79), 237 Tuple.Create(1, 83), 238 Tuple.Create(1, 85), 239 Tuple.Create(1, 88), 240 Tuple.Create(1, 90), 241 Tuple.Create(2, 3), 242 Tuple.Create(2, 6), 243 Tuple.Create(2, 8), 244 Tuple.Create(2, 12), 245 Tuple.Create(2, 14), 246 Tuple.Create(2, 17), 247 Tuple.Create(2, 19), 248 Tuple.Create(2, 24), 249 Tuple.Create(2, 26), 250 Tuple.Create(2, 29), 251 Tuple.Create(2, 31), 252 Tuple.Create(2, 35), 253 Tuple.Create(2, 37), 254 Tuple.Create(2, 40), 255 Tuple.Create(2, 42), 256 Tuple.Create(2, 48), 257 Tuple.Create(2, 50), 258 Tuple.Create(2, 53), 259 Tuple.Create(2, 55), 260 Tuple.Create(2, 59), 261 Tuple.Create(2, 61), 262 Tuple.Create(2, 64), 263 Tuple.Create(2, 66), 264 Tuple.Create(2, 71), 265 Tuple.Create(2, 73), 266 Tuple.Create(2, 76), 267 Tuple.Create(2, 78), 268 Tuple.Create(2, 82), 269 Tuple.Create(2, 84), 270 Tuple.Create(2, 87), 271 Tuple.Create(2, 89), 272 Tuple.Create(3, 5), 273 Tuple.Create(3, 7), 274 Tuple.Create(3, 10), 275 Tuple.Create(3, 13), 276 Tuple.Create(3, 16), 277 Tuple.Create(3, 18), 278 Tuple.Create(3, 21), 279 Tuple.Create(3, 25), 280 Tuple.Create(3, 28), 281 Tuple.Create(3, 30), 282 Tuple.Create(3, 33), 283 Tuple.Create(3, 36), 284 Tuple.Create(3, 39), 285 Tuple.Create(3, 41), 286 Tuple.Create(3, 44), 287 Tuple.Create(3, 49), 288 Tuple.Create(3, 52), 289 Tuple.Create(3, 54), 290 Tuple.Create(3, 57), 291 Tuple.Create(3, 60), 292 Tuple.Create(3, 63), 293 Tuple.Create(3, 65), 294 Tuple.Create(3, 68), 295 Tuple.Create(3, 72), 296 Tuple.Create(3, 75), 297 Tuple.Create(3, 77), 298 Tuple.Create(3, 80), 299 Tuple.Create(3, 83), 300 Tuple.Create(3, 86), 301 Tuple.Create(3, 88), 302 Tuple.Create(3, 91), 303 Tuple.Create(4, 5), 304 Tuple.Create(4, 6), 305 Tuple.Create(4, 10), 306 Tuple.Create(4, 12), 307 Tuple.Create(4, 16), 308 Tuple.Create(4, 17), 309 Tuple.Create(4, 21), 310 Tuple.Create(4, 24), 311 Tuple.Create(4, 28), 312 Tuple.Create(4, 29), 313 Tuple.Create(4, 33), 314 Tuple.Create(4, 35), 315 Tuple.Create(4, 39), 316 Tuple.Create(4, 40), 317 Tuple.Create(4, 44), 318 Tuple.Create(4, 48), 319 Tuple.Create(4, 52), 320 Tuple.Create(4, 53), 321 Tuple.Create(4, 57), 322 Tuple.Create(4, 59), 323 Tuple.Create(4, 63), 324 Tuple.Create(4, 64), 325 Tuple.Create(4, 68), 326 Tuple.Create(4, 71), 327 Tuple.Create(4, 75), 328 Tuple.Create(4, 76), 329 Tuple.Create(4, 80), 330 Tuple.Create(4, 82), 331 Tuple.Create(4, 86), 332 Tuple.Create(4, 87), 333 Tuple.Create(4, 91), 334 Tuple.Create(5, 8), 335 Tuple.Create(5, 9), 336 Tuple.Create(5, 14), 337 Tuple.Create(5, 15), 338 Tuple.Create(5, 19), 339 Tuple.Create(5, 20), 340 Tuple.Create(5, 26), 341 Tuple.Create(5, 27), 342 Tuple.Create(5, 31), 343 Tuple.Create(5, 32), 344 Tuple.Create(5, 37), 345 Tuple.Create(5, 38), 346 Tuple.Create(5, 42), 347 Tuple.Create(5, 43), 348 Tuple.Create(5, 50), 349 Tuple.Create(5, 51), 350 Tuple.Create(5, 55), 351 Tuple.Create(5, 56), 352 Tuple.Create(5, 61), 353 Tuple.Create(5, 62), 354 Tuple.Create(5, 66), 355 Tuple.Create(5, 67), 356 Tuple.Create(5, 73), 357 Tuple.Create(5, 74), 358 Tuple.Create(5, 78), 359 Tuple.Create(5, 79), 360 Tuple.Create(5, 84), 361 Tuple.Create(5, 85), 362 Tuple.Create(5, 89), 363 Tuple.Create(5, 90), 364 Tuple.Create(6, 11), 365 Tuple.Create(6, 13), 366 Tuple.Create(6, 15), 367 Tuple.Create(6, 22), 368 Tuple.Create(6, 25), 369 Tuple.Create(6, 27), 370 Tuple.Create(6, 34), 371 Tuple.Create(6, 36), 372 Tuple.Create(6, 38), 373 Tuple.Create(6, 45), 374 Tuple.Create(6, 49), 375 Tuple.Create(6, 51), 376 Tuple.Create(6, 58), 377 Tuple.Create(6, 60), 378 Tuple.Create(6, 62), 379 Tuple.Create(6, 69), 380 Tuple.Create(6, 72), 381 Tuple.Create(6, 74), 382 Tuple.Create(6, 81), 383 Tuple.Create(6, 83), 384 Tuple.Create(6, 85), 385 Tuple.Create(6, 92), 386 Tuple.Create(7, 11), 387 Tuple.Create(7, 12), 388 Tuple.Create(7, 14), 389 Tuple.Create(7, 22), 390 Tuple.Create(7, 24), 391 Tuple.Create(7, 26), 392 Tuple.Create(7, 34), 393 Tuple.Create(7, 35), 394 Tuple.Create(7, 37), 395 Tuple.Create(7, 45), 396 Tuple.Create(7, 48), 397 Tuple.Create(7, 50), 398 Tuple.Create(7, 58), 399 Tuple.Create(7, 59), 400 Tuple.Create(7, 61), 401 Tuple.Create(7, 69), 402 Tuple.Create(7, 71), 403 Tuple.Create(7, 73), 404 Tuple.Create(7, 81), 405 Tuple.Create(7, 82), 406 Tuple.Create(7, 84), 407 Tuple.Create(7, 92), 408 Tuple.Create(8, 11), 409 Tuple.Create(8, 13), 410 Tuple.Create(8, 16), 411 Tuple.Create(8, 22), 412 Tuple.Create(8, 25), 413 Tuple.Create(8, 28), 414 Tuple.Create(8, 34), 415 Tuple.Create(8, 36), 416 Tuple.Create(8, 39), 417 Tuple.Create(8, 45), 418 Tuple.Create(8, 49), 419 Tuple.Create(8, 52), 420 Tuple.Create(8, 58), 421 Tuple.Create(8, 60), 422 Tuple.Create(8, 63), 423 Tuple.Create(8, 69), 424 Tuple.Create(8, 72), 425 Tuple.Create(8, 75), 426 Tuple.Create(8, 81), 427 Tuple.Create(8, 83), 428 Tuple.Create(8, 86), 429 Tuple.Create(8, 92), 430 Tuple.Create(9, 11), 431 Tuple.Create(9, 12), 432 Tuple.Create(9, 16), 433 Tuple.Create(9, 22), 434 Tuple.Create(9, 24), 435 Tuple.Create(9, 28), 436 Tuple.Create(9, 34), 437 Tuple.Create(9, 35), 438 Tuple.Create(9, 39), 439 Tuple.Create(9, 45), 440 Tuple.Create(9, 48), 441 Tuple.Create(9, 52), 442 Tuple.Create(9, 58), 443 Tuple.Create(9, 59), 444 Tuple.Create(9, 63), 445 Tuple.Create(9, 69), 446 Tuple.Create(9, 71), 447 Tuple.Create(9, 75), 448 Tuple.Create(9, 81), 449 Tuple.Create(9, 82), 450 Tuple.Create(9, 86), 451 Tuple.Create(9, 92), 452 Tuple.Create(10, 11), 453 Tuple.Create(10, 14), 454 Tuple.Create(10, 15), 455 Tuple.Create(10, 22), 456 Tuple.Create(10, 26), 457 Tuple.Create(10, 27), 458 Tuple.Create(10, 34), 459 Tuple.Create(10, 37), 460 Tuple.Create(10, 38), 461 Tuple.Create(10, 45), 462 Tuple.Create(10, 50), 463 Tuple.Create(10, 51), 464 Tuple.Create(10, 58), 465 Tuple.Create(10, 61), 466 Tuple.Create(10, 62), 467 Tuple.Create(10, 69), 468 Tuple.Create(10, 73), 469 Tuple.Create(10, 74), 470 Tuple.Create(10, 81), 471 Tuple.Create(10, 84), 472 Tuple.Create(10, 85), 473 Tuple.Create(10, 92), 474 Tuple.Create(11, 17), 475 Tuple.Create(11, 18), 476 Tuple.Create(11, 19), 477 Tuple.Create(11, 20), 478 Tuple.Create(11, 21), 479 Tuple.Create(11, 29), 480 Tuple.Create(11, 30), 481 Tuple.Create(11, 31), 482 Tuple.Create(11, 32), 483 Tuple.Create(11, 33), 484 Tuple.Create(11, 40), 485 Tuple.Create(11, 41), 486 Tuple.Create(11, 42), 487 Tuple.Create(11, 43), 488 Tuple.Create(11, 44), 489 Tuple.Create(11, 53), 490 Tuple.Create(11, 54), 491 Tuple.Create(11, 55), 492 Tuple.Create(11, 56), 493 Tuple.Create(11, 57), 494 Tuple.Create(11, 64), 495 Tuple.Create(11, 65), 496 Tuple.Create(11, 66), 497 Tuple.Create(11, 67), 498 Tuple.Create(11, 68), 499 Tuple.Create(11, 76), 500 Tuple.Create(11, 77), 501 Tuple.Create(11, 78), 502 Tuple.Create(11, 79), 503 Tuple.Create(11, 80), 504 Tuple.Create(11, 87), 505 Tuple.Create(11, 88), 506 Tuple.Create(11, 89), 507 Tuple.Create(11, 90), 508 Tuple.Create(11, 91), 509 Tuple.Create(12, 23), 510 Tuple.Create(12, 25), 511 Tuple.Create(12, 27), 512 Tuple.Create(12, 30), 513 Tuple.Create(12, 32), 514 Tuple.Create(12, 46), 515 Tuple.Create(12, 49), 516 Tuple.Create(12, 51), 517 Tuple.Create(12, 54), 518 Tuple.Create(12, 56), 519 Tuple.Create(12, 70), 520 Tuple.Create(12, 72), 521 Tuple.Create(12, 74), 522 Tuple.Create(12, 77), 523 Tuple.Create(12, 79), 524 Tuple.Create(12, 93), 525 Tuple.Create(13, 23), 526 Tuple.Create(13, 24), 527 Tuple.Create(13, 26), 528 Tuple.Create(13, 29), 529 Tuple.Create(13, 31), 530 Tuple.Create(13, 46), 531 Tuple.Create(13, 48), 532 Tuple.Create(13, 50), 533 Tuple.Create(13, 53), 534 Tuple.Create(13, 55), 535 Tuple.Create(13, 70), 536 Tuple.Create(13, 71), 537 Tuple.Create(13, 73), 538 Tuple.Create(13, 76), 539 Tuple.Create(13, 78), 540 Tuple.Create(13, 93), 541 Tuple.Create(14, 23), 542 Tuple.Create(14, 25), 543 Tuple.Create(14, 28), 544 Tuple.Create(14, 30), 545 Tuple.Create(14, 33), 546 Tuple.Create(14, 46), 547 Tuple.Create(14, 49), 548 Tuple.Create(14, 52), 549 Tuple.Create(14, 54), 550 Tuple.Create(14, 57), 551 Tuple.Create(14, 70), 552 Tuple.Create(14, 72), 553 Tuple.Create(14, 75), 554 Tuple.Create(14, 77), 555 Tuple.Create(14, 80), 556 Tuple.Create(14, 93), 557 Tuple.Create(15, 23), 558 Tuple.Create(15, 24), 559 Tuple.Create(15, 28), 560 Tuple.Create(15, 29), 561 Tuple.Create(15, 33), 562 Tuple.Create(15, 46), 563 Tuple.Create(15, 48), 564 Tuple.Create(15, 52), 565 Tuple.Create(15, 53), 566 Tuple.Create(15, 57), 567 Tuple.Create(15, 70), 568 Tuple.Create(15, 71), 569 Tuple.Create(15, 75), 570 Tuple.Create(15, 76), 571 Tuple.Create(15, 80), 572 Tuple.Create(15, 93), 573 Tuple.Create(16, 23), 574 Tuple.Create(16, 26), 575 Tuple.Create(16, 27), 576 Tuple.Create(16, 31), 577 Tuple.Create(16, 32), 578 Tuple.Create(16, 46), 579 Tuple.Create(16, 50), 580 Tuple.Create(16, 51), 581 Tuple.Create(16, 55), 582 Tuple.Create(16, 56), 583 Tuple.Create(16, 70), 584 Tuple.Create(16, 73), 585 Tuple.Create(16, 74), 586 Tuple.Create(16, 78), 587 Tuple.Create(16, 79), 588 Tuple.Create(16, 93), 589 Tuple.Create(17, 23), 590 Tuple.Create(17, 25), 591 Tuple.Create(17, 27), 592 Tuple.Create(17, 34), 593 Tuple.Create(17, 46), 594 Tuple.Create(17, 49), 595 Tuple.Create(17, 51), 596 Tuple.Create(17, 58), 597 Tuple.Create(17, 70), 598 Tuple.Create(17, 72), 599 Tuple.Create(17, 74), 600 Tuple.Create(17, 81), 601 Tuple.Create(17, 93), 602 Tuple.Create(18, 23), 603 Tuple.Create(18, 24), 604 Tuple.Create(18, 26), 605 Tuple.Create(18, 34), 606 Tuple.Create(18, 46), 607 Tuple.Create(18, 48), 608 Tuple.Create(18, 50), 609 Tuple.Create(18, 58), 610 Tuple.Create(18, 70), 611 Tuple.Create(18, 71), 612 Tuple.Create(18, 73), 613 Tuple.Create(18, 81), 614 Tuple.Create(18, 93), 615 Tuple.Create(19, 23), 616 Tuple.Create(19, 25), 617 Tuple.Create(19, 28), 618 Tuple.Create(19, 34), 619 Tuple.Create(19, 46), 620 Tuple.Create(19, 49), 621 Tuple.Create(19, 52), 622 Tuple.Create(19, 58), 623 Tuple.Create(19, 70), 624 Tuple.Create(19, 72), 625 Tuple.Create(19, 75), 626 Tuple.Create(19, 81), 627 Tuple.Create(19, 93), 628 Tuple.Create(20, 23), 629 Tuple.Create(20, 24), 630 Tuple.Create(20, 28), 631 Tuple.Create(20, 34), 632 Tuple.Create(20, 46), 633 Tuple.Create(20, 48), 634 Tuple.Create(20, 52), 635 Tuple.Create(20, 58), 636 Tuple.Create(20, 70), 637 Tuple.Create(20, 71), 638 Tuple.Create(20, 75), 639 Tuple.Create(20, 81), 640 Tuple.Create(20, 93), 641 Tuple.Create(21, 23), 642 Tuple.Create(21, 26), 643 Tuple.Create(21, 27), 644 Tuple.Create(21, 34), 645 Tuple.Create(21, 46), 646 Tuple.Create(21, 50), 647 Tuple.Create(21, 51), 648 Tuple.Create(21, 58), 649 Tuple.Create(21, 70), 650 Tuple.Create(21, 73), 651 Tuple.Create(21, 74), 652 Tuple.Create(21, 81), 653 Tuple.Create(21, 93), 654 Tuple.Create(22, 23), 655 Tuple.Create(22, 29), 656 Tuple.Create(22, 30), 657 Tuple.Create(22, 31), 658 Tuple.Create(22, 32), 659 Tuple.Create(22, 33), 660 Tuple.Create(22, 46), 661 Tuple.Create(22, 53), 662 Tuple.Create(22, 54), 663 Tuple.Create(22, 55), 664 Tuple.Create(22, 56), 665 Tuple.Create(22, 57), 666 Tuple.Create(22, 70), 667 Tuple.Create(22, 76), 668 Tuple.Create(22, 77), 669 Tuple.Create(22, 78), 670 Tuple.Create(22, 79), 671 Tuple.Create(22, 80), 672 Tuple.Create(22, 93), 673 Tuple.Create(23, 35), 674 Tuple.Create(23, 36), 675 Tuple.Create(23, 37), 676 Tuple.Create(23, 38), 677 Tuple.Create(23, 39), 678 Tuple.Create(23, 40), 679 Tuple.Create(23, 41), 680 Tuple.Create(23, 42), 681 Tuple.Create(23, 43), 682 Tuple.Create(23, 44), 683 Tuple.Create(23, 45), 684 Tuple.Create(23, 59), 685 Tuple.Create(23, 60), 686 Tuple.Create(23, 61), 687 Tuple.Create(23, 62), 688 Tuple.Create(23, 63), 689 Tuple.Create(23, 64), 690 Tuple.Create(23, 65), 691 Tuple.Create(23, 66), 692 Tuple.Create(23, 67), 693 Tuple.Create(23, 68), 694 Tuple.Create(23, 69), 695 Tuple.Create(23, 82), 696 Tuple.Create(23, 83), 697 Tuple.Create(23, 84), 698 Tuple.Create(23, 85), 699 Tuple.Create(23, 86), 700 Tuple.Create(23, 87), 701 Tuple.Create(23, 88), 702 Tuple.Create(23, 89), 703 Tuple.Create(23, 90), 704 Tuple.Create(23, 91), 705 Tuple.Create(23, 92), 706 Tuple.Create(24, 47), 707 Tuple.Create(24, 49), 708 Tuple.Create(24, 51), 709 Tuple.Create(24, 54), 710 Tuple.Create(24, 56), 711 Tuple.Create(24, 60), 712 Tuple.Create(24, 62), 713 Tuple.Create(24, 65), 714 Tuple.Create(24, 67), 715 Tuple.Create(24, 94), 716 Tuple.Create(25, 47), 717 Tuple.Create(25, 48), 718 Tuple.Create(25, 50), 719 Tuple.Create(25, 53), 720 Tuple.Create(25, 55), 721 Tuple.Create(25, 59), 722 Tuple.Create(25, 61), 723 Tuple.Create(25, 64), 724 Tuple.Create(25, 66), 725 Tuple.Create(25, 94), 726 Tuple.Create(26, 47), 727 Tuple.Create(26, 49), 728 Tuple.Create(26, 52), 729 Tuple.Create(26, 54), 730 Tuple.Create(26, 57), 731 Tuple.Create(26, 60), 732 Tuple.Create(26, 63), 733 Tuple.Create(26, 65), 734 Tuple.Create(26, 68), 735 Tuple.Create(26, 94), 736 Tuple.Create(27, 47), 737 Tuple.Create(27, 48), 738 Tuple.Create(27, 52), 739 Tuple.Create(27, 53), 740 Tuple.Create(27, 57), 741 Tuple.Create(27, 59), 742 Tuple.Create(27, 63), 743 Tuple.Create(27, 64), 744 Tuple.Create(27, 68), 745 Tuple.Create(27, 94), 746 Tuple.Create(28, 47), 747 Tuple.Create(28, 50), 748 Tuple.Create(28, 51), 749 Tuple.Create(28, 55), 750 Tuple.Create(28, 56), 751 Tuple.Create(28, 61), 752 Tuple.Create(28, 62), 753 Tuple.Create(28, 66), 754 Tuple.Create(28, 67), 755 Tuple.Create(28, 94), 756 Tuple.Create(29, 47), 757 Tuple.Create(29, 49), 758 Tuple.Create(29, 51), 759 Tuple.Create(29, 58), 760 Tuple.Create(29, 60), 761 Tuple.Create(29, 62), 762 Tuple.Create(29, 69), 763 Tuple.Create(29, 94), 764 Tuple.Create(30, 47), 765 Tuple.Create(30, 48), 766 Tuple.Create(30, 50), 767 Tuple.Create(30, 58), 768 Tuple.Create(30, 59), 769 Tuple.Create(30, 61), 770 Tuple.Create(30, 69), 771 Tuple.Create(30, 94), 772 Tuple.Create(31, 47), 773 Tuple.Create(31, 49), 774 Tuple.Create(31, 52), 775 Tuple.Create(31, 58), 776 Tuple.Create(31, 60), 777 Tuple.Create(31, 63), 778 Tuple.Create(31, 69), 779 Tuple.Create(31, 94), 780 Tuple.Create(32, 47), 781 Tuple.Create(32, 48), 782 Tuple.Create(32, 52), 783 Tuple.Create(32, 58), 784 Tuple.Create(32, 59), 785 Tuple.Create(32, 63), 786 Tuple.Create(32, 69), 787 Tuple.Create(32, 94), 788 Tuple.Create(33, 47), 789 Tuple.Create(33, 50), 790 Tuple.Create(33, 51), 791 Tuple.Create(33, 58), 792 Tuple.Create(33, 61), 793 Tuple.Create(33, 62), 794 Tuple.Create(33, 69), 795 Tuple.Create(33, 94), 796 Tuple.Create(34, 47), 797 Tuple.Create(34, 53), 798 Tuple.Create(34, 54), 799 Tuple.Create(34, 55), 800 Tuple.Create(34, 56), 801 Tuple.Create(34, 57), 802 Tuple.Create(34, 64), 803 Tuple.Create(34, 65), 804 Tuple.Create(34, 66), 805 Tuple.Create(34, 67), 806 Tuple.Create(34, 68), 807 Tuple.Create(34, 94), 808 Tuple.Create(35, 47), 809 Tuple.Create(35, 49), 810 Tuple.Create(35, 51), 811 Tuple.Create(35, 54), 812 Tuple.Create(35, 56), 813 Tuple.Create(35, 70), 814 Tuple.Create(35, 94), 815 Tuple.Create(36, 47), 816 Tuple.Create(36, 48), 817 Tuple.Create(36, 50), 818 Tuple.Create(36, 53), 819 Tuple.Create(36, 55), 820 Tuple.Create(36, 70), 821 Tuple.Create(36, 94), 822 Tuple.Create(37, 47), 823 Tuple.Create(37, 49), 824 Tuple.Create(37, 52), 825 Tuple.Create(37, 54), 826 Tuple.Create(37, 57), 827 Tuple.Create(37, 70), 828 Tuple.Create(37, 94), 829 Tuple.Create(38, 47), 830 Tuple.Create(38, 48), 831 Tuple.Create(38, 52), 832 Tuple.Create(38, 53), 833 Tuple.Create(38, 57), 834 Tuple.Create(38, 70), 835 Tuple.Create(38, 94), 836 Tuple.Create(39, 47), 837 Tuple.Create(39, 50), 838 Tuple.Create(39, 51), 839 Tuple.Create(39, 55), 840 Tuple.Create(39, 56), 841 Tuple.Create(39, 70), 842 Tuple.Create(39, 94), 843 Tuple.Create(40, 47), 844 Tuple.Create(40, 49), 845 Tuple.Create(40, 51), 846 Tuple.Create(40, 58), 847 Tuple.Create(40, 70), 848 Tuple.Create(40, 94), 849 Tuple.Create(41, 47), 850 Tuple.Create(41, 48), 851 Tuple.Create(41, 50), 852 Tuple.Create(41, 58), 853 Tuple.Create(41, 70), 854 Tuple.Create(41, 94), 855 Tuple.Create(42, 47), 856 Tuple.Create(42, 49), 857 Tuple.Create(42, 52), 858 Tuple.Create(42, 58), 859 Tuple.Create(42, 70), 860 Tuple.Create(42, 94), 861 Tuple.Create(43, 47), 862 Tuple.Create(43, 48), 863 Tuple.Create(43, 52), 864 Tuple.Create(43, 58), 865 Tuple.Create(43, 70), 866 Tuple.Create(43, 94), 867 Tuple.Create(44, 47), 868 Tuple.Create(44, 50), 869 Tuple.Create(44, 51), 870 Tuple.Create(44, 58), 871 Tuple.Create(44, 70), 872 Tuple.Create(44, 94), 873 Tuple.Create(45, 47), 874 Tuple.Create(45, 53), 875 Tuple.Create(45, 54), 876 Tuple.Create(45, 55), 877 Tuple.Create(45, 56), 878 Tuple.Create(45, 57), 879 Tuple.Create(45, 70), 880 Tuple.Create(45, 94), 881 Tuple.Create(46, 47), 882 Tuple.Create(46, 59), 883 Tuple.Create(46, 60), 884 Tuple.Create(46, 61), 885 Tuple.Create(46, 62), 886 Tuple.Create(46, 63), 887 Tuple.Create(46, 64), 888 Tuple.Create(46, 65), 889 Tuple.Create(46, 66), 890 Tuple.Create(46, 67), 891 Tuple.Create(46, 68), 892 Tuple.Create(46, 69), 893 Tuple.Create(46, 94), 894 Tuple.Create(47, 71), 895 Tuple.Create(47, 72), 896 Tuple.Create(47, 73), 897 Tuple.Create(47, 74), 898 Tuple.Create(47, 75), 899 Tuple.Create(47, 76), 900 Tuple.Create(47, 77), 901 Tuple.Create(47, 78), 902 Tuple.Create(47, 79), 903 Tuple.Create(47, 80), 904 Tuple.Create(47, 81), 905 Tuple.Create(47, 82), 906 Tuple.Create(47, 83), 907 Tuple.Create(47, 84), 908 Tuple.Create(47, 85), 909 Tuple.Create(47, 86), 910 Tuple.Create(47, 87), 911 Tuple.Create(47, 88), 912 Tuple.Create(47, 89), 913 Tuple.Create(47, 90), 914 Tuple.Create(47, 91), 915 Tuple.Create(47, 92), 916 Tuple.Create(47, 93), 917 Tuple.Create(48, 95), 918 Tuple.Create(49, 95), 919 Tuple.Create(50, 95), 920 Tuple.Create(51, 95), 921 Tuple.Create(52, 95), 922 Tuple.Create(53, 95), 923 Tuple.Create(54, 95), 924 Tuple.Create(55, 95), 925 Tuple.Create(56, 95), 926 Tuple.Create(57, 95), 927 Tuple.Create(58, 95), 928 Tuple.Create(59, 95), 929 Tuple.Create(60, 95), 930 Tuple.Create(61, 95), 931 Tuple.Create(62, 95), 932 Tuple.Create(63, 95), 933 Tuple.Create(64, 95), 934 Tuple.Create(65, 95), 935 Tuple.Create(66, 95), 936 Tuple.Create(67, 95), 937 Tuple.Create(68, 95), 938 Tuple.Create(69, 95), 939 Tuple.Create(70, 95), 940 Tuple.Create(71, 95), 941 Tuple.Create(72, 95), 942 Tuple.Create(73, 95), 943 Tuple.Create(74, 95), 944 Tuple.Create(75, 95), 945 Tuple.Create(76, 95), 946 Tuple.Create(77, 95), 947 Tuple.Create(78, 95), 948 Tuple.Create(79, 95), 949 Tuple.Create(80, 95), 950 Tuple.Create(81, 95), 951 Tuple.Create(82, 95), 952 Tuple.Create(83, 95), 953 Tuple.Create(84, 95), 954 Tuple.Create(85, 95), 955 Tuple.Create(86, 95), 956 Tuple.Create(87, 95), 957 Tuple.Create(88, 95), 958 Tuple.Create(89, 95), 959 Tuple.Create(90, 95), 960 Tuple.Create(91, 95), 961 Tuple.Create(92, 95), 962 Tuple.Create(93, 95), 963 Tuple.Create(94, 95) 964 }; 965 #endregion 88 966 } 89 967 } -
branches/MemPRAlgorithm/HeuristicLab.Problems.GraphColoring/3.3/HeuristicLab.Problems.GraphColoring-3.3.csproj
r14466 r14471 58 58 </ItemGroup> 59 59 <ItemGroup> 60 <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj"> 61 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project> 62 <Name>HeuristicLab.Analysis-3.3</Name> 63 <Private>False</Private> 64 </ProjectReference> 60 65 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 61 66 <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project> … … 91 96 <Project>{23da7ff4-d5b8-41b6-aa96-f0561d24f3ee}</Project> 92 97 <Name>HeuristicLab.Operators-3.3</Name> 98 <Private>False</Private> 99 </ProjectReference> 100 <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj"> 101 <Project>{25087811-f74c-4128-bc86-8324271da13e}</Project> 102 <Name>HeuristicLab.Optimization.Operators-3.3</Name> 93 103 <Private>False</Private> 94 104 </ProjectReference> -
branches/MemPRAlgorithm/HeuristicLab.Problems.GraphColoring/3.3/Plugin.cs.frame
r14466 r14471 25 25 [Plugin("HeuristicLab.Problems.GraphColoring", "3.3.14.$WCREV$")] 26 26 [PluginFile("HeuristicLab.Problems.GraphColoring-3.3.dll", PluginFileType.Assembly)] 27 [PluginDependency("HeuristicLab.Analysis", "3.3")] 27 28 [PluginDependency("HeuristicLab.Collections", "3.3")] 28 29 [PluginDependency("HeuristicLab.Common", "3.3")] … … 33 34 [PluginDependency("HeuristicLab.Operators", "3.3")] 34 35 [PluginDependency("HeuristicLab.Optimization", "3.3")] 36 [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")] 35 37 [PluginDependency("HeuristicLab.Parameters", "3.3")] 38 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 36 39 [PluginDependency("HeuristicLab.Persistence", "3.3")] 37 40 public class HeuristicLabProblemsGraphColoringPlugin : PluginBase { -
branches/MemPRAlgorithm/HeuristicLab.Problems.Instances.DIMACS/3.3/GcolDataDescriptor.cs
r14429 r14471 20 20 #endregion 21 21 22 namespace HeuristicLab.Problems.Instances. QAPLIB{23 internal class QAPLIBDataDescriptor : IDataDescriptor {22 namespace HeuristicLab.Problems.Instances.DIMACS { 23 internal class GcolDataDescriptor : IDataDescriptor { 24 24 public string Name { get; internal set; } 25 25 public string Description { get; internal set; } 26 26 27 27 internal string InstanceIdentifier { get; set; } 28 internal string SolutionIdentifier { get; set; }29 28 30 internal QAPLIBDataDescriptor(string name, string description, string instanceIdentifier, string solutionIdentifier) {29 internal GcolDataDescriptor(string name, string description, string instanceIdentifier) { 31 30 this.Name = name; 32 31 this.Description = description; 33 32 this.InstanceIdentifier = instanceIdentifier; 34 this.SolutionIdentifier = solutionIdentifier;35 33 } 36 34 } -
branches/MemPRAlgorithm/HeuristicLab.Problems.Instances.DIMACS/3.3/GcolInstanceProvider.cs
r14429 r14471 28 28 using System.Text.RegularExpressions; 29 29 30 namespace HeuristicLab.Problems.Instances.QAPLIB { 31 public class QAPLIBInstanceProvider : ProblemInstanceProvider<QAPData> { 32 #region Reversed instances 33 // These instances specified their best known solution in the wrong order 34 protected virtual HashSet<string> ReversedSolutions { 35 get { 36 return new HashSet<string>(new string[] { 37 "bur26a", 38 "bur26b", 39 "bur26c", 40 "bur26d", 41 "bur26e", 42 "bur26f", 43 "bur26g", 44 "bur26h", 45 "chr12a", 46 "chr12b", 47 "chr12c", 48 "chr15a", 49 "chr15b", 50 "chr15c", 51 "chr18a", 52 "chr18b", 53 "chr20a", 54 "chr20b", 55 "chr20c", 56 "chr22a", 57 "chr22b", 58 "chr25a", 59 "esc16a", 60 "esc16b", 61 "esc16c", 62 "esc16d", 63 "esc16e", 64 "esc16g", 65 "esc16h", 66 "esc16i", 67 "esc16j", 68 "esc32a", 69 "esc32b", 70 "esc32c", 71 "esc32d", 72 "esc32e", 73 "esc32f", 74 "esc32g", 75 "esc32h", 76 "had12", 77 "had14", 78 "had16", 79 "had18", 80 "had20", 81 "kra32", 82 "lipa20a", 83 "lipa30a", 84 "lipa40a", 85 "lipa50a", 86 "lipa60a", 87 "lipa70a", 88 "lipa80a", 89 "lipa90a", 90 "nug12", 91 "nug14", 92 "nug15", 93 "nug16a", 94 "nug16b", 95 "nug17", 96 "nug18", 97 "nug20", 98 "nug21", 99 "nug22", 100 "nug24", 101 "nug25", 102 "nug27", 103 "nug28", 104 "rou12", 105 "rou15", 106 "rou20", 107 "scr12", 108 "scr15", 109 "scr20", 110 "sko100a", 111 "sko100b", 112 "sko100c", 113 "sko100d", 114 "sko100e", 115 "sko100f", 116 "sko49", 117 "sko81", 118 "sko90", 119 "ste36a", 120 "ste36b", 121 "tai100a", 122 "tai100b", 123 "tai12a", 124 "tai12b", 125 "tai150b", 126 "tai15a", 127 "tai15b", 128 "tai17a", 129 "tai20a", 130 "tai20b", 131 "tai256c", 132 "tai25a", 133 "tai25b", 134 "tai30a", 135 "tai30b", 136 "tai35a", 137 "tai35b", 138 "tai40a", 139 "tai40b", 140 "tai50a", 141 "tai50b", 142 "tai60a", 143 "tai60b", 144 "tai64c", 145 "tai80a", 146 "tai80b", 147 "wil100" 148 }); 149 } 150 } 151 #endregion 30 namespace HeuristicLab.Problems.Instances.DIMACS { 31 public class GcolInstanceProvider : ProblemInstanceProvider<GCPData> { 152 32 153 33 public override string Name { 154 get { return " QAPLIB"; }34 get { return "DIMACS Graph Coloring"; } 155 35 } 156 36 157 37 public override string Description { 158 get { return " Quadratic Assignment Problem Library"; }38 get { return "Graph Coloring problem instance library"; } 159 39 } 160 40 161 41 public override Uri WebLink { 162 get { return new Uri("http ://www.seas.upenn.edu/qaplib/"); }42 get { return new Uri("https://turing.cs.hbg.psu.edu/txn131/graphcoloring.html"); } 163 43 } 164 44 165 45 public override string ReferencePublication { 166 46 get { 167 return @"R. E. Burkard, S. E. Karisch, and F. Rendl. 1997. 168 QAPLIB - A Quadratic Assignment Problem Library. 169 Journal of Global Optimization, 10, pp. 391-403."; 47 return string.Empty; 170 48 } 171 49 } 172 50 173 protected virtual string FileName { get { return " qap"; } }51 protected virtual string FileName { get { return "col"; } } 174 52 175 53 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { 176 Dictionary<string, string> solutions = new Dictionary<string, string>(); 177 var solutionsArchiveName = GetResourceName(FileName + @"\.sln\.zip"); 178 if (!String.IsNullOrEmpty(solutionsArchiveName)) { 179 using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) { 180 foreach (var entry in solutionsZipFile.Entries) 181 solutions.Add(Path.GetFileNameWithoutExtension(entry.Name) + ".dat", entry.Name); 182 } 183 } 184 var instanceArchiveName = GetResourceName(FileName + @"\.dat\.zip"); 54 var instanceArchiveName = GetResourceName(FileName + @"\.zip"); 185 55 if (String.IsNullOrEmpty(instanceArchiveName)) yield break; 186 56 187 57 using (var instanceStream = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 188 58 foreach (var entry in instanceStream.Entries.Select(x => x.Name).OrderBy(x => x)) { 189 yield return new QAPLIBDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetDescription(), entry, solutions.ContainsKey(entry) ? solutions[entry] : String.Empty);59 yield return new GcolDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetDescription(), entry); 190 60 } 191 61 } 192 62 } 193 63 194 public override QAPData LoadData(IDataDescriptor id) {195 var descriptor = ( QAPLIBDataDescriptor)id;196 var instanceArchiveName = GetResourceName(FileName + @"\. dat\.zip");64 public override GCPData LoadData(IDataDescriptor id) { 65 var descriptor = (GcolDataDescriptor)id; 66 var instanceArchiveName = GetResourceName(FileName + @"\.zip"); 197 67 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 198 68 var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier); 199 69 200 70 using (var stream = entry.Open()) { 201 var parser = new QAPLIBParser();71 var parser = new Parser(); 202 72 parser.Parse(stream); 203 73 var instance = Load(parser); 204 74 instance.Name = id.Name; 205 75 instance.Description = id.Description; 206 207 if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) { 208 var solutionsArchiveName = GetResourceName(FileName + @"\.sln\.zip"); 209 using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) { 210 entry = solutionsZipFile.GetEntry(descriptor.SolutionIdentifier); 211 using (var solStream = entry.Open()) { 212 var slnParser = new QAPLIBSolutionParser(); 213 slnParser.Parse(solStream, true); 214 if (slnParser.Error != null) throw slnParser.Error; 215 216 int[] assignment = slnParser.Assignment; 217 if (assignment != null && ReversedSolutions.Contains(instance.Name)) { 218 assignment = (int[])slnParser.Assignment.Clone(); 219 for (int i = 0; i < assignment.Length; i++) 220 assignment[slnParser.Assignment[i]] = i; 221 } 222 instance.BestKnownAssignment = assignment; 223 instance.BestKnownQuality = slnParser.Quality; 224 } 225 } 226 } 76 int bestknown; 77 if (bkq.TryGetValue(instance.Name, out bestknown)) 78 instance.BestKnownColors = bestknown; 227 79 return instance; 228 80 } … … 233 85 get { return true; } 234 86 } 235 public override QAPData ImportData(string path) {236 var parser = new QAPLIBParser();87 public override GCPData ImportData(string path) { 88 var parser = new Parser(); 237 89 parser.Parse(path); 238 90 var instance = Load(parser); … … 242 94 } 243 95 244 private QAPData Load(QAPLIBParser parser) { 245 var instance = new QAPData(); 246 instance.Dimension = parser.Size; 247 instance.Distances = parser.Distances; 248 instance.Weights = parser.Weights; 96 private GCPData Load(Parser parser) { 97 var instance = new GCPData(); 98 instance.Nodes = parser.Nodes; 99 var adjacencies = new int[parser.Edges, 2]; 100 var i = 0; 101 foreach (var a in parser.AdjacencyList) { 102 adjacencies[i, 0] = a.Item1 - 1; 103 adjacencies[i, 1] = a.Item2 - 1; 104 i++; 105 } 106 instance.Adjacencies = adjacencies; 249 107 return instance; 250 108 } … … 258 116 .Where(x => Regex.Match(x, @".*\.Data\." + fileName).Success).SingleOrDefault(); 259 117 } 118 119 private Dictionary<string, int> bkq = new Dictionary<string, int> { 120 { "fpsol2.i.1", 65 }, 121 { "fpsol2.i.2", 30 }, 122 { "fpsol2.i.3", 30 }, 123 { "inithx.i.1", 54 }, 124 { "inithx.i.2", 31 }, 125 { "inithx.i.3", 31 }, 126 { "le450_5a", 5 }, 127 { "le450_5b", 5 }, 128 { "le450_5c", 5 }, 129 { "le450_5d", 5 }, 130 { "le450_15a", 15 }, 131 { "le450_15b", 15 }, 132 { "le450_15c", 15 }, 133 { "le450_15d", 15 }, 134 { "le450_25a", 25 }, 135 { "le450_25b", 25 }, 136 { "le450_25c", 25 }, 137 { "le450_25d", 25 }, 138 { "mulsol.i.1", 49 }, 139 { "mulsol.i.2", 31 }, 140 { "mulsol.i.3", 31 }, 141 { "mulsol.i.4", 31 }, 142 { "mulsol.i.5", 31 }, 143 { "zeroin.i.1", 49 }, 144 { "zeroin.i.2", 30 }, 145 { "zeroin.i.3", 30 }, 146 { "anna", 11 }, 147 { "david", 11 }, 148 { "homer", 13 }, 149 { "huck", 11 }, 150 { "jean", 10 }, 151 { "games120", 9 }, 152 { "miles250", 8 }, 153 { "miles500", 20 }, 154 { "miles750", 31 }, 155 { "miles1000", 42 }, 156 { "miles1500", 73 }, 157 { "queen5_5", 5 }, 158 { "queen6_6", 7 }, 159 { "queen7_7", 7 }, 160 { "queen8_8", 9 }, 161 { "queen8_12", 12 }, 162 { "queen9_9", 10 }, 163 { "queen11_11", 11 }, 164 { "queen13_13", 13 }, 165 { "myciel3", 4 }, 166 { "myciel4", 5 }, 167 { "myciel5", 6 }, 168 { "myciel6", 7 }, 169 { "myciel7", 8 }, 170 { "mugg88_1", 4 }, 171 { "mugg88_25", 4 }, 172 { "mugg100_1", 4 }, 173 { "mugg100_25", 4 }, 174 { "1-Insertions_4", 4 }, 175 { "2-Insertions_3", 4 }, 176 { "2-Insertions_4", 4 }, 177 { "3-Insertions_3", 4 }, 178 { "4-Insertions_3", 3 }, 179 { "qg.order30", 30 }, 180 { "qg.order40", 40 }, 181 { "qg.order60", 60 }, 182 { "qg.order100", 100 } 183 }; 260 184 } 261 185 } -
branches/MemPRAlgorithm/HeuristicLab.Problems.Instances.DIMACS/3.3/Parser.cs
r14429 r14471 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.IO; 24 25 25 namespace HeuristicLab.Problems.Instances.QAPLIB { 26 public class QAPLIBParser { 27 public int Size { get; private set; } 28 public double[,] Distances { get; private set; } 29 public double[,] Weights { get; private set; } 26 namespace HeuristicLab.Problems.Instances.DIMACS { 27 public class Parser { 28 public int Nodes { get; private set; } 29 public int Edges { get; private set; } 30 public ICollection<Tuple<int, int>> AdjacencyList { get { return edges; } } 31 private HashSet<Tuple<int, int>> edges; 30 32 31 public QAPLIBParser() {33 public Parser() { 32 34 Reset(); 33 35 } 34 36 35 37 public void Reset() { 36 Size= 0;37 Distances = null;38 Weights = null;38 Nodes = 0; 39 Edges = 0; 40 edges = new HashSet<Tuple<int, int>>(); 39 41 } 40 42 … … 54 56 /// <returns>True if the file was successfully read or false otherwise.</returns> 55 57 public void Parse(Stream stream) { 58 char[] delim = new char[] { ' ', '\t' }; 56 59 var reader = new StreamReader(stream); 57 Size = int.Parse(reader.ReadLine()); 58 Distances = new double[Size, Size]; 59 Weights = new double[Size, Size]; 60 char[] delim = new char[] { ' ', '\t' }; 60 var line = reader.ReadLine().Trim(); 61 // skip comments 62 while (line.StartsWith("c", StringComparison.InvariantCultureIgnoreCase)) line = reader.ReadLine().Trim(); 61 63 62 Weights = ParseMatrix(reader, delim); 63 Distances = ParseMatrix(reader, delim); 64 } 65 66 private double[,] ParseMatrix(StreamReader reader, char[] delim) { 67 int read = 0, k = 0; 68 double[,] result = new double[Size, Size]; 69 while (k < Size) { 70 if (reader.EndOfStream) throw new InvalidDataException("Reached end of stream while reading second matrix."); 71 string valLine = reader.ReadLine(); 72 while (String.IsNullOrWhiteSpace(valLine)) valLine = reader.ReadLine(); 73 string[] vals = valLine.Split(delim, StringSplitOptions.RemoveEmptyEntries); 74 foreach (string val in vals) { 75 result[k, read++] = double.Parse(val); 76 if (read == Size) { 77 read = 0; 78 k++; 79 } 80 } 81 } 82 return result; 64 // p edge NODES EDGES 65 var split = line.Split(delim, StringSplitOptions.RemoveEmptyEntries); 66 Nodes = int.Parse(split[2]); 67 do { 68 line = reader.ReadLine(); 69 if (string.IsNullOrEmpty(line)) break; 70 // e XX YY 71 split = line.Split(delim, StringSplitOptions.RemoveEmptyEntries); 72 var src = int.Parse(split[1]); 73 var tgt = int.Parse(split[2]); 74 Tuple<int, int> e = null; 75 if (src < tgt) e = Tuple.Create(src, tgt); 76 else if (src > tgt) e = Tuple.Create(tgt, src); 77 else continue; // src == tgt 78 if (edges.Add(e)) Edges++; 79 } while (!reader.EndOfStream); 83 80 } 84 81 } -
branches/MemPRAlgorithm/HeuristicLab.Problems.Instances/3.3/HeuristicLab.Problems.Instances-3.3.csproj
r13484 r14471 128 128 <Compile Include="Types\DistanceHelper.cs" /> 129 129 <Compile Include="Types\OPData.cs" /> 130 <Compile Include="Types\GCPData.cs" /> 130 131 <Compile Include="Types\VRP\MDCVRPTWData.cs" /> 131 132 <Compile Include="Types\VRP\MDCVRPData.cs" /> -
branches/MemPRAlgorithm/HeuristicLab.Problems.Instances/3.3/Types/GCPData.cs
r14429 r14471 22 22 namespace HeuristicLab.Problems.Instances { 23 23 /// <summary> 24 /// Describes instances of the Quadratic Assignment Problem (QAP).24 /// Describes instances of the graph coloring problem (GCP). 25 25 /// </summary> 26 public class QAPData {26 public class GCPData { 27 27 /// <summary> 28 28 /// The name of the instance … … 35 35 36 36 /// <summary> 37 /// The number of facilities (and also the number of locations)37 /// The number of nodes in the graph 38 38 /// </summary> 39 public int Dimension{ get; set; }39 public int Nodes { get; set; } 40 40 /// <summary> 41 /// An Nx N Matrix with N = |Faciliies|41 /// An Nx2 adjacency list with N = Nodes 42 42 /// </summary> 43 public double[,] Distances { get; set; } 44 /// <summary> 45 /// An NxN Matrix with N = |Faciliies| 46 /// </summary> 47 public double[,] Weights { get; set; } 43 public int[,] Adjacencies { get; set; } 48 44 49 45 /// <summary> 50 /// Optional! An array of length N with N = | Facilities|46 /// Optional! An array of length N with N = |Nodes| 51 47 /// </summary> 52 public int[] BestKnown Assignment{ get; set; }48 public int[] BestKnownColoring { get; set; } 53 49 /// <summary> 54 /// Optional! The quality value of the <see cref="BestKnown Assignment"/>50 /// Optional! The quality value of the <see cref="BestKnownColoring"/> 55 51 /// </summary> 56 public double? BestKnown Quality{ get; set; }52 public double? BestKnownColors { get; set; } 57 53 } 58 54 }
Note: See TracChangeset
for help on using the changeset viewer.