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.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2007ParticleUpdater.cs

    r15102 r15214  
    4242    #endregion
    4343   
    44     public static void UpdateVelocity(IRandom random, RealVector velocity, double maxVelocity, RealVector position, double inertia, RealVector personalBest, double personalBestAttraction, RealVector neighborBest, double neighborBestAttraction, double c = 1.193) {
     44    public static void UpdateVelocity(IRandom random, RealVector velocity, RealVector position, RealVector personalBest, RealVector neighborBest, double inertia = 0.721, double personalBestAttraction = 1.193, double neighborBestAttraction = 1.193, double maxVelocity = double.MaxValue) {
    4545      for (int i = 0; i < velocity.Length; i++) {
    46         double r_p = random.NextDouble() * c;
    47         double r_g = random.NextDouble() * c;
     46        double r_p = random.NextDouble();
     47        double r_g = random.NextDouble();
    4848        velocity[i] =
    4949          velocity[i] * inertia +
     
    9191      var neighborBest = NeighborBestParameter.ActualValue;
    9292      var neighborBestAttraction = NeighborBestAttractionParameter.ActualValue.Value;
    93       var maxBeyond = MaxBeyondBestParameter.ActualValue.Value;
    9493
    95       UpdateVelocity(random, velocity, maxVelocity, position, inertia, personalBest, personalBestAttraction, neighborBest, neighborBestAttraction, maxBeyond);
     94      UpdateVelocity(random, velocity, position, personalBest, neighborBest, inertia, personalBestAttraction, neighborBestAttraction, maxVelocity);
    9695      UpdatePosition(bounds, velocity, position);
    9796
Note: See TracChangeset for help on using the changeset viewer.