- Timestamp:
- 02/01/15 20:30:44 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.GrammaticalOptimization/Test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Test/Test.csproj
r11850 r11851 47 47 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> 48 48 </Reference> 49 <Reference Include="HeuristicLab. Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">49 <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 50 50 <SpecificVersion>False</SpecificVersion> 51 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath> 52 </Reference> 53 <Reference Include="HeuristicLab.Problems.Instances-3.3"> 54 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath> 55 </Reference> 56 <Reference Include="HeuristicLab.Problems.Instances.DataAnalysis-3.3"> 57 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances.DataAnalysis-3.3.dll</HintPath> 51 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath> 58 52 </Reference> 59 53 <Reference Include="System" /> … … 86 80 <Project>{24408f7d-ee0f-4886-a08b-ec324d662e47}</Project> 87 81 <Name>HeuristicLab.Algorithms.Bandits</Name> 82 </ProjectReference> 83 <ProjectReference Include="..\HeuristicLab.Algorithms.GeneticProgramming\HeuristicLab.Algorithms.GeneticProgramming.csproj"> 84 <Project>{14BEC23F-63FD-4954-B8AE-E2F4962E9B57}</Project> 85 <Name>HeuristicLab.Algorithms.GeneticProgramming</Name> 88 86 </ProjectReference> 89 87 <ProjectReference Include="..\HeuristicLab.Algorithms.GrammaticalOptimization\HeuristicLab.Algorithms.GrammaticalOptimization.csproj"> -
branches/HeuristicLab.Problems.GrammaticalOptimization/Test/TestSolvers.cs
r11730 r11851 1 1 using System; 2 using HeuristicLab.Algorithms.GeneticProgramming; 2 3 using HeuristicLab.Algorithms.GrammaticalOptimization; 3 4 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 128 129 } 129 130 131 [TestMethod] 132 public void TestStandardGP() { 133 var prob = new SymbolicRegressionPoly10Problem(); 134 var rand = new Random(31415); 135 var sgp = new StandardGP(prob, rand); 136 sgp.PopulationSize = 10000; 137 sgp.MaxSolutionSize = 50; 138 sgp.MaxSolutionDepth = 20; 139 140 string bestSentence = string.Empty; 141 double bestQuality = double.NegativeInfinity; 142 143 sgp.FoundNewBestSolution += (sentence, quality) => { 144 Assert.Inconclusive(string.Format("{0:N3} {1}", quality, sentence)); 145 bestSentence = sentence; 146 bestQuality = quality; 147 }; 148 149 sgp.Run(100000); 150 151 Assert.AreEqual(1.0, bestQuality, 1E-6); 152 Assert.AreEqual("", bestSentence); 153 } 154 155 [TestMethod] 156 public void TestOSGP() { 157 var prob = new SymbolicRegressionPoly10Problem(); 158 var rand = new Random(31415); 159 var osgp = new OffspringSelectionGP(prob, rand); 160 osgp.PopulationSize = 1000; 161 osgp.MaxSolutionSize = 50; 162 osgp.MaxSolutionDepth = 20; 163 164 string bestSentence = string.Empty; 165 double bestQuality = double.NegativeInfinity; 166 167 osgp.FoundNewBestSolution += (sentence, quality) => { 168 Assert.Inconclusive(string.Format("{0:N3} {1}", quality, sentence)); 169 bestSentence = sentence; 170 bestQuality = quality; 171 }; 172 173 osgp.Run(100000); 174 175 Assert.AreEqual(1.0, bestQuality, 1E-6); 176 Assert.AreEqual("", bestSentence); 177 } 130 178 } 131 179 }
Note: See TracChangeset
for help on using the changeset viewer.