Re: Plot vs NMaximize
- To: mathgroup at smc.vnet.net
- Subject: [mg94467] Re: Plot vs NMaximize
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sun, 14 Dec 2008 07:37:37 -0500 (EST)
On 12/12/08 at 6:55 AM, Nikolaus at rath.org (Nikolaus Rath) wrote: >Bill Rowe <readnews at sbcglobal.net> writes: >>On 12/10/08 at 4:47 AM, Nikolaus at rath.org (Nikolaus Rath) wrote: >>Quite simply with existing technology there is no practical way to >>do this. In essence, you are asking for an automated algorithm for >>finding a global maximum. That is a very tough problem. >No, you misunderstood me. I am asking for NMaximize to first sample >the function the same way plot does, and then take into account this >information when continuing with the currently used algorithms. >There was already code posted here that demonstrated this for simply >setting the starting position of NMaximize based on Plot[]. >So why isn't such code inserted into NMaxmize directly? Of course >even with this additional step NMaximize may fail to find the global >maximum, but it will certainly work better in many cases and I don't >see any cases where it would be detrimental. The issue is performance penalties. For many problems there are far more efficient algorithms for locating a minimum/maximum than sampling you function at various points on an interval. Consider finding the minima/maxima of a quadratic. Taking the derivate gives results in a linear problem easily solved to find the minimum/maximum. Far more efficient than sampling over some interval. >>You can somewhat approximate what plot does with NMaximize by >>choosing a different method for the maximization. The methods >>RandomSearch, DifferentialEvolution and SimulatedAnnealing all >>generate random samples in your coordinate space then process those >>sample points to find a maximum or minimum. You can get more >>details on these methods in the tutorial >But even with these methods, there are cases where Plot[] performs >better You still seem to be missing a critical point. Plot simply does not detect either maxima or minima on any interval for any function. It is *you* that *interprets* the resulting graphic as having minima or maxima. Since Plot *does not* detect minima/maxima there is no particular difficulty here. One of the key difficulties with a global maximization/minimization algorithm is recognizing when you have a minimum/maximum. This entire issue is unaddressed by Plot. Additionally, these methods have a variety of options that can be used to improve the likelihood they will find the minimum/maximum on the specified interval. It is up to you to use these options appropriately. Since there is no know algorithm that will always converge on a minimum/maximum for any arbitrary function, there is no way to code the problem so that *you* don't have to think about the problem and what methods/options are appropriate. Simply adding code to sample a function in the same manner as Plot does will not change this one bit. In fact, the capability of sampling the function sufficiently to ensure at least one sample will be sufficiently close to the minimum/maximum for success already exists. It is left to you to use the appropriate options so that you get the desired result.