Migrating from PROC NLP to PROC OPTMODEL


The OPTMODEL procedure comprises the powerful OPTMODEL modeling language and state-of-the-art solvers for several classes of mathematical programming problems. You can use the nonlinear solvers in PROC OPTMODEL to solve nonlinear mathematical programming problems that were previously solved with PROC NLP.

Here are some advantages to using PROC OPTMODEL over PROC NLP:

For further discussion, see this SAS Global Forum paper.

This example illustrates solving a nonlinear mathematical programming problem with PROC NLP versus PROC OPTMODEL. The Bard function is a least squares problem with n=3 parameters and m=15 functions:

where

with , , , and

The minimum function value E is at the point . The starting point is used.

data bard;
   input r @@;
   w1 = 16. - _n_;
   w2 = min(_n_ , 16. - _n_);
   datalines;
 .14 .18 .22 .25 .29 .32 .35 .39 .37 .58 .73 .96 1.34 2.10 4.39
;
proc nlp data=bard tech=levmar;
   lsq y; parms x1-x3 = 1.;
   y = r - (x1 + _obs_ / (w1 * x2 + w2 * x3));
   run;

Formulation in PROC OPTMODEL:

proc optmodel;
   set S = 1..15;
   number u{k in S} = k;
   number v{k in S} = 16 - k;
   number w{k in S} = min(u[k], v[k]);
   number y{S} = [ .14 .18 .22 .25 .29 .32 .35 .39 .37 .58 .73 .96 1.34 2.10 4.39 ];
   var x{1..3} init 1;
   min f = 0.5*sum{k in S} ( y[k] - ( x[1] + u[k]/(v[k]*x[2] + w[k]*x[3]) ) )^2;
   solve with nlpc / printfreq=1;
   print x;
   quit;