BookmarkSubscribeRSS Feed
surro
Calcite | Level 5

Hi community,

I'm running a non-linear optimization in IML using NLPDD using two parameters, and would like to compare the final objective function values for many different sets of initial values (500 or so) by plotting the value as a surface.

Can anyone recommend whether the best approach is to run my optimization many times and produce a plot using the result, or to try and create the plot directly from the function itself?

If it's better to run the optimization many times, can anyone suggest a way to store the final value of the objective function in a dataset (with respective initial values), so I can leave it to run in a loop without having to check the output window after each run?

Thanks

1 REPLY 1
Rick_SAS
SAS Super FREQ

Assuming that the function has K maxima, I think that a "heat map" is a way to go.  For each initial condition, the NLP routine will converge to one of the K extrema. Label them 1, 2, 3,...K and assign them different colors. Then make a scatter plot of the inial conditions, and color each point by the extremum that it converged to.

To be concrete, suppose that your function has three maximums: m1, m2, and m3, and that you've identified these location. You choose a bunch of initial conditions on a rectangular grid and record which max each one converges to. For example, on a 11x11 integer grid, do the following:

x=.; y=.; m=.;

create results var {x y m};

do x = -5 to 5;

   do y = -5 to 5;

   /** use NLP function to find optimum, z **/

   /** if z is near m1, then m=1;

       if z is near m2, then m=2; etc; **/

      append;

   end;

end;

close results;

PROC SGPLOT data=results;

scatter x=x y=x / group=m;

run;

I have not verified that the previous code compiles/runs, but I hope this gets you started.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 903 views
  • 0 likes
  • 2 in conversation