Ignore:
Timestamp:
06/29/17 23:04:03 (3 months ago)
Author:
abeham
Message:

#2797:

  • Added SPSO 2007 and SPSO 2011 particle updaters
  • Unhide particle updater parameter
  • Changed default parameters of sample
  • Changed max velocity to very high value by default (no speed limit)
  • Adapted unit test
File:
1 edited

Legend:

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

    r15092 r15096  
    5252      SamplesUtils.RunAlgorithm(pso);
    5353      if (Environment.Is64BitProcess) {
    54         Assert.AreEqual(118.43833503632464, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
    55         Assert.AreEqual(118.43935663125784, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));
    56         Assert.AreEqual(118.44721627137812, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));
    57         Assert.AreEqual(1000, SamplesUtils.GetIntResult(pso, "Iterations"));
     54        Assert.AreEqual(2.8334909529803554E-08, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
     55        Assert.AreEqual(128.08680460446624, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));
     56        Assert.AreEqual(713.67728101375587, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));
     57        Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations"));
    5858      } else {
    59         Assert.AreEqual(118.4383350363247, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
    60         Assert.AreEqual(118.43935663125787, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));
    61         Assert.AreEqual(118.44721627137824, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));
    62         Assert.AreEqual(1000, SamplesUtils.GetIntResult(pso, "Iterations"));
     59        Assert.AreEqual(2.8334909529803554E-08, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
     60        Assert.AreEqual(128.08680460446624, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));
     61        Assert.AreEqual(713.67728101375587, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));
     62        Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations"));
    6363      }
    6464    }
     
    8080      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)";
    8181      pso.Problem = problem;
    82       pso.Inertia.Value = 10;
    83       pso.MaxIterations.Value = 1000;
    84       pso.NeighborBestAttraction.Value = 0.5;
    85       pso.PersonalBestAttraction.Value = -0.01;
    86       pso.SwarmSize.Value = 50;
     82      pso.Inertia.Value = 1.1;
     83      pso.MaxIterations.Value = 200;
     84      pso.NeighborBestAttraction.Value = 1;
     85      pso.PersonalBestAttraction.Value = 1;
     86      pso.SwarmSize.Value = 40;
    8787
    8888      var inertiaUpdater = pso.InertiaUpdaterParameter.ValidValues
    8989        .OfType<ExponentialDiscreteDoubleValueModifier>()
    9090        .Single();
    91       inertiaUpdater.StartValueParameter.Value = new DoubleValue(10);
    92       inertiaUpdater.EndValueParameter.Value = new DoubleValue(0.8);
     91      inertiaUpdater.EndValueParameter.Value = new DoubleValue(0.721);
    9392      pso.InertiaUpdater = inertiaUpdater;
    94 
    95       pso.ParticleCreator = pso.ParticleCreatorParameter.ValidValues
    96         .OfType<RealVectorParticleCreator>()
    97         .Single();
    98       var swarmUpdater = pso.SwarmUpdaterParameter.ValidValues
    99         .OfType<RealVectorSwarmUpdater>()
    100         .Single();
    101       swarmUpdater.MaxVelocityParameter.Value = new DoubleValue(20.0);
    102       swarmUpdater.FinalMaxVelocityParameter.Value = new DoubleValue(1.0);
    103       swarmUpdater.MaxVelocityScalingOperatorParameter.Value = swarmUpdater.MaxVelocityScalingOperatorParameter.ValidValues
    104         .OfType<ExponentialDiscreteDoubleValueModifier>()
    105         .Single();
    106 
     93     
    10794      pso.TopologyInitializer = null;
    10895      pso.TopologyUpdater = null;
    109       pso.SwarmUpdater = swarmUpdater;
    11096      pso.Seed.Value = 0;
    11197      pso.SetSeedRandomly.Value = true;
Note: See TracChangeset for help on using the changeset viewer.