Is there any version of GSA (Gravitational Search Algorithm)[1] implemented with C++ or even C#?

What I found was implemented using MATLAB which is not good for me.

[1] Rashedi, Esmat, Hossein Nezamabadi-Pour, and Saeid Saryazdi. "GSA: a gravitational search algorithm." Information sciences 179.13 (2009): 2232-2248.

  • $\begingroup$ In theory you can use the GSA code in matlab, and rewrite it in C++/C#. Is that possible for you? $\endgroup$ – arc_lupus May 30 '16 at 21:35
  • $\begingroup$ What is GSA? Other users might not know the algorithm. I think that this question is off-topic here since it asks for an implementation of a particular algorithm and not about the algorithm itself. $\endgroup$ – nicoguaro Jun 9 '16 at 16:10
  • $\begingroup$ You can find a C version here: github.com/edgnik/gsa-cpu-gpu $\endgroup$ – nicoguaro Jun 9 '16 at 16:11
  • 1
    $\begingroup$ I'm voting to close this question as off-topic because it asks about a particular implementation of an algorithm. $\endgroup$ – nicoguaro Jun 9 '16 at 16:11
  • $\begingroup$ @nicoguaro I disagree -- it's a perfectly reasonable (if poorly formulated) question, which your comment seems to answer (please consider expanding on it in an answer). At most, it could be closed as "unclear what you're asking", since it's not explained why Matlab is not good. $\endgroup$ – Christian Clason Jun 9 '16 at 22:25

Doing a fast search in GitHub you can find

  1. A MATLAB implementation;
  2. A Python implementation; and
  3. A C implementation.

The algorithm described by Rashedi et al in the paper you mentioned is not strictly a gravitational search algorithm.

In their equation (7), the magnitude of the force of attraction is inversely proportional to the distance between agents.

Rashedi et al claim that they get better results with equation (7) instead of the (classically) correct inverse square law. Therefore, the descriptor "gravitational" is misleading.

For an inverse square law, the denominator should be $R^3$, not $R$, in equation (7).

  • $\begingroup$ Any idea on how to implement inequality constraints for GSA? $\endgroup$ – user5510 Dec 15 '16 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.