View Issue Details

IDProjectCategoryView StatusLast Update
0028271Open CASCADEOCCT:Modeling Datapublic2021-08-29 18:53
ReporterssvAssigned Tomsv  
Status newResolutionopen 
Target Version7.7.0 
Summary0028271: Remarks to math_PSO usability
DescriptionThis is to share my experience with PSO tool from math.

1a) It is not clear how to distribute particles. I was expecting that particles follow uniform distribution by default in the search space, but this does not happen. The client code is bothered with the necessity of such distribution. I understand that in some cases (like extrema) the distribution of particles is dictated by the specifics of an objective function. But for a general purpose we should follow [1] (since we refer to this work in the comments).

1b) Even if the user is forced to distribute particles manually, just assigning positions to them is not enough. It is also required to initialize BestPosition which is a bit weird (see code snippet below).

1c) If we had a default distribution strategy for particles, then, I guess, we can have a default instance of math_PSOParticlesPool structure not to bother the client code with creating it.

To summarize 1a), 1b), and 1c), we lack default initialization strategy for particles, don't we?

2) Each particle stores the best function value in "Distance" field. "Distance" keyword cannot be used since PSO is abstract, and the extrema is just one of its application. "Fitness" and "BestFitness" are better terms.

3) I failed to understand the meaning of the following arguments in PSO:

- const math_Vector& theSteps (ctor).
- Standard_Real& theValue (Perform() method).

It required digging into the code to clarify what is "theValue" and "theSteps". Probably, "theSteps" can be made optional? Notice that if "theSteps" is used for termination, then there is some strange calibration in the code "aTerminationVelocity = mySteps / 2048.0" which looks pretty unclear.

4) Why PSO_Particle uses double* and not math_Vector? It seems to be inconsistent with the signature of PSO.

5) Why the weights of social and cognitive determinants are hard-coded? My experiments show that with such values PSO may diverge in terms of particle locations (not all particles sit in the same minimum). I wanted to adjust these weights, but it is not possible.

Example (showing how tricky it is to run minimization for y = f(x)):

  // Number of particles
  const int numParticles = 30;

  // Inputs
  math_Vector xMin(1, 1), xMax(1, 1);
  xMin(1) = 0.0;
  xMax(1) = 100.0;
  math_Vector xStep(1, 1), xDelta(1, 1);
  xStep = (xMax - xMin)*0.01;
  xDelta = (xMax - xMin)/numParticles;

  // Structure which stores and manages particles
  math_PSOParticlesPool psoPool(numParticles, 1);

  // Choose initial positions for particles
  for ( int i = 0; i < numParticles; ++i )
    math_Vector x = xMin + i*xDelta;

    PSO_Particle* pParticle = psoPool.GetParticle(i + 1);
    pParticle->Position[0] = x(1);
    pParticle->BestPosition[0] = pParticle->Position[0];

  // Prepare objective function
  AverageDistFunc objFunc(...);

  // Outputs
  math_Vector xOut(1, 1);

  // Run optimization
  double value;
  math_PSO PSO(&objFunc, xMin, xMax, xStep);
  PSO.Perform(psoPool, numParticles, value, xOut);


[1] Vaz, Vicente. A particle swarm pattern search method for bound constrained global optimization // Journal of Global Optimization. 2007
TagsNo tags attached.
Test case number


There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2016-12-23 11:53 ssv New Issue
2016-12-23 11:53 ssv Assigned To => msv
2017-07-20 15:30 msv Target Version 7.2.0 => 7.3.0
2017-12-05 17:01 msv Target Version 7.3.0 => 7.4.0
2019-08-12 16:37 msv Target Version 7.4.0 => 7.5.0
2020-09-14 22:56 msv Target Version 7.5.0 => 7.6.0
2021-08-29 18:53 msv Target Version 7.6.0 => 7.7.0