# NOT RUN {
# Setting the user home directory as working directory
setwd("~")
# Number of dimensions to be optimised
D <- 4
# Boundaries of the search space (Sphere function)
lower <- rep(-100, D)
upper <- rep(100, D)
# Setting the seed
set.seed(100)
# Runing PSO with the 'sphere' test function, writting the results to text files
hydroPSO(
fn=sphere, lower=lower, upper=upper,
control=list(MinMax="min", write2disk=TRUE, plot=TRUE)
)
# Reading the convergence measures got by running hydroPSO
setwd("PSO.out")
read_convergence()
# }
Run the code above in your browser using DataLab