Changeset 15223 for trunk/sources
- Timestamp:
- 07/13/17 10:21:43 (7 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 1 deleted
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
r15003 r15223 129 129 <EmbeddedResource Include="Documents\SGP_SymbReg.hl" /> 130 130 <EmbeddedResource Include="Documents\VNS_TSP.hl" /> 131 <EmbeddedResource Include="Documents\PSO_Schwefel.hl" />132 131 <EmbeddedResource Include="Documents\SS_VRP.hl" /> 133 132 <EmbeddedResource Include="Documents\RAPGA_JSSP.hl" /> … … 152 151 <EmbeddedResource Include="Documents\OSES_Griewank.hl" /> 153 152 <EmbeddedResource Include="Documents\SGP_Robocode.hl" /> 153 <EmbeddedResource Include="Documents\PSO_Rastrigin.hl" /> 154 154 <None Include="Plugin.cs.frame" /> 155 155 <Compile Include="ChangeNestingLevelDialog.cs"> -
trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs
r14204 r15223 134 134 private void FillGroupLookup() { 135 135 var standardProblems = new List<string> { "ALPSGA_TSP", "ES_Griewank", "OSES_Griewank", "GA_Grouping", "GA_TSP", "GA_VRP", "GE_ArtificialAnt", 136 "IslandGA_TSP", "LS_Knapsack", "PSO_ Schwefel", "RAPGA_JSSP",136 "IslandGA_TSP", "LS_Knapsack", "PSO_Rastrigin", "RAPGA_JSSP", 137 137 "SA_Rastrigin", "SGP_SantaFe", "GP_Multiplexer", "SGP_Robocode", "SS_VRP", "TS_TSP", "TS_VRP", "VNS_OP", "VNS_TSP", "GA_BPP" 138 138 }; -
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoRastriginSampleTest.cs
r15222 r15223 24 24 using System.Linq; 25 25 using HeuristicLab.Algorithms.ParticleSwarmOptimization; 26 using HeuristicLab.Data;27 26 using HeuristicLab.Encodings.RealVectorEncoding; 28 27 using HeuristicLab.Persistence.Default.Xml; … … 33 32 [TestClass] 34 33 public class PsoSchwefelSampleTest { 35 private const string SampleFileName = "PSO_ Schwefel";34 private const string SampleFileName = "PSO_Rastrigin"; 36 35 37 36 [TestMethod] 38 37 [TestCategory("Samples.Create")] 39 38 [TestProperty("Time", "medium")] 40 public void CreatePso SchwefelSampleTest() {41 var pso = CreatePso SchwefelSample();39 public void CreatePsoRastriginSampleTest() { 40 var pso = CreatePsoRastriginSample(); 42 41 string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension); 43 42 XmlGenerator.Serialize(pso, path); … … 46 45 [TestCategory("Samples.Execute")] 47 46 [TestProperty("Time", "medium")] 48 public void RunPso SchwefelSampleTest() {49 var pso = CreatePso SchwefelSample();47 public void RunPsoRastriginSampleTest() { 48 var pso = CreatePsoRastriginSample(); 50 49 pso.SetSeedRandomly.Value = false; 51 50 SamplesUtils.RunAlgorithm(pso); 52 51 if (Environment.Is64BitProcess) { 53 Assert.AreEqual( -1.4779288903810084E-12, SamplesUtils.GetDoubleResult(pso, "BestQuality"));54 Assert.AreEqual( 189.28837949705971, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));55 Assert.AreEqual( 1195.4166822158872, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));52 Assert.AreEqual(0, SamplesUtils.GetDoubleResult(pso, "BestQuality")); 53 Assert.AreEqual(3.9649516110677525, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality")); 54 Assert.AreEqual(25.566430359483757, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality")); 56 55 Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations")); 57 56 } else { 58 Assert.AreEqual( -1.4779288903810084E-12, SamplesUtils.GetDoubleResult(pso, "BestQuality"));59 Assert.AreEqual( 189.28837949705971, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));60 Assert.AreEqual( 1195.4166822158873, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));57 Assert.AreEqual(0, SamplesUtils.GetDoubleResult(pso, "BestQuality")); 58 Assert.AreEqual(3.3957460831564048, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality")); 59 Assert.AreEqual(34.412788077766145, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality")); 61 60 Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations")); 62 61 } 63 62 } 64 63 65 private ParticleSwarmOptimization CreatePso SchwefelSample() {64 private ParticleSwarmOptimization CreatePsoRastriginSample() { 66 65 ParticleSwarmOptimization pso = new ParticleSwarmOptimization(); 67 66 #region Problem Configuration 68 67 var problem = new SingleObjectiveTestFunctionProblem(); 69 problem.BestKnownQuality.Value = 0.0; 70 problem.BestKnownSolutionParameter.Value = new RealVector(new double[] { 420.968746, 420.968746 }); 71 problem.Bounds = new DoubleMatrix(new double[,] { { -500, 500 } }); 72 problem.EvaluatorParameter.Value = new SchwefelEvaluator(); 73 problem.Maximization.Value = false; 74 problem.ProblemSize.Value = 2; 68 var provider = new SOTFInstanceProvider(); 69 problem.Load(provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name == "Rastrigin Function"))); 75 70 problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator(); 76 71 #endregion 77 72 #region Algorithm Configuration 78 pso.Name = "Particle Swarm Optimization - Schwefel";79 pso.Description = "A particle swarm optimization algorithm which solves the 2-dimensional Schwefel test function (based on the description in Pedersen, M.E.H. (2010). PhD thesis. University of Southampton)";73 pso.Name = "Particle Swarm Optimization - Rastrigin"; 74 pso.Description = "A particle swarm optimization algorithm which solves the 2-dimensional Rastrigin test function."; 80 75 pso.Problem = problem; 81 76 pso.Inertia.Value = 0.721;
Note: See TracChangeset
for help on using the changeset viewer.