summaryrefslogtreecommitdiffstats
path: root/scilab_doc
diff options
context:
space:
mode:
authorMichaŽl Baudin <michael.baudin@scilab.org>2009-10-08 15:12:23 +0200
committerMichaŽl Baudin <michael.baudin@scilab.org>2009-10-08 15:12:23 +0200
commit392109634cf72b298578d6a4b566655797b5a223 (patch)
treecb9ca1ab2e5580660aa47e713b894cea1bc5d94a /scilab_doc
parent4bb1945ebd78f1101123b70b55185f90d3e096b7 (diff)
parent5867a0313115ce37ceda54f580bfb82c83610f54 (diff)
downloadscilab-392109634cf72b298578d6a4b566655797b5a223.zip
scilab-392109634cf72b298578d6a4b566655797b5a223.tar.gz
Merge branch 'master' of git.scilab.org:scilab
Diffstat (limited to 'scilab_doc')
-rw-r--r--scilab_doc/neldermead/fminsearch-so.idx0
-rw-r--r--scilab_doc/neldermead/fminsearch-so.ilg4
-rw-r--r--scilab_doc/neldermead/fminsearch-so.ind0
-rw-r--r--scilab_doc/neldermead/fminsearch-so.pdfbin204275 -> 239703 bytes
-rw-r--r--scilab_doc/neldermead/fminsearch.tex95
-rw-r--r--scilab_doc/neldermead/macros.aux27
-rw-r--r--scilab_doc/neldermead/scripts/fminsearch_demo.m11
-rw-r--r--scilab_doc/neldermead/scripts/fminsearch_rosenbrock.m5
-rw-r--r--scilab_doc/neldermead/scripts/fminsearch_rosenbrock.sce7
-rw-r--r--scilab_doc/neldermead/testFminsearchOptimplotfunccountScilab.pngbin0 -> 5164 bytes
-rw-r--r--scilab_doc/neldermead/testFminsearchOptimplotfvalMatlab.pngbin6249 -> 6159 bytes
-rw-r--r--scilab_doc/neldermead/testFminsearchOptimplotfvalScilab.pngbin4682 -> 4115 bytes
-rw-r--r--scilab_doc/neldermead/testFminsearchOptimplotxMatlab.pngbin0 -> 5533 bytes
-rw-r--r--scilab_doc/neldermead/testFminsearchOptimplotxScilab.pngbin0 -> 4448 bytes
14 files changed, 130 insertions, 19 deletions
diff --git a/scilab_doc/neldermead/fminsearch-so.idx b/scilab_doc/neldermead/fminsearch-so.idx
deleted file mode 100644
index e69de29..0000000
--- a/scilab_doc/neldermead/fminsearch-so.idx
+++ /dev/null
diff --git a/scilab_doc/neldermead/fminsearch-so.ilg b/scilab_doc/neldermead/fminsearch-so.ilg
deleted file mode 100644
index cea57f1..0000000
--- a/scilab_doc/neldermead/fminsearch-so.ilg
+++ /dev/null
@@ -1,4 +0,0 @@
1This is makeindex, version 2.14 [02-Oct-2002] (kpathsea + Thai support).
2Scanning input file fminsearch-so.idx...done (0 entries accepted, 0 rejected).
3Nothing written in fminsearch-so.ind.
4Transcript written in fminsearch-so.ilg.
diff --git a/scilab_doc/neldermead/fminsearch-so.ind b/scilab_doc/neldermead/fminsearch-so.ind
deleted file mode 100644
index e69de29..0000000
--- a/scilab_doc/neldermead/fminsearch-so.ind
+++ /dev/null
diff --git a/scilab_doc/neldermead/fminsearch-so.pdf b/scilab_doc/neldermead/fminsearch-so.pdf
index 5f05ac7..22f5123 100644
--- a/scilab_doc/neldermead/fminsearch-so.pdf
+++ b/scilab_doc/neldermead/fminsearch-so.pdf
Binary files differ
diff --git a/scilab_doc/neldermead/fminsearch.tex b/scilab_doc/neldermead/fminsearch.tex
index 9209dff..4545f5e 100644
--- a/scilab_doc/neldermead/fminsearch.tex
+++ b/scilab_doc/neldermead/fminsearch.tex
@@ -301,12 +301,6 @@ precision is both these softwares is $\epsilon \approx 10^{-16}$.
301That implies that there are approximately 16 significant digits. 301That implies that there are approximately 16 significant digits.
302Therefore, the relative error on $x$, which is equivalent to 15 302Therefore, the relative error on $x$, which is equivalent to 15
303significant digits, is acceptable. 303significant digits, is acceptable.
304If we now consider the relative error on $f$, which is equivalent
305to only 8 significant digits, that may sound as a problem.
306This corresponds to the square root of the relative precision,
307because $\sqrt{\epsilon} = \approx 10^{-8}$.
308In fact, this is the best that we can expect from an optimization
309algorithm (\cite{Brent73algorithmsfor,Gill81MurrayWright}).
310 304
311Therefore, the result is as close as possible to the result produced 305Therefore, the result is as close as possible to the result produced
312by Matlab. More specifically : 306by Matlab. More specifically :
@@ -541,7 +535,7 @@ Optimization terminated:
541A close inspection at the data reveals that the two softwares produces 535A close inspection at the data reveals that the two softwares produces
542indeed the same intermediate results. 536indeed the same intermediate results.
543 537
544\subsection{Plot features} 538\subsection{Plot functions}
545 539
546In this section, we check that the plotting features of the 540In this section, we check that the plotting features of the
547\scifunction{fminsearch} function are the same. 541\scifunction{fminsearch} function are the same.
@@ -608,3 +602,90 @@ in figure \ref{fig-fminsearch-scilab-outputfun}.
608Except for the size of the dots (which can be configured in 602Except for the size of the dots (which can be configured in
609both softwares), the graphics are exactly the same. 603both softwares), the graphics are exactly the same.
610 604
605\subsection{Predefined plot functions}
606
607Several pre-defined plot functions are provided with
608the \scifunction{fminsearch} function.
609These functions are
610\begin{itemize}
611\item \scifunction{optimplotfval},
612\item \scifunction{optimplotx},
613\item \scifunction{optimplotfunccount}.
614\end{itemize}
615
616In the following Matlab script, we use the \scifunction{optimplotfval}
617pre-defined function.
618
619\lstset{language=matlabscript}
620\begin{lstlisting}
621% Matlab
622options = optimset('PlotFcns',@optimplotfval);
623[x fval] = fminsearch(banana , [-1.2, 1] , options)
624\end{lstlisting}
625
626The previous script produces the plot which is presented in figure
627\ref{fig-fminsearch-matlab-optimplotfval}.
628
629\begin{figure}
630\begin{center}
631\includegraphics[width=10cm]{testFminsearchOptimplotfvalMatlab.png}
632\end{center}
633\caption{Plot produced by Matlab's fminsearch, with the \scifunction{optimplotfval} function.}
634\label{fig-fminsearch-matlab-optimplotfval}
635\end{figure}
636
637The following Scilab script uses the \scifunction{optimplotfval}
638pre-defined function.
639
640\lstset{language=scilabscript}
641\begin{lstlisting}
642// Scilab
643opt = optimset ( "OutputFcn" , optimplotfval );
644[x fval] = fminsearch ( banana , [-1.2 1] , opt );
645\end{lstlisting}
646
647The previous script produces the plot which is presented in figure
648\ref{fig-fminsearch-scilab-optimplotfval}.
649
650\begin{figure}
651\begin{center}
652\includegraphics[width=10cm]{testFminsearchOptimplotfvalScilab.png}
653\end{center}
654\caption{Plot produced by Scilab's fminsearch, with the \scifunction{optimplotfval} function.}
655\label{fig-fminsearch-scilab-optimplotfval}
656\end{figure}
657
658The comparison between the figures \ref{fig-fminsearch-matlab-optimplotfval} and
659\ref{fig-fminsearch-scilab-optimplotfval} shows that the two features produce
660very similar plots. Notice that Scilab's \scifunction{fminsearch} does not
661provide the "Stop" and "Pause" buttons.
662
663The figures \ref{fig-fminsearch-scilab-optimplotx} and \ref{fig-fminsearch-scilab-optimplotfunccount}
664present the results of Scilab's \scifunction{optimplotx} and \scifunction{optimplotfunccount}
665functions.
666
667\begin{figure}
668\begin{center}
669\includegraphics[width=10cm]{testFminsearchOptimplotxScilab.png}
670\end{center}
671\caption{Plot produced by Scilab's fminsearch, with the \scifunction{optimplotx} function.}
672\label{fig-fminsearch-scilab-optimplotx}
673\end{figure}
674
675\begin{figure}
676\begin{center}
677\includegraphics[width=10cm]{testFminsearchOptimplotfunccountScilab.png}
678\end{center}
679\caption{Plot produced by Scilab's fminsearch, with the \scifunction{optimplotfunccount} function.}
680\label{fig-fminsearch-scilab-optimplotfunccount}
681\end{figure}
682
683\section{Conclusion}
684
685The current version of Scilab's \scifunction{fminsearch} provides the same algorithm
686as Matlab's \scifunction{fminsearch}. The numerical precision is the same.
687The \scifunction{optimset} and \scifunction{optimget} functions allows to configure the optimization,
688as well as the output and plotting function.
689Pre-defined plotting function allows to get a fast and nice plot of the optimization.
690
691
diff --git a/scilab_doc/neldermead/macros.aux b/scilab_doc/neldermead/macros.aux
new file mode 100644
index 0000000..5db44e4
--- /dev/null
+++ b/scilab_doc/neldermead/macros.aux
@@ -0,0 +1,27 @@
1\relax
2\@setckpt{macros}{
3\setcounter{page}{1}
4\setcounter{equation}{0}
5\setcounter{enumi}{0}
6\setcounter{enumii}{0}
7\setcounter{enumiii}{0}
8\setcounter{enumiv}{0}
9\setcounter{footnote}{0}
10\setcounter{mpfootnote}{0}
11\setcounter{part}{0}
12\setcounter{chapter}{0}
13\setcounter{section}{0}
14\setcounter{subsection}{0}
15\setcounter{subsubsection}{0}
16\setcounter{paragraph}{0}
17\setcounter{subparagraph}{0}
18\setcounter{figure}{0}
19\setcounter{table}{0}
20\setcounter{Item}{0}
21\setcounter{Hfootnote}{0}
22\setcounter{NAT@ctr}{0}
23\setcounter{lstnumber}{1}
24\setcounter{ALC@line}{0}
25\setcounter{ALC@rem}{0}
26\setcounter{ALC@depth}{0}
27}
diff --git a/scilab_doc/neldermead/scripts/fminsearch_demo.m b/scilab_doc/neldermead/scripts/fminsearch_demo.m
index 8a8c200..4b72498 100644
--- a/scilab_doc/neldermead/scripts/fminsearch_demo.m
+++ b/scilab_doc/neldermead/scripts/fminsearch_demo.m
@@ -60,19 +60,18 @@ opt = optimset('Display','iter' , 'MaxIter' , 10 );
60% Sample use of an output function 60% Sample use of an output function
61options = optimset('OutputFcn', @outfun); 61options = optimset('OutputFcn', @outfun);
62hold on 62hold on
63objfun=@(x) exp(x(1))*(4*x(1)^2+2*x(2)^2+x(1)*x(2)+2*x(2)); 63[x fval] = fminsearch(objfun, [-1.2, 1], options)
64[x fval] = fminsearch(objfun, [-1 1], options)
65hold off 64hold off
66 65
67% Sample use of a plot function : optimplotfval 66% Sample use of a plot function : optimplotfval
68options = optimset('PlotFcns',@optimplotfval); 67options = optimset('PlotFcns',@optimplotfval);
69[x ffinal] = fminsearch(@onehump,[2,1],options) 68[x ffinal] = fminsearch(banana,[-1.2, 1],options)
70 69
71% Sample use of a plot function : optimplotfval 70% Sample use of a plot function : optimplotx
72options = optimset('PlotFcns',@optimplotx); 71options = optimset('PlotFcns',@optimplotx);
73[x ffinal] = fminsearch(@onehump,[2,1],options) 72[x ffinal] = fminsearch(banana,[-1.2, 1],options)
74 73
75% Sample use of a plot function : optimplotfunccount 74% Sample use of a plot function : optimplotfunccount
76options = optimset('PlotFcns',@optimplotfunccount); 75options = optimset('PlotFcns',@optimplotfunccount);
77[x ffinal] = fminsearch(@onehump,[2,1],options) 76[x ffinal] = fminsearch(banana,[-1.2, 1],options)
78 77
diff --git a/scilab_doc/neldermead/scripts/fminsearch_rosenbrock.m b/scilab_doc/neldermead/scripts/fminsearch_rosenbrock.m
index e1a3cc4..b033ed6 100644
--- a/scilab_doc/neldermead/scripts/fminsearch_rosenbrock.m
+++ b/scilab_doc/neldermead/scripts/fminsearch_rosenbrock.m
@@ -20,7 +20,10 @@ opt = optimset('Display','iter');
20 20
21% Check that the output functions are OK 21% Check that the output functions are OK
22options = optimset('OutputFcn', @outfun); 22options = optimset('OutputFcn', @outfun);
23[x fval] = fminsearch(banana, [-1.2, 1], options) 23[x fval] = fminsearch(banana , [-1.2, 1] , options)
24 24
25% Sample use of a plot function : optimplotfval
26options = optimset('PlotFcns',@optimplotfval);
27[x fval] = fminsearch(banana , [-1.2, 1] , options)
25 28
26 29
diff --git a/scilab_doc/neldermead/scripts/fminsearch_rosenbrock.sce b/scilab_doc/neldermead/scripts/fminsearch_rosenbrock.sce
index 1029015..b7fb016 100644
--- a/scilab_doc/neldermead/scripts/fminsearch_rosenbrock.sce
+++ b/scilab_doc/neldermead/scripts/fminsearch_rosenbrock.sce
@@ -33,7 +33,12 @@ opt = optimset ( "Display" , "iter" );
33function outfun ( x , optimValues , state ) 33function outfun ( x , optimValues , state )
34 plot( x(1),x(2),'.'); 34 plot( x(1),x(2),'.');
35endfunction 35endfunction
36opt = optimset ( "OutputFcn" , outfun); 36opt = optimset ( "OutputFcn" , outfun );
37[x fval] = fminsearch ( banana , [-1.2 1] , opt );
38
39
40// Check that the optimplotfval functions is OK
41opt = optimset ( "OutputFcn" , optimplotfval );
37[x fval] = fminsearch ( banana , [-1.2 1] , opt ); 42[x fval] = fminsearch ( banana , [-1.2 1] , opt );
38 43
39 44
diff --git a/scilab_doc/neldermead/testFminsearchOptimplotfunccountScilab.png b/scilab_doc/neldermead/testFminsearchOptimplotfunccountScilab.png
new file mode 100644
index 0000000..28ca428
--- /dev/null
+++ b/scilab_doc/neldermead/testFminsearchOptimplotfunccountScilab.png
Binary files differ
diff --git a/scilab_doc/neldermead/testFminsearchOptimplotfvalMatlab.png b/scilab_doc/neldermead/testFminsearchOptimplotfvalMatlab.png
index 32f528a..8e50630 100644
--- a/scilab_doc/neldermead/testFminsearchOptimplotfvalMatlab.png
+++ b/scilab_doc/neldermead/testFminsearchOptimplotfvalMatlab.png
Binary files differ
diff --git a/scilab_doc/neldermead/testFminsearchOptimplotfvalScilab.png b/scilab_doc/neldermead/testFminsearchOptimplotfvalScilab.png
index ca1600a..8651bdb 100644
--- a/scilab_doc/neldermead/testFminsearchOptimplotfvalScilab.png
+++ b/scilab_doc/neldermead/testFminsearchOptimplotfvalScilab.png
Binary files differ
diff --git a/scilab_doc/neldermead/testFminsearchOptimplotxMatlab.png b/scilab_doc/neldermead/testFminsearchOptimplotxMatlab.png
new file mode 100644
index 0000000..9ef102a
--- /dev/null
+++ b/scilab_doc/neldermead/testFminsearchOptimplotxMatlab.png
Binary files differ
diff --git a/scilab_doc/neldermead/testFminsearchOptimplotxScilab.png b/scilab_doc/neldermead/testFminsearchOptimplotxScilab.png
new file mode 100644
index 0000000..7697c0e
--- /dev/null
+++ b/scilab_doc/neldermead/testFminsearchOptimplotxScilab.png
Binary files differ