Statistical programming, matrix languages, and more

How to create a 3D plot from optimization function

Posts: 1

How to create a 3D plot from optimization function

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?


Posts: 3,232

How to create a 3D plot from optimization function

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; **/




close results;

PROC SGPLOT data=results;

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


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

Post a Question
Discussion Stats
  • 1 reply
  • 2 in conversation