Fix neldermead_configure test (x0 can be a row vector). 76/12576/2
Adeline CARNIS [Wed, 18 Sep 2013 09:28:00 +0000 (11:28 +0200)]
test_run('optimization', 'neldermead_configure')

Change-Id: I48f144b123aad66cbbb3a0d49d7e507b3eeef95e

scilab/modules/optimization/help/en_US/neldermead/neldermead.xml
scilab/modules/optimization/macros/optimbase/optimbase_configure.sci
scilab/modules/optimization/tests/unit_tests/neldermead/neldermead_configure.dia.ref
scilab/modules/optimization/tests/unit_tests/neldermead/neldermead_configure.tst

index f98d68c..8436b63 100644 (file)
@@ -8,7 +8,7 @@
  * This source file is licensed as described in the file COPYING, which
  * you should have received as part of this distribution.  The terms
  * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  -->
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="neldermead" xml:lang="fr">
                                                 a 1-by-1 matrix of doubles, positive, integer value,
                                                 the number of variables to optimize (default numberofvariables = 0).
                                             </para>
-                                            <para>
-                                                This does not need to be set if <literal>-x0</literal> key has been set before,
-                                                because the <literal>-x0</literal> key sets <literal>-numberofvariables</literal>
-                                                to the size of the column vector <literal>x0</literal>.
-                                            </para>
                                         </listitem>
                                     </varlistentry>
                                     <varlistentry>
index a47da92..b990ece 100644 (file)
@@ -48,8 +48,7 @@ function this = optimbase_configure (this,key,value)
                 m = n;
                 n = temp;
             else
-                errmsg = msprintf(gettext("%s: The x0 vector is expected to be a column matrix, but current shape is %d x %d"),"optimbase_configure",n,m);
-                error(errmsg);
+                error(msprintf(gettext("%s: Wrong size for x0 argument: A vector expected."),"optimbase_configure"));
             end
         end
         this.x0 = value;
index 007d177..630307d 100644 (file)
@@ -120,11 +120,15 @@ cmd = "funevals = neldermead_get(nm,''-foo'')";
 assert_checkerror(cmd,"%s: Unknown key %s",[],"optimbase_get","-foo");
 nm = neldermead_destroy(nm);
 //
-// Check that x0 is forced to be a column vector
+// Check that x0 is forced to be a vector
 nm = neldermead_new ();
 nm = neldermead_configure(nm,"-numberofvariables",2);
 cmd = "nm = neldermead_configure(nm,''-x0'',[-1.2 1.0]);";
-assert_checkerror(cmd,"%s: The x0 vector is expected to be a column matrix, but current shape is %d x %d",[],"optimbase_configure",1,2);
+nm = neldermead_destroy(nm);
+nm = neldermead_new ();
+nm = neldermead_configure(nm,"-numberofvariables",2);
+cmd = "nm = neldermead_configure(nm,''-x0'',[-1.2 1.0; 1.0 -1.2]);";
+assert_checkerror(cmd,"%s: Wrong size for x0 argument: A vector expected.", [], "optimbase_configure");
 nm = neldermead_destroy(nm);
 //
 // Check -restartstep
index d15e1cd..9aaf052 100644 (file)
@@ -132,11 +132,16 @@ assert_checkerror(cmd,"%s: Unknown key %s",[],"optimbase_get","-foo");
 nm = neldermead_destroy(nm);
 
 //
-// Check that x0 is forced to be a column vector
+// Check that x0 is forced to be a vector
 nm = neldermead_new ();
 nm = neldermead_configure(nm,"-numberofvariables",2);
 cmd = "nm = neldermead_configure(nm,''-x0'',[-1.2 1.0]);";
-assert_checkerror(cmd,"%s: The x0 vector is expected to be a column matrix, but current shape is %d x %d",[],"optimbase_configure",1,2);
+nm = neldermead_destroy(nm);
+
+nm = neldermead_new ();
+nm = neldermead_configure(nm,"-numberofvariables",2);
+cmd = "nm = neldermead_configure(nm,''-x0'',[-1.2 1.0; 1.0 -1.2]);";
+assert_checkerror(cmd,"%s: Wrong size for x0 argument: A vector expected.", [], "optimbase_configure");
 nm = neldermead_destroy(nm);
 
 //