02-12-2011 04:30 PM - edited 02-12-2011 04:31 PM
I need help in creating a faster tuning algorithm. My setup has two digital/integer inputs (can be called X and Y) and a double (Z) output. X and Y range from 0 to -40. My goal is to find the smallest Z value for a given X and Y. Currently I am doing this by entering 0,0 and then decrementing one (X or Y) and then seeing if the output goes up or down and adjusting accordingly. This seems a bit brute force.
So, to get a better picture I created a VI that would capture the curve or surface which is what you see in the picture (it shows a peak because I inverted the output/Z value). What I would like to do is create an algorithm that can find that peak quickly without having to generate all the samples. I am looking for some sort of 3D surface fit and interpolation but am not having success finding anything. The Conjugate Gradient nD VI seems promising but I can’t figure out how to use it. Any help is appreciated!
02-12-2011 06:14 PM
Interesting problem. I don't think the typical gradient tools will work well because your x and y are quantized to integers. I'd think it would be possible to adapt a nelder-mead type algorithm to work on a grid. I'll have a look at it... 🙂
Is the curve typically similar to your example data (exactly one minimum and the slope gettting steeper towards the minimum, relatively symmetric)?
I assume that reading the z value at a given coordinate is the time limited step while jumping to a different position is fast. If moving to a different position is the slow step, a different kind of optimization might be needed.
02-13-2011 09:11 AM
I can only assume that most devices will have a similar shape. I only have the one device that generates this surface when plotted. A bit more detail is that the 0 to -40 are actually setting registers on the device that are controlling some DAC. I am not sure if it is a literal 1:1 translation of register value to DAC output but the software the accepts X and Y values are inteters. Then I measure the Z value that is generated. Setting the register values is relitivley fast and I can jump to any value. To generate that 40x40 grid took about 10 minutes.
My current alogorith starts sampling down the X axis until I hit a minimum and then switch to the Y axis and repeat steping. With this shape it works pretty good since there is only the one minimum. But what I was looking for was to be able to take like 4 measurments at key locations and fit a surface to those points and interpolate a minimum. Go to that minimum and re-apply a fit and re-interpolate the minimum (repeat as many times to make it more accurate).
Thanks for you help,
Paul