The neldermead component does not protect under particular user-defined objectiv
Reported by Michael BAUDIN
Originally assigned to Michael BAUDIN
-- Bug description --
The neldermead component does not protect under particular user-defined objective functions.
The reason of the bug is that the user defines the function f, which is
used as a variable in the optimbase_checkshape function.
-- Scilab error message --
-->nm = neldermead_search(nm);
!--error 10000
optimbase_checkcostfun: The matrix f from costf(x0,2) has 2 rows, instead of 1.
at line 4 of function optimbase_checkshape called by :
at line 67 of function optimbase_checkcostfun called by :
at line 6 of function neldermead_startup called by :
at line 8 of function neldermead_search called by :
nm = neldermead_search(nm);
-- How to reproduce the bug --
function [ y , index ] = optimtestcase ( x , index )
y = f ( x )
endfunction
function y = f ( x )
y = x(1)^2 + x(2)^2
endfunction
//
// Test search with various error cases
//
nm = neldermead_new ();
nm = neldermead_configure(nm,"-numberofvariables",2);
nm = neldermead_configure(nm,"-function",optimtestcase);
nm = neldermead_configure(nm,"-x0",[1.0 1.0]');
nm = neldermead_search(nm);
nm = neldermead_destroy(nm);