Index: /trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj (revision 15222)
+++ /trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj (revision 15223)
@@ -129,5 +129,4 @@
-
@@ -152,4 +151,5 @@
+
Index: /trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs
===================================================================
--- /trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs (revision 15222)
+++ /trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs (revision 15223)
@@ -134,5 +134,5 @@
private void FillGroupLookup() {
var standardProblems = new List { "ALPSGA_TSP", "ES_Griewank", "OSES_Griewank", "GA_Grouping", "GA_TSP", "GA_VRP", "GE_ArtificialAnt",
- "IslandGA_TSP", "LS_Knapsack", "PSO_Schwefel", "RAPGA_JSSP",
+ "IslandGA_TSP", "LS_Knapsack", "PSO_Rastrigin", "RAPGA_JSSP",
"SA_Rastrigin", "SGP_SantaFe", "GP_Multiplexer", "SGP_Robocode", "SS_VRP", "TS_TSP", "TS_VRP", "VNS_OP", "VNS_TSP", "GA_BPP"
};
Index: /trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoRastriginSampleTest.cs
===================================================================
--- /trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoRastriginSampleTest.cs (revision 15223)
+++ /trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoRastriginSampleTest.cs (revision 15223)
@@ -0,0 +1,91 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.IO;
+using System.Linq;
+using HeuristicLab.Algorithms.ParticleSwarmOptimization;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Persistence.Default.Xml;
+using HeuristicLab.Problems.TestFunctions;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Tests {
+ [TestClass]
+ public class PsoSchwefelSampleTest {
+ private const string SampleFileName = "PSO_Rastrigin";
+
+ [TestMethod]
+ [TestCategory("Samples.Create")]
+ [TestProperty("Time", "medium")]
+ public void CreatePsoRastriginSampleTest() {
+ var pso = CreatePsoRastriginSample();
+ string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
+ XmlGenerator.Serialize(pso, path);
+ }
+ [TestMethod]
+ [TestCategory("Samples.Execute")]
+ [TestProperty("Time", "medium")]
+ public void RunPsoRastriginSampleTest() {
+ var pso = CreatePsoRastriginSample();
+ pso.SetSeedRandomly.Value = false;
+ SamplesUtils.RunAlgorithm(pso);
+ if (Environment.Is64BitProcess) {
+ Assert.AreEqual(0, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
+ Assert.AreEqual(3.9649516110677525, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));
+ Assert.AreEqual(25.566430359483757, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));
+ Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations"));
+ } else {
+ Assert.AreEqual(0, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
+ Assert.AreEqual(3.3957460831564048, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));
+ Assert.AreEqual(34.412788077766145, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));
+ Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations"));
+ }
+ }
+
+ private ParticleSwarmOptimization CreatePsoRastriginSample() {
+ ParticleSwarmOptimization pso = new ParticleSwarmOptimization();
+ #region Problem Configuration
+ var problem = new SingleObjectiveTestFunctionProblem();
+ var provider = new SOTFInstanceProvider();
+ problem.Load(provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name == "Rastrigin Function")));
+ problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator();
+ #endregion
+ #region Algorithm Configuration
+ pso.Name = "Particle Swarm Optimization - Rastrigin";
+ pso.Description = "A particle swarm optimization algorithm which solves the 2-dimensional Rastrigin test function.";
+ pso.Problem = problem;
+ pso.Inertia.Value = 0.721;
+ pso.MaxIterations.Value = 200;
+ pso.NeighborBestAttraction.Value = 1.193;
+ pso.PersonalBestAttraction.Value = 1.193;
+ pso.SwarmSize.Value = 40;
+
+ pso.TopologyInitializer = pso.TopologyInitializerParameter.ValidValues.OfType().First();
+ pso.TopologyUpdater = pso.TopologyUpdaterParameter.ValidValues.OfType().First();
+ pso.Seed.Value = 0;
+ pso.SetSeedRandomly.Value = true;
+ #endregion
+ pso.Engine = new ParallelEngine.ParallelEngine();
+ return pso;
+ }
+ }
+}
Index: unk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoSchwefelSampleTest.cs
===================================================================
--- /trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoSchwefelSampleTest.cs (revision 15222)
+++ (revision )
@@ -1,96 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see .
- */
-#endregion
-
-using System;
-using System.IO;
-using System.Linq;
-using HeuristicLab.Algorithms.ParticleSwarmOptimization;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.RealVectorEncoding;
-using HeuristicLab.Persistence.Default.Xml;
-using HeuristicLab.Problems.TestFunctions;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace HeuristicLab.Tests {
- [TestClass]
- public class PsoSchwefelSampleTest {
- private const string SampleFileName = "PSO_Schwefel";
-
- [TestMethod]
- [TestCategory("Samples.Create")]
- [TestProperty("Time", "medium")]
- public void CreatePsoSchwefelSampleTest() {
- var pso = CreatePsoSchwefelSample();
- string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
- XmlGenerator.Serialize(pso, path);
- }
- [TestMethod]
- [TestCategory("Samples.Execute")]
- [TestProperty("Time", "medium")]
- public void RunPsoSchwefelSampleTest() {
- var pso = CreatePsoSchwefelSample();
- pso.SetSeedRandomly.Value = false;
- SamplesUtils.RunAlgorithm(pso);
- if (Environment.Is64BitProcess) {
- Assert.AreEqual(-1.4779288903810084E-12, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
- Assert.AreEqual(189.28837949705971, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));
- Assert.AreEqual(1195.4166822158872, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));
- Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations"));
- } else {
- Assert.AreEqual(-1.4779288903810084E-12, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
- Assert.AreEqual(189.28837949705971, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));
- Assert.AreEqual(1195.4166822158873, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));
- Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations"));
- }
- }
-
- private ParticleSwarmOptimization CreatePsoSchwefelSample() {
- ParticleSwarmOptimization pso = new ParticleSwarmOptimization();
- #region Problem Configuration
- var problem = new SingleObjectiveTestFunctionProblem();
- problem.BestKnownQuality.Value = 0.0;
- problem.BestKnownSolutionParameter.Value = new RealVector(new double[] { 420.968746, 420.968746 });
- problem.Bounds = new DoubleMatrix(new double[,] { { -500, 500 } });
- problem.EvaluatorParameter.Value = new SchwefelEvaluator();
- problem.Maximization.Value = false;
- problem.ProblemSize.Value = 2;
- problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator();
- #endregion
- #region Algorithm Configuration
- pso.Name = "Particle Swarm Optimization - Schwefel";
- 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)";
- pso.Problem = problem;
- pso.Inertia.Value = 0.721;
- pso.MaxIterations.Value = 200;
- pso.NeighborBestAttraction.Value = 1.193;
- pso.PersonalBestAttraction.Value = 1.193;
- pso.SwarmSize.Value = 40;
-
- pso.TopologyInitializer = pso.TopologyInitializerParameter.ValidValues.OfType().First();
- pso.TopologyUpdater = pso.TopologyUpdaterParameter.ValidValues.OfType().First();
- pso.Seed.Value = 0;
- pso.SetSeedRandomly.Value = true;
- #endregion
- pso.Engine = new ParallelEngine.ParallelEngine();
- return pso;
- }
- }
-}