Solving NLP Problems With Several Local Minima (nlpse06)


/********************************************************************/
/*                                                                  */
/*               S A S   S A M P L E   L I B R A R Y                */
/*                                                                  */
/*     NAME: nlpse06                                                */
/*   TITLE: Solving NLP Problems With Several Local Minima (nlpse06)*/
/* PRODUCT: OR                                                      */
/*  SYSTEM: ALL                                                     */
/*    KEYS: OR                                                      */
/*   PROCS: OPTMODEL                                                */
/*    DATA:                                                         */
/*                                                                  */
/* SUPPORT:                             UPDATE:                     */
/*     REF:                                                         */
/*    MISC: Example 6 from the Nonlinear Programming Solver         */
/*          chapter of Mathematical Programming.                    */
/*                                                                  */
/********************************************************************/


proc optmodel;
   var x{i in 1..5} >= -5 <= 5 init -2;

   min f=(x[1] - 1)^2 + (x[1] - x[2])^2 + (x[2] - x[3])^3 +
         (x[3] - x[4])^4 + (x[4] - x[5])^4;

   con g1: x[1] + x[2]^2 + x[3]^3 =  2 + 3*sqrt(2);
   con g2: x[2] + x[4]   - x[3]^2 = -2 + 2*sqrt(2);
   con g3: x[1]*x[5] = 2;

   performance nthreads=4;
   solve with nlp/multistart=(maxstarts=10) seed=1234;
   print x.msinit x;
quit;


proc optmodel;
   var x{i in 1..5} >= -5 <= 5 init -2;

   min f=(x[1] - 1)^2 + (x[1] - x[2])^2 + (x[2] - x[3])^3 +
         (x[3] - x[4])^4 + (x[4] - x[5])^4;

   con g1: x[1] + x[2]^2 + x[3]^3 =  2 + 3*sqrt(2);
   con g2: x[2] + x[4]   - x[3]^2 = -2 + 2*sqrt(2);
   con g3: x[1]*x[5] = 2;

   performance nodes=4 nthreads=4;
   solve with nlp/multistart=(maxstarts=10) seed=1234;
   print x;
quit;