
Last chance! 50% off unlimited learning
Sale ends in
This function reads/plots the parameter values of each particle and the objective function against the iteration number
read_GofPerParticle(file="Particles_GofPerIter.txt", na.strings="NA",
plot=TRUE, ptype="one", nrows="auto", main=NULL,
xlab="Number of Iterations", cex=0.4, cex.main=1.5, cex.axis=1.7,
cex.lab=1.5, col, lty=3, ylim, verbose=TRUE, do.png=FALSE,
png.width=1500, png.height=900, png.res=90,
png.fname="Particles_GofPerIter.png")
plot_GofPerParticle(x, ptype="one", nrows="auto", main=NULL,
xlab="Number of Iterations", cex=0.4, cex.main=1.5, cex.axis=1.7,
cex.lab=1.5, col=rainbow(ncol(x)), lty=3, ylim=NULL, verbose=TRUE, ...,
do.png=FALSE, png.width=1500, png.height=900, png.res=90,
png.fname="Particles_GofPerIter.png")
character, name (including path) of the file to be read
character vector, strings which are to be interpreted as NA
values. See read.table
logical, indicates if a plot with the convergence measures has to be produced
data.frame with the goodness-of-fit measure of each particle per iteration.
The number of columns in x
has to be equal to the number of particles, whereas the number of rows in x
has to be equal to the number of iterations (
(ncol(x)
= number of particles ; nrow(x)
= number of iterations)
character, representing the type of plot. Valid values are: in c("one", "many"), for plotting all the particles in the smae figure or in one windows per particle, respectively
OPTIONAL. Only used when plot=TRUE
numeric, number of rows to be used in the plotting window
If nrows
is set to auto, the number of rows is automatically computed depending on the number of columns of x
OPTIONAL. Only used when plot=TRUE
character, title for the plot
OPTIONAL. Only used when plot=TRUE
character, label for the 'x' axis
OPTIONAL. Only used when plot=TRUE
numeric, values controlling the size of text and points with respect to the default
OPTIONAL. Only used when plot=TRUE
numeric, magnification for main titles relative to the current setting of cex
OPTIONAL. Only used when plot=TRUE
numeric, magnification for axis annotation relative to the current setting of cex
OPTIONAL. Only used when plot=TRUE
numeric, magnification for x and y labels relative to the current setting of cex
OPTIONAL. Only used when plot=TRUE
character, colour to be used for drawing the lines
OPTIONAL. Only used when plot=TRUE
numeric, line type to be used
numeric with the the ‘y’ limits of the plot
logical, if TRUE, progress messages are printed
OPTIONAL. Only used when plot=TRUE
further arguments passed to the plot command or from other methods
logical, indicates if all the figures have to be saved into PNG files instead of the screen device
OPTIONAL. Only used when do.png=TRUE
numeric, width of the PNG device. See png
OPTIONAL. Only used when do.png=TRUE
numeric, height of the PNG device. See png
OPTIONAL. Only used when do.png=TRUE
numeric, nominal resolution in ppi which will be recorded in the PNG file, if a positive integer of the device. See png
OPTIONAL. Only used when do.png=TRUE
character, filename used to store the PNG file wih the dotty plots of the parameter values
read_results
, plot_results
, plot_2parOF
, plot_NparOF
, plot_ParamsPerIter
# 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 test 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(maxit=100, write2disk=TRUE, plot=TRUE) )
# Reading the convergence measures got by running hydroPSO
setwd("PSO.out")
read_GofPerParticle() # all the particles in the same window
read_GofPerParticle(ptype="many") # each particle in a different pannel
# }
Run the code above in your browser using DataLab