The Unconstrained Nonlinear Programming Solver |
Example 13.2 Solving the Accumulated Rosenbrock Function
Suppose you want to solve the accumulated Rosenbrock function, which contains 100 variables. For ease of understanding the formulation, define
to be an ordered set of indices of the decision variables and
to be an ordered set of all indices in
except the last one. In other words,
The mathematical formulation of the problem is as follows:
You can use PROC OPTMODEL to solve the problem as shown in the following statements:
proc optmodel;
set setI = {1 .. 100}; /* declare index sets */
set setJ = setI diff {100};
set elementsToPrint = {1 .. 10};
var x {setI};
minimize z = sum{j in setJ} ((1 - x[j])^2 +
100*(x[j + 1] - x[j]^2)^2);
solve with nlpu / printfreq = 0;
print {k in elementsToPrint} x[k];
quit;
The Rosenbrock function has a unique global minimizer
. The optimal solution is displayed in Output 13.2.1.
Output 13.2.1
Optimal Solution to the Accumulated Rosenbrock Function
Minimization |
z |
Nonlinear |
|
100 |
0 |
0 |
0 |
100 |
0 |
|
0 |
NLPU/LBFGS |
z |
Optimal |
4.723956E-14 |
501 |
|
5.9808243E-7 |