@@ -516,24 +517,25 @@ This section illustrates the implementation of the \emph{hydroPSO} package to op
...
@@ -516,24 +517,25 @@ This section illustrates the implementation of the \emph{hydroPSO} package to op
In this section we do not aim at finding an ``optimum'' configuration for the \emph{hydroPSO} parameters, which in itself can be a massive task. Instead, we illustrate a few controlling options to handle problems such as premature convergence for (highly) multi-modal objective functions. We refer the reader to \citet{hydroPSO2012} for the results of a validation of \emph{hydroPSO} against the Standard PSO 2007 \citep{clerc2012}.
In this section we do not aim at finding an ``optimum'' configuration for the \emph{hydroPSO} parameters, which in itself can be a massive task. Instead, we illustrate a few controlling options to handle problems such as premature convergence for (highly) multi-modal objective functions. We refer the reader to \citet{hydroPSO2012} for the results of a validation of \emph{hydroPSO} against the Standard PSO 2007 \citep{clerc2012}.
\subsubsection{Optimisation of Rastrigin Function}
\subsubsection{Optimisation of Ackley Function}
\begin{enumerate}
\begin{enumerate}
\item The generalized \textbf{Rastrigin} test function (Equation~\ref{eq:rastrigin}) is non-convex, multimodal and additively separable. It has several local optima arranged in a regular lattice, but it only has one global optimum located at the point \texttt{o=(0,...,0)}. The search range for the Rastrigin function is [-5.12, 5.12] in each variable. This function is a fairly difficult problem due to its large search space and its large number of local minima. Algorithms based on gradient steepest descent will be most likely trapped in a local optima.
\item The \textbf{Ackley} test function is multimodal and separable, with several local optima that, for the search range [-32, 32], look more like noise, although they are located at regular intervals. The Ackley function only has one global optimum located at the point \texttt{o=(0,...,0)}. Complexity of the Ackley function is moderated and algorithms based on gradient steepest descent will be most likely trapped in a local optima. It is defined by:
For optimising the Rastrigin function we need to define the upper and lower limits of the search space [-5.12;5.12] and its dimensionality (D=5). Default values are used for the PSO engine (SPSO2011 method, 40 particles, 1000 maxit):
For optimising the Ackley function we need to define the upper and lower limits of the search space [-32;32] and its dimensionality (D=10). Default values are used for the PSO engine (SPSO2011 method, 40 particles, 1000 maxit):
<<>>=
<<eval=TRUE>>=
D <- 5
D <- 10
lower <- rep(-5.12,D)
lower <- rep(-32,D)
upper <- rep(5.12,D)
upper <- rep(32,D)
set.seed(100)
set.seed(1111)
hydroPSO(fn=rastrigin, lower=lower, upper=upper,
hydroPSO(fn=ackley,lower=lower,upper=upper)
control=list(write2disk=FALSE) )
@
@
In the previous example, the algorithm finished before reaching the maximum number of iterations (\Verb+maxit=1000+) because the relative tolerance was reached (by default, \Verb+reltol=1E-8+).
In the previous example, the algorithm finished before reaching the maximum number of iterations (\Verb+maxit=1000+) because the relative tolerance was reached (by default, \Verb+reltol=1E-8+).
...
@@ -541,15 +543,18 @@ In the previous example, the algorithm finished before reaching the maximum numb
...
@@ -541,15 +543,18 @@ In the previous example, the algorithm finished before reaching the maximum numb
\item Using less particles (i.e. less number of model runs) to get a global optimum similar to the previous one, using a lower relative tolerance (\Verb+reltol=1E-9+)
\item Using less particles (i.e. less number of model runs) to get a global optimum similar to the previous one, using a lower relative tolerance (\Verb+reltol=1E-9+)
Here we report results directly to the R graphical device. Using the option \Verb+do.png=TRUE+ the graphical output is directed to \Verb+png+ files stored in \Verb+./PSO.out/pngs/+. Setting \Verb+do.pairs=TRUE+ we allow the creation of a matrix plot summarizing the interaction among parameters (cross-correlation, histograms, and statistical significance of the correlation). Results produced are shown in Figures~\ref{fig:convmeas}-\ref{fig:velsperrun}.
Here we report results directly to the R graphical device. Using the option \Verb+do.png=TRUE+ the graphical output is directed to \Verb+png+ files stored in \Verb+./PSO.out/pngs/+. Setting \Verb+do.pairs=TRUE+ we allow the creation of a matrix plot summarizing the interaction among parameters (cross-correlation, histograms, and statistical significance of the correlation). Results produced are shown in Figures~\ref{fig:convmeas}-\ref{fig:velsperrun}.
Figure~\ref{fig:convmeas}, shows the evolution of the global optimum and the Normalized Swarm Radius (NSR). The latter indicates the convergence of the swarm to the (optimum) attraction zone. Assessment of both Global Optimum and NSR is particularly useful when the regrouping strategy used to tackle premature convergence is activated (\Verb+use.RG=TRUE+).
Figure~\ref{fig:convmeas}, shows the evolution of the global optimum and the Normalized Swarm Radius (NSR). The latter indicates the convergence of the swarm to the (optimum) attraction zone. Assessment of both Global Optimum and NSR is particularly useful when the regrouping strategy used to tackle premature convergence is activated (\Verb+use.RG=TRUE+).
...
@@ -566,10 +571,6 @@ Figure~\ref{fig:hist} shows the histograms of parameters. As in Figures~\ref{fig
...
@@ -566,10 +571,6 @@ Figure~\ref{fig:hist} shows the histograms of parameters. As in Figures~\ref{fig
Finally, Figures~\ref{fig:gofperiter},~\ref{fig:paramsperrun} and~\ref{fig:velsperrun} provide detailed information about the evolution of the goodness-of-fit function per iteration for each particle defined in the swarm, and particles' positions and velocities versus function (model) evaluation, respectively.
Finally, Figures~\ref{fig:gofperiter},~\ref{fig:paramsperrun} and~\ref{fig:velsperrun} provide detailed information about the evolution of the goodness-of-fit function per iteration for each particle defined in the swarm, and particles' positions and velocities versus function (model) evaluation, respectively.
\subsubsection{Optimisation of Rastrigin Function}
\begin{enumerate}
\item The generalized \textbf{Rastrigin} test function (Equation~\ref{eq:rastrigin}) is non-convex, multimodal and additively separable. It has several local optima arranged in a regular lattice, but it only has one global optimum located at the point \texttt{o=(0,...,0)}. The search range for the Rastrigin function is [-5.12, 5.12] in each variable. This function is a fairly difficult problem due to its large search space and its large number of local minima. Algorithms based on gradient steepest descent will be most likely trapped in a local optima.
For optimising the Rastrigin function we need to define the upper and lower limits of the search space [-5.12;5.12] and its dimensionality (D=5). Default values are used for the PSO engine (SPSO2011 method, 40 particles, 1000 maxit):
<<>>=
D <- 5
lower <- rep(-5.12,D)
upper <- rep(5.12,D)
set.seed(100)
hydroPSO(fn=rastrigin, lower=lower, upper=upper,
control=list(write2disk=FALSE) )
@
In the previous example, the algorithm finished before reaching the maximum number of iterations (\Verb+maxit=1000+) because the relative tolerance was reached (by default, \Verb+reltol=1E-8+).
\item Using less particles (i.e. less number of model runs) to get a global optimum similar to the previous one, using a lower relative tolerance (\Verb+reltol=1E-9+)
<<eval=TRUE>>=
set.seed(1111)
hydroPSO(fn=rastrigin,lower=lower,upper=upper,
control=list(npart=20, reltol=1E-9) )
@
\end{enumerate}
\subsubsection{Optimisation of Griewank Function}
\subsubsection{Optimisation of Griewank Function}
Another commonly used benchmark is the Griewank function (Equation~\ref{eq:griewank}). This is similar to the Rastrigin function and shows a series of regularly distributed local optima, which makes the optimisation extremely challenging.
Another commonly used benchmark is the Griewank function (Equation~\ref{eq:griewank}). This is similar to the Rastrigin function and shows a series of regularly distributed local optima, which makes the optimisation extremely challenging.
% The previous 3 lines ware neccessary to avoid the following error: "Error in driver$finish(drobj) : the output file 'MyDocument.tex' has disappeared". From: http://r.789695.n4.nabble.com/Sweave-problem-after-R-update-version-td4566044.html
% The previous 3 lines ware neccessary to avoid the following error: "Error in driver$finish(drobj) : the output file 'MyDocument.tex' has disappeared". From: http://r.789695.n4.nabble.com/Sweave-problem-after-R-update-version-td4566044.html