1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2008-2009 - INRIA - Michael Baudin
4 // This file must be used under the terms of the CeCILL.
5 // This source file is licensed as described in the file COPYING, which
6 // you should have received as part of this distribution. The terms
7 // are also available at
8 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11 // Test #1 : Without parameters
14 if op.Display <> [] then pause,end
15 if op.FunValCheck <> [] then pause,end
16 if op.MaxFunEvals <> [] then pause,end
17 if op.MaxIter <> [] then pause,end
18 if op.OutputFcn <> [] then pause,end
19 if op.PlotFcns <> [] then pause,end
20 if op.TolFun <> [] then pause,end
21 if op.TolX <> [] then pause,end
23 function y = myoutputfun (x)
26 function y = myplotfun (x)
30 // Test #2 : With parameters
34 "FunValCheck","on",...
37 "OutputFcn",myoutputfun,...
38 "PlotFcns",myplotfun,...
42 if op.Display <> "iter" then pause,end
43 if op.FunValCheck <> "on" then pause,end
44 if op.MaxFunEvals <> 100 then pause,end
45 if op.MaxIter <> 110 then pause,end
46 //if op.OutputFcn <> myoutputfun then pause,end
47 //if op.PlotFcns <> myplotfun then pause,end
48 if op.TolFun <> 1.e-12 then pause,end
49 if op.TolX <> 1.e-13 then pause,end
52 // Test #3 : Copy one option set into another
54 op1 = optimset ("TolFun",1.e-12);
55 op2 = optimset (op1,"TolX",1.e-13);
56 if op2.TolFun <> 1.e-12 then pause,end
57 if op2.TolX <> 1.e-13 then pause,end
61 // Test #3 : with one method name
63 op = optimset ("fminsearch");
64 if op.TolFun <> 1.e-4 then pause,end
65 if op.TolX <> 1.e-4 then pause,end
66 if op.Display <> "notify" then pause,end
67 if op.MaxFunEvals <> "200*numberofvariables" then pause,end
68 if op.MaxIter <> "200*numberofvariables" then pause,end