# Prepare random number generator
set.seed(123)
# Ring topology with 5 neighbours
pso.nh(pop.n = 10, method = "ring", par = 5)
# Wheel topology
pso.nh(pop.n = 10, method = "wheel")
# Star topology
pso.nh(pop.n = 10, method = "star")
# Random topology where each particle
# randomly informs 3 other particles
pso.nh(pop.n = 10, method = "random", par = 3)
# Random2 topology wehere each particle could
# be informed by the other with probability 0.2
pso.nh(pop.n = 10, method = "random2", par = 0.2)
Run the code above in your browser using DataLab