Changeset 15214 for trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoSchwefelSampleTest.cs
- Timestamp:
- 07/12/17 16:49:16 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoSchwefelSampleTest.cs
r15181 r15214 26 26 using HeuristicLab.Data; 27 27 using HeuristicLab.Encodings.RealVectorEncoding; 28 using HeuristicLab.Optimization.Operators;29 28 using HeuristicLab.Persistence.Default.Xml; 30 29 using HeuristicLab.Problems.TestFunctions; … … 52 51 SamplesUtils.RunAlgorithm(pso); 53 52 if (Environment.Is64BitProcess) { 54 Assert.AreEqual( 2.6641411068339949E-05, SamplesUtils.GetDoubleResult(pso, "BestQuality"));55 Assert.AreEqual( 94.28800902426002, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));56 Assert.AreEqual( 992.93251114761892, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));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")); 57 56 Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations")); 58 57 } else { 59 Assert.AreEqual( 2.6641411068339949E-05, SamplesUtils.GetDoubleResult(pso, "BestQuality"));60 Assert.AreEqual( 94.28800902426002, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));61 Assert.AreEqual( 992.93251114761892, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));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")); 62 61 Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations")); 63 62 } … … 80 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)"; 81 80 pso.Problem = problem; 82 pso.Inertia.Value = 1.1;81 pso.Inertia.Value = 0.721; 83 82 pso.MaxIterations.Value = 200; 84 pso.NeighborBestAttraction.Value = 1 ;85 pso.PersonalBestAttraction.Value = 1 ;83 pso.NeighborBestAttraction.Value = 1.193; 84 pso.PersonalBestAttraction.Value = 1.193; 86 85 pso.SwarmSize.Value = 40; 87 88 var inertiaUpdater = pso.InertiaUpdaterParameter.ValidValues 89 .OfType<ExponentialDiscreteDoubleValueModifier>() 90 .Single(); 91 inertiaUpdater.EndValueParameter.Value = new DoubleValue(0.721); 92 pso.InertiaUpdater = inertiaUpdater; 93 94 pso.TopologyInitializer = null; 95 pso.TopologyUpdater = null; 86 87 pso.TopologyInitializer = pso.TopologyInitializerParameter.ValidValues.OfType<SPSORandomTopologyInitializer>().First(); 88 pso.TopologyUpdater = pso.TopologyUpdaterParameter.ValidValues.OfType<SPSOAdaptiveRandomTopologyUpdater>().First(); 96 89 pso.Seed.Value = 0; 97 90 pso.SetSeedRandomly.Value = true;
Note: See TracChangeset
for help on using the changeset viewer.