## Solving Unconstrained Optimization Problems (nlpse02)

```/*****************************************************************/
/*                                                               */
/*               S A S   S A M P L E   L I B R A R Y             */
/*                                                               */
/*    NAME: nlpse02                                              */
/*  TITLE: Solving Unconstrained Optimization Problems (nlpse02) */
/* PRODUCT: OR                                                   */
/*  SYSTEM: ALL                                                  */
/*    KEYS: OR                                                   */
/*   PROCS: OPTMODEL                                             */
/*    DATA:                                                      */
/*                                                               */
/* SUPPORT:                             UPDATE:                  */
/*     REF:                                                      */
/*    MISC: Example 2 from the Nonlinear Programming Solver      */
/*          chapter of Mathematical Programming.                 */
/*                                                               */
/*****************************************************************/

proc optmodel;
number N=100000;
var x{1..N} init 1.0;

minimize f = sum {i in 1..N - 1} (-4 * x[i] + 3.0)  +
sum {i in 1..N - 1} (x[i]^2 + x[N]^2)^2;

solve with nlp;
quit;

proc optmodel;
number N=100000;
var x{1..N} >= 1 <= 2;

minimize f = sum {i in 1..N - 1} cos(-0.5*x[i+1] - x[i]^2);

solve with nlp / algorithm=activeset;
quit;

```