Fork me on GitHub

pso.js is used to maximize the function f(x) = -x^2, x in [-5, 5]. The objective function, however returns asynchronously though the use of setTimeout with a small random timeout. Each x represents a call to the objective function.

Out