- Timestamp:
- 01/13/17 12:55:06 (8 years ago)
- Location:
- branches/MemPRAlgorithm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MemPRAlgorithm
-
branches/MemPRAlgorithm/HeuristicLab.Tests
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Tests (added) merged: 14475,14479,14527,14529
- Property svn:mergeinfo changed
-
branches/MemPRAlgorithm/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GAGroupingProblemSampleTest.cs
r14185 r14562 49 49 public bool Maximization { get { return false; } } 50 50 51 private bool[,] a llowedTogether;51 private bool[,] adjacencyMatrix; 52 52 53 53 public override void Initialize() { 54 54 var encoding = new LinearLinkageEncoding(""lle"", length: ProblemSize); 55 a llowedTogether= new bool[encoding.Length, encoding.Length];55 adjacencyMatrix = new bool[encoding.Length, encoding.Length]; 56 56 var random = new System.Random(13); 57 57 for (var i = 0; i < encoding.Length - 1; i++) 58 58 for (var j = i + 1; j < encoding.Length; j++) 59 a llowedTogether[i, j] = allowedTogether[j, i] = random.Next(2) == 0;59 adjacencyMatrix[i, j] = adjacencyMatrix[j, i] = random.Next(2) == 0; 60 60 61 61 Encoding = encoding; … … 68 68 for (var j = 0; j < groups[i].Count; j++) 69 69 for (var k = j + 1; k < groups[i].Count; k++) 70 if (!a llowedTogether[groups[i][j], groups[i][k]]) penalty++;70 if (!adjacencyMatrix[groups[i][j], groups[i][k]]) penalty++; 71 71 } 72 if (penalty > 0) return penalty + ProblemSize; 73 else return groups.Count; 72 var result = groups.Count; 73 if (penalty > 0) result += penalty + ProblemSize; 74 return result; 74 75 } 75 76 … … 105 106 ga.SetSeedRandomly.Value = false; 106 107 SamplesUtils.RunAlgorithm(ga); 107 Assert.AreEqual( 26, SamplesUtils.GetDoubleResult(ga, "BestQuality"));108 Assert.AreEqual( 27.58, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality"));109 Assert.AreEqual(1 05, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality"));108 Assert.AreEqual(127, SamplesUtils.GetDoubleResult(ga, "BestQuality")); 109 Assert.AreEqual(129,38, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality")); 110 Assert.AreEqual(132, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality")); 110 111 Assert.AreEqual(99100, SamplesUtils.GetIntResult(ga, "EvaluatedSolutions")); 111 112 } … … 121 122 #endregion 122 123 #region Algorithm Configuration 123 ga.Name = "Genetic Algorithm - Gr ouping Problem";124 ga.Description = "A genetic algorithm which solves a gr ouping problem using the linear linkage encoding.";124 ga.Name = "Genetic Algorithm - Graph Coloring"; 125 ga.Description = "A genetic algorithm which solves a graph coloring problem using the linear linkage encoding."; 125 126 ga.Problem = problem; 126 127 SamplesUtils.ConfigureGeneticAlgorithmParameters<TournamentSelector, MultiLinearLinkageCrossover, MultiLinearLinkageManipulator>( -
branches/MemPRAlgorithm/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPTimeSeriesSampleTest.cs
r14185 r14562 50 50 SamplesUtils.RunAlgorithm(osga); 51 51 52 Assert.AreEqual(0.0 20952753415199643, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8);53 Assert.AreEqual(0.0 23220938866319357, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8);54 Assert.AreEqual(0.0 23716788824595391, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8);55 Assert.AreEqual( 48200, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions"));52 Assert.AreEqual(0.015441526903606416, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8); 53 Assert.AreEqual(0.017420834241279298, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8); 54 Assert.AreEqual(0.065195703753298972, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8); 55 Assert.AreEqual(92000, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions")); 56 56 } 57 57 … … 63 63 problem.MaximumSymbolicExpressionTreeDepth.Value = 12; 64 64 problem.EvaluatorParameter.Value.HorizonParameter.Value.Value = 10; 65 problem.ApplyLinearScaling.Value = true; 65 66 66 67 foreach (var symbol in problem.SymbolicExpressionTreeGrammar.Symbols) {
Note: See TracChangeset
for help on using the changeset viewer.