ReadPlot_convergence | R Documentation |
This function reads a file containing different parameter sets and ther corresponfing goodness-of-fit values
read_convergence(file="ConvergenceMeasures.txt", MinMax=NULL, beh.thr=NA,
verbose=TRUE, plot=TRUE, col=c("black", "darkolivegreen"), lty=c(1,3),
lwd=c(2,2), main="Global Optimum & Normalized Swarm Radius vs Iteration Number",
xlab="Iteration Number", ylab=c("Global Optimum", expression(delta[norm])),
pch=c(15, 18), cex=1, cex.main=1.4, cex.axis=1.2, cex.lab=1.2,
legend.pos="topright", ..., do.png=FALSE, png.width=1500, png.height=900,
png.res=90,png.fname="ConvergenceMeasures.png")
plot_convergence(x, verbose=TRUE, col=c("black", "darkolivegreen"), lty=c(1,3),
lwd=c(2,2), main="Global Optimum & Normalized Swarm Radius vs Iteration Number",
xlab="Iteration Number", ylab=c("Global Optimum", expression(delta[norm])),
pch=c(15, 18), cex=1, cex.main=1.4, cex.axis=1.2, cex.lab=1.2,
legend.pos="topright", ..., do.png=FALSE, png.width=1500, png.height=900,
png.res=90, png.fname="ConvergenceMeasures.png")
file |
character, name (including path) of the file to be read |
verbose |
logical; if TRUE, progress messages are printed |
x |
data.frame with the convergence outputs obtained with |
MinMax |
OPTIONAL |
beh.thr |
numeric, used for selecting only the behavioural parameter sets, i.e., those with a goodness-of-fit value larger/lowervalue than |
plot |
logical, indicates if a plot with the convergence measures has to be produced |
col |
OPTIONAL. Only used when |
lty |
OPTIONAL. Only used when |
lwd |
OPTIONAL. Only used when |
xlab |
OPTIONAL. Only used when |
ylab |
OPTIONAL. Only used when |
main |
OPTIONAL. Only used when |
pch |
OPTIONAL. Only used when |
cex |
OPTIONAL. Only used when |
cex.main |
OPTIONAL. Only used when |
cex.axis |
OPTIONAL. Only used when |
cex.lab |
OPTIONAL. Only used when |
legend.pos |
OPTIONAL. Only used when |
... |
OPTIONAL. Only used when |
do.png |
logical, indicates if the plot with the convergence measures has to be saved into a PNG file instead of the screen device |
png.width |
OPTIONAL. Only used when |
png.height |
OPTIONAL. Only used when |
png.res |
OPTIONAL. Only used when |
png.fname |
OPTIONAL. Only used when |
A list with the following elements:
Iter |
iteration number' |
Gbest |
global optimum for each iteration |
GbestRate |
rate of change of the global optimum (current iter/previous iter) |
IterBestFit |
best performance for the current iteration |
normSwarmRadius |
normalised swarm radious |
[gbest-mean(pbest)]/mean(pbest) |
gbest: global optimum, mean(pbest): mean values of the personal best of all the particles |
Mauricio Zambrano-Bigiarini, mzb.devel@gmail.com
read_results
, plot_results
## 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()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.