Changeset 13163
- Timestamp:
- 11/15/15 15:38:50 (7 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs
r12938 r13163 84 84 85 85 Encoding.Grammar = g; 86 87 BestKnownQuality = Math.Pow(2, NumberOfBits); // this is a benchmark problem (the best achievable quality is known for a given number of bits) 86 88 } 87 89 -
trunk/sources/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs
r12940 r13163 98 98 99 99 Encoding.Grammar = g; 100 101 BestKnownQuality = Math.Pow(2, NumberOfBits); // this is a benchmark problem (the best achievable quality is known for a given number of bits) 100 102 } 101 103 -
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPMultiplexerSampleTest.cs
r13160 r13163 24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 25 using HeuristicLab.Persistence.Default.Xml; 26 using HeuristicLab.Problems.DataAnalysis.Symbolic;27 using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;28 using HeuristicLab.Problems.Instances.DataAnalysis;29 26 using HeuristicLab.Selection; 30 27 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 51 48 SamplesUtils.RunAlgorithm(osga); 52 49 53 Assert.AreEqual( 0.125, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8);54 Assert.AreEqual( 0.237275390625, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8);55 Assert.AreEqual(1 .181640625, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8);56 Assert.AreEqual( 105500, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions"));50 Assert.AreEqual(1856, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8); 51 Assert.AreEqual(1784.76, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8); 52 Assert.AreEqual(1536, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8); 53 Assert.AreEqual(66900, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions")); 57 54 } 58 55 59 56 public static OffspringSelectionGeneticAlgorithm CreateGpMultiplexerSample() { 60 var instanceProvider = new RegressionCSVInstanceProvider(); 61 var regressionImportType = new RegressionImportType(); 62 regressionImportType.TargetVariable = "output"; 63 regressionImportType.TrainingPercentage = 100; 64 var dataAnalysisCSVFormat = new DataAnalysisCSVFormat(); 65 dataAnalysisCSVFormat.Separator = ','; 66 dataAnalysisCSVFormat.VariableNamesAvailable = true; 67 68 var problemData = instanceProvider.ImportData(@"Test Resources\Multiplexer11.csv", regressionImportType, dataAnalysisCSVFormat); 69 problemData.Name = "11-Multiplexer"; 70 71 var problem = new SymbolicRegressionSingleObjectiveProblem(); 57 var problem = new HeuristicLab.Problems.GeneticProgramming.Boolean.MultiplexerProblem(); 72 58 problem.Name = "11-Multiplexer Problem"; 73 problem.ProblemData = problemData; 74 problem.MaximumSymbolicExpressionTreeLength.Value = 50; 75 problem.MaximumSymbolicExpressionTreeDepth.Value = 50; 76 problem.EvaluatorParameter.Value = new SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator(); 77 problem.ApplyLinearScaling.Value = false; 78 79 80 var grammar = new FullFunctionalExpressionGrammar(); 81 problem.SymbolicExpressionTreeGrammar = grammar; 82 foreach (var symbol in grammar.Symbols) { 83 if (symbol is ProgramRootSymbol) symbol.Enabled = true; 84 else if (symbol is StartSymbol) symbol.Enabled = true; 85 else if (symbol is IfThenElse) symbol.Enabled = true; 86 else if (symbol is And) symbol.Enabled = true; 87 else if (symbol is Or) symbol.Enabled = true; 88 else if (symbol is Xor) symbol.Enabled = true; 89 else if (symbol.GetType() == typeof(Variable)) { 90 //necessary as there are multiple classes derived from Variable (e.g., VariableCondition) 91 symbol.Enabled = true; 92 var variableSymbol = (Variable)symbol; 93 variableSymbol.MultiplicativeWeightManipulatorSigma = 0.0; 94 variableSymbol.WeightManipulatorSigma = 0.0; 95 variableSymbol.WeightSigma = 0.0; 96 } else symbol.Enabled = false; 97 } 59 problem.Encoding.TreeLength = 50; 60 problem.Encoding.TreeDepth = 50; 98 61 99 62 var osga = new OffspringSelectionGeneticAlgorithm(); -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r13064 r13163 629 629 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 630 630 </None> 631 <None Include="Test Resources\Multiplexer11.csv">632 <CopyToOutputDirectory>Always</CopyToOutputDirectory>633 </None>634 631 <None Include="Test Resources\SamplesExperimentFinished.hl"> 635 632 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Note: See TracChangeset
for help on using the changeset viewer.