[scilab-Users] false results in Rosenbrock equation

Carrico, Paul paul.carrico at esterline.com
Tue Jan 18 09:30:03 CET 2011


Dear Michaël,
 
I understand now ... effectively the -maxfunevals number has to be increase to 1000 to find the good solution ..
 
... May I suggest to add a warning in the macro either if the -maxiter parameter or the -maxfunevals one is reach so that the user is conscious the solution is not necessary optimized.
 
Thanks for your help
 
Paul
 
##################################################
    - X1 optimized = 1
    - X2 optimized = 1
    - Number of iteration(s) = 362
    - Number of function evaluation(s) = 609
    - CPU = 0.90625
################################################## 
 

________________________________

De : Michaël Baudin [mailto:michael.baudin at scilab.org] 
Envoyé : mardi 18 janvier 2011 09:20
À : users at lists.scilab.org
Cc : Carrico, Paul
Objet : Re: [scilab-Users] false results in Rosenbrock equation


Hi Paul,

The status of the optimization is not good when the parameters are left to the default values :

-->neldermead_get(nm,"-status")
 ans =
maxfuneval   

This means that the maximum number of function evaluations where reached before the convergence was attained. All we need to do is to increase the maximum number of function evaluations. In order to get even closer to the optimum, we must also increase the number of iterations.

nm = neldermead_configure(nm,"-maxfunevals",200);
nm = neldermead_configure(nm,"-maxiter",200);

Once done, I get :

-->xopt = neldermead_get(nm,"-xopt")
 xopt  =
    1.0035954  
    1.0073491  

This is quite a difficult case for Nelder-Mead's algorithm. The simplex has to go through a long curved valley before reaching the zone where the function begins to behave as a quadratic function.

Rosenbrock's function has only one global minimum, at x=[1,1]. The point x=[-1,1] is not a minimum.

This is easy to check with Scilab. First, let us define the function.

    function [f,G,H] = rosenbrock(x)
        f = 100*(x(2) - x(1)^2)^2 + (1 - x(1))^2;
        
        // Calculation of the gradient G vector
        G(1) = -400*x(1)*(x(2) - x(1)^2) - 2*(1 - x(1));
        G(2) = 200*(x(2) - x(1)^2);
    
        // Calculation of the Hessian matrix
        H(1,1) = -400*x(2) + 1200*x(1)^2 + 2;
        H(1,2) = -400*x(1);
        H(2,1) = -400*x(1);
        H(2,2) = 200;
    endfunction

We get at x= [1,1] :

-->[f,G,H] = rosenbrock([1,1])
 H  =
    802.  - 400.  
  - 400.    200.  
 G  =
    0.  
    0.  
 f  =
    0.  

This means that the gradient is zero, implying that the first order conditions for unconstrained optimality are satisfied. Moreover, the eigenvalues of the Hessian matrix are positive, as shown below :

-->spec(H)
 ans  =
    0.3993608  
    1001.6006  

This implies that the local curvature of the Rosenbrock function is positive : x* is indeed a minimum.

Now, at x=[-1,1], we get :

-->[f,G,H] = rosenbrock([-1,1])
 H  =
    802.    400.  
    400.    200.  
 G  =
  - 4.  
    0.  
 f  =
    4.  

The gradient is nonzero, which means that the first order optimality conditions are not satisfied at x=[-1,1]. Rosenbrock's function is a sum of squares.

Best regards,

Michaël


Le 17/01/2011 11:18, Carrico, Paul a écrit : 

	Dear all
	 
	In the Rosenbrock equation it is well known the 2 minima are (1,1) and (-1,1) ; in the attached where I want to test several optimization macros (and basic &particular functions) I've a different result as descibed herebellow : is there a mistake in the input file or does something go wrong ?
	 
	Please note the functions inputs are as general as possible to be used with the different macros (fminsearch, optim and so on)
	 
	Paul
	 
	 
	 
	#################################################################"
	    - X1 optimized = 0.229978
	    - X2 optimized = 0.0240434
	
	 
	--------------------------------------------------------------------------------
	
	
	Le présent mail et ses pièces jointes sont confidentiels et destinés à la personne ou aux personnes visée(s) ci-dessus. Si vous avez reçu cet e-mail par erreur, veuillez contacter immédiatement l'expéditeur et effacer le message de votre système. Toute divulgation, copie ou distribution de cet e-mail est strictement interdite.
	
	This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error, please contact the sender and delete the email from your system. If you are not the named addressee you should not disseminate, distribute or copy this email.
	
	



-- 
Michaël Baudin
Ingénieur de développement
michael.baudin at scilab.org
-------------------------
Consortium Scilab - Digiteo
Domaine de Voluceau - Rocquencourt
B.P. 105 - 78153 Le Chesnay Cedex
Tel. : 01 39 63 56 87 - Fax : 01 39 63 55 94


--------------------------------------------------------------------------------


Le présent mail et ses pièces jointes sont confidentiels et destinés à la personne ou aux personnes visée(s) ci-dessus. Si vous avez reçu cet e-mail par erreur, veuillez contacter immédiatement l'expéditeur et effacer le message de votre système. Toute divulgation, copie ou distribution de cet e-mail est strictement interdite.

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error, please contact the sender and delete the email from your system. If you are not the named addressee you should not disseminate, distribute or copy this email.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20110118/64a0041f/attachment.htm>


More information about the users mailing list