<< scidemo_normpdf Demonstration Toolbox scidemo_plotcmplxfun >>

Demonstration Toolbox >> Demonstration Toolbox > scidemo_optimrosenbrock

scidemo_optimrosenbrock

Compute the solution of the Rosenbrock problem

Calling Sequence

xopt = scidemo_optimrosenbrock ( x0 , doplotpoints )

Parameters

x0 :

a n-by-1 matrix of doubles, the initial guess

doplotpoints :

a 1-by-1 matrix of booleans, set to %t to plot the points during optimization

xopt :

a n-by-1 matrix of doubles, the solution

Description

Computes the solution of the Rosenbrock optimization test case. This test case has been used by H.H. Rosenbrock in 1964 and has been used extensively in the optimization bibliography.

The current function is a demonstration of the following functions.

We consider the following unconstrained optimization problem:

with the initial guess:

The global minimum of the objective function is reached at

Examples

// To see the source code of this function:
edit scidemo_optimrosenbrock
//
// 1. Define rosenbrock for contouring
function f=rosenbrockC(x1, x2)
x = [x1 x2];
f = 100.0 *(x(2)-x(1)^2)^2 + (1-x(1))^2;
endfunction
x0 = [-1.2 1.0];
xopt = [1.0 1.0];
//
// 2. Draw the contour of Rosenbrock's function
xdata = linspace(-2,2,100);
ydata = linspace(-2,2,100);
mprintf("Draw contours...\n");
scf();
contour ( xdata , ydata , rosenbrockC , [1 10 100 500 1000])
plot(x0(1) , x0(2) , "b.")
plot(xopt(1) , xopt(2) , "r*")
xtitle("The Rosenbrock Test Case","x1","x2")

// 3. Use optim to find the minimum
xopt = scidemo_optimrosenbrock ( x0 , %t );
plot(xopt(1) , xopt(2) , "g.")

Authors

Bibliography

"Unconstrained Optimality Conditions with Scilab", Michael Baudin, 2010, http://forge.scilab.org/index.php/p/docuncoptimcond

"Introduction to Optimization with Scilab", Michael Baudin, 2010, http://forge.scilab.org/index.php/p/docintroscioptim/

"An automatic method for finding the greatest or least value of a function", H. H. Rosenbrock. The Computer Journal, 3(3):175{184, March 1960.

<< scidemo_normpdf Demonstration Toolbox scidemo_plotcmplxfun >>