diff options
author | Michaël Baudin <michael.baudin@scilab.org> | 2009-10-08 15:12:23 +0200 |
---|---|---|
committer | Michaël Baudin <michael.baudin@scilab.org> | 2009-10-08 15:12:23 +0200 |
commit | 392109634cf72b298578d6a4b566655797b5a223 (patch) | |
tree | cb9ca1ab2e5580660aa47e713b894cea1bc5d94a /scilab_doc | |
parent | 4bb1945ebd78f1101123b70b55185f90d3e096b7 (diff) | |
parent | 5867a0313115ce37ceda54f580bfb82c83610f54 (diff) | |
download | scilab-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.idx | 0 | ||||
-rw-r--r-- | scilab_doc/neldermead/fminsearch-so.ilg | 4 | ||||
-rw-r--r-- | scilab_doc/neldermead/fminsearch-so.ind | 0 | ||||
-rw-r--r-- | scilab_doc/neldermead/fminsearch-so.pdf | bin | 204275 -> 239703 bytes | |||
-rw-r--r-- | scilab_doc/neldermead/fminsearch.tex | 95 | ||||
-rw-r--r-- | scilab_doc/neldermead/macros.aux | 27 | ||||
-rw-r--r-- | scilab_doc/neldermead/scripts/fminsearch_demo.m | 11 | ||||
-rw-r--r-- | scilab_doc/neldermead/scripts/fminsearch_rosenbrock.m | 5 | ||||
-rw-r--r-- | scilab_doc/neldermead/scripts/fminsearch_rosenbrock.sce | 7 | ||||
-rw-r--r-- | scilab_doc/neldermead/testFminsearchOptimplotfunccountScilab.png | bin | 0 -> 5164 bytes | |||
-rw-r--r-- | scilab_doc/neldermead/testFminsearchOptimplotfvalMatlab.png | bin | 6249 -> 6159 bytes | |||
-rw-r--r-- | scilab_doc/neldermead/testFminsearchOptimplotfvalScilab.png | bin | 4682 -> 4115 bytes | |||
-rw-r--r-- | scilab_doc/neldermead/testFminsearchOptimplotxMatlab.png | bin | 0 -> 5533 bytes | |||
-rw-r--r-- | scilab_doc/neldermead/testFminsearchOptimplotxScilab.png | bin | 0 -> 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 @@ | |||
1 | This is makeindex, version 2.14 [02-Oct-2002] (kpathsea + Thai support). | ||
2 | Scanning input file fminsearch-so.idx...done (0 entries accepted, 0 rejected). | ||
3 | Nothing written in fminsearch-so.ind. | ||
4 | Transcript 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}$. | |||
301 | That implies that there are approximately 16 significant digits. | 301 | That implies that there are approximately 16 significant digits. |
302 | Therefore, the relative error on $x$, which is equivalent to 15 | 302 | Therefore, the relative error on $x$, which is equivalent to 15 |
303 | significant digits, is acceptable. | 303 | significant digits, is acceptable. |
304 | If we now consider the relative error on $f$, which is equivalent | ||
305 | to only 8 significant digits, that may sound as a problem. | ||
306 | This corresponds to the square root of the relative precision, | ||
307 | because $\sqrt{\epsilon} = \approx 10^{-8}$. | ||
308 | In fact, this is the best that we can expect from an optimization | ||
309 | algorithm (\cite{Brent73algorithmsfor,Gill81MurrayWright}). | ||
310 | 304 | ||
311 | Therefore, the result is as close as possible to the result produced | 305 | Therefore, the result is as close as possible to the result produced |
312 | by Matlab. More specifically : | 306 | by Matlab. More specifically : |
@@ -541,7 +535,7 @@ Optimization terminated: | |||
541 | A close inspection at the data reveals that the two softwares produces | 535 | A close inspection at the data reveals that the two softwares produces |
542 | indeed the same intermediate results. | 536 | indeed the same intermediate results. |
543 | 537 | ||
544 | \subsection{Plot features} | 538 | \subsection{Plot functions} |
545 | 539 | ||
546 | In this section, we check that the plotting features of the | 540 | In 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}. | |||
608 | Except for the size of the dots (which can be configured in | 602 | Except for the size of the dots (which can be configured in |
609 | both softwares), the graphics are exactly the same. | 603 | both softwares), the graphics are exactly the same. |
610 | 604 | ||
605 | \subsection{Predefined plot functions} | ||
606 | |||
607 | Several pre-defined plot functions are provided with | ||
608 | the \scifunction{fminsearch} function. | ||
609 | These functions are | ||
610 | \begin{itemize} | ||
611 | \item \scifunction{optimplotfval}, | ||
612 | \item \scifunction{optimplotx}, | ||
613 | \item \scifunction{optimplotfunccount}. | ||
614 | \end{itemize} | ||
615 | |||
616 | In the following Matlab script, we use the \scifunction{optimplotfval} | ||
617 | pre-defined function. | ||
618 | |||
619 | \lstset{language=matlabscript} | ||
620 | \begin{lstlisting} | ||
621 | % Matlab | ||
622 | options = optimset('PlotFcns',@optimplotfval); | ||
623 | [x fval] = fminsearch(banana , [-1.2, 1] , options) | ||
624 | \end{lstlisting} | ||
625 | |||
626 | The 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 | |||
637 | The following Scilab script uses the \scifunction{optimplotfval} | ||
638 | pre-defined function. | ||
639 | |||
640 | \lstset{language=scilabscript} | ||
641 | \begin{lstlisting} | ||
642 | // Scilab | ||
643 | opt = optimset ( "OutputFcn" , optimplotfval ); | ||
644 | [x fval] = fminsearch ( banana , [-1.2 1] , opt ); | ||
645 | \end{lstlisting} | ||
646 | |||
647 | The 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 | |||
658 | The comparison between the figures \ref{fig-fminsearch-matlab-optimplotfval} and | ||
659 | \ref{fig-fminsearch-scilab-optimplotfval} shows that the two features produce | ||
660 | very similar plots. Notice that Scilab's \scifunction{fminsearch} does not | ||
661 | provide the "Stop" and "Pause" buttons. | ||
662 | |||
663 | The figures \ref{fig-fminsearch-scilab-optimplotx} and \ref{fig-fminsearch-scilab-optimplotfunccount} | ||
664 | present the results of Scilab's \scifunction{optimplotx} and \scifunction{optimplotfunccount} | ||
665 | functions. | ||
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 | |||
685 | The current version of Scilab's \scifunction{fminsearch} provides the same algorithm | ||
686 | as Matlab's \scifunction{fminsearch}. The numerical precision is the same. | ||
687 | The \scifunction{optimset} and \scifunction{optimget} functions allows to configure the optimization, | ||
688 | as well as the output and plotting function. | ||
689 | Pre-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 |
61 | options = optimset('OutputFcn', @outfun); | 61 | options = optimset('OutputFcn', @outfun); |
62 | hold on | 62 | hold on |
63 | objfun=@(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) | ||
65 | hold off | 64 | hold off |
66 | 65 | ||
67 | % Sample use of a plot function : optimplotfval | 66 | % Sample use of a plot function : optimplotfval |
68 | options = optimset('PlotFcns',@optimplotfval); | 67 | options = 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 |
72 | options = optimset('PlotFcns',@optimplotx); | 71 | options = 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 |
76 | options = optimset('PlotFcns',@optimplotfunccount); | 75 | options = 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 |
22 | options = optimset('OutputFcn', @outfun); | 22 | options = 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 | ||
26 | options = 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" ); | |||
33 | function outfun ( x , optimValues , state ) | 33 | function outfun ( x , optimValues , state ) |
34 | plot( x(1),x(2),'.'); | 34 | plot( x(1),x(2),'.'); |
35 | endfunction | 35 | endfunction |
36 | opt = optimset ( "OutputFcn" , outfun); | 36 | opt = optimset ( "OutputFcn" , outfun ); |
37 | [x fval] = fminsearch ( banana , [-1.2 1] , opt ); | ||
38 | |||
39 | |||
40 | // Check that the optimplotfval functions is OK | ||
41 | opt = 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 | |||