Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/12/17 16:49:16 (7 years ago)
Author:
abeham
Message:

#2797:

  • Fixed adaptive random topology updater
  • Adapted default values of the best attraction parameters
  • Changed code of the new topology initializer
  • Fixed the parameters of the SPSO particle updaters (c parameter is actually (personal|neighbor)bestattraction), reordered the method signature and provided defaults
  • Removed the max beyond parameter again
  • Updated the sample and updated the unit test
    • In the sample no inertia updating is used, but the topology initializers / updaters of SPSO are used
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoSchwefelSampleTest.cs

    r15181 r15214  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Encodings.RealVectorEncoding;
    28 using HeuristicLab.Optimization.Operators;
    2928using HeuristicLab.Persistence.Default.Xml;
    3029using HeuristicLab.Problems.TestFunctions;
     
    5251      SamplesUtils.RunAlgorithm(pso);
    5352      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"));
    5756        Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations"));
    5857      } 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"));
    6261        Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations"));
    6362      }
     
    8079      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)";
    8180      pso.Problem = problem;
    82       pso.Inertia.Value = 1.1;
     81      pso.Inertia.Value = 0.721;
    8382      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;
    8685      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();
    9689      pso.Seed.Value = 0;
    9790      pso.SetSeedRandomly.Value = true;
Note: See TracChangeset for help on using the changeset viewer.