Resources

Solving NLP Problems With Several Local Minima (nlps5)

/********************************************************************/
/*                                                                  */
/*               S A S   S A M P L E   L I B R A R Y                */
/*                                                                  */
/*    NAME: nlps5                                                   */
/*   TITLE: Solving NLP Problems With Several Local Minima (nlps5)  */
/* PRODUCT: OR                                                      */
/*  SYSTEM: ALL                                                     */
/*    KEYS: OR                                                      */
/*   PROCS: OPTMODEL                                                */
/*    DATA:                                                         */
/*                                                                  */
/* SUPPORT:                             UPDATE:                     */
/*     REF:                                                         */
/*    MISC: Example 5 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 seed=1234 msmaxstarts=10;
   print x.init 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 seed=1234 msmaxstarts=10;
   print x;
quit;