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/SPSO2011ParticleUpdater.cs

    r15181 r15214  
    4141    #endregion
    4242   
    43     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) {
     43    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) {
    4444      var gravity = new double[velocity.Length];
    4545      var direction = new RealVector(velocity.Length);
     
    4949
    5050      for (int i = 0; i < velocity.Length; i++) {
    51         var g_id = c * ((personalBest[i] + neighborBest[i] - 2 * position[i]) / 3.0);
     51        var g_id = (personalBestAttraction * personalBest[i]
     52          + neighborBestAttraction * neighborBest[i]
     53          - position[i] * (neighborBestAttraction + personalBestAttraction)) / 3.0;
    5254        // center of the hyper-sphere
    5355        gravity[i] = g_id + position[i];
     
    108110      var neighborBest = NeighborBestParameter.ActualValue;
    109111      var neighborBestAttraction = NeighborBestAttractionParameter.ActualValue.Value;
    110       var maxBeyond = MaxBeyondBestParameter.ActualValue.Value;
    111112
    112       UpdateVelocity(random, velocity, maxVelocity, position, inertia, personalBest, personalBestAttraction, neighborBest, neighborBestAttraction, maxBeyond);
     113      UpdateVelocity(random, velocity, position, personalBest, neighborBest, inertia, personalBestAttraction, neighborBestAttraction, maxVelocity);
    113114      UpdatePosition(bounds, velocity, position);
    114115
Note: See TracChangeset for help on using the changeset viewer.