Weve been over what GSS is in part 1 and how exactly to use GSS in part 2. Now we need to know when we can use GSS and explore a real world example. So if you noticed our example was pretty simple. The minimum could be found by simple inspection or some derivative tests. Another thing to notice is that the function had exactly one minimum, which ended up being the global minimum of the function. However, lets look what happens to our search method when we have two minimum in our interval.
Lets take a look at the function: y=x^4-6x^2+3x+7. This function has two local minimums very close to each other, one of which is the global minimum of the function. The function is plotted below.
Here you can clearly tell there are two minimum one around -2 and other other around 2. However, the minimum at -2 seems to be lower than that at 2. Lets see how our GSS tackles this problem. I am going to expand our interval to [-3,5]. This produces the following plot with each step a different color.
As you can see the GSS seems to be closing in on one of our minimum. This is one limitation of the GSS it is not a global minimum search. GSS can find a minimum but there is no guarantee that that minimum is not just a local minimum. What happens if we change our interval. I will reduce our interval to [-3.3] and run the gss again. This produces the following plot with each step a different color.
This interval produces a very different search. Simply changing the interval we search over switches which minimum the gss converges on. This is not exactly something we want to look for in a search method. However, in both intervals the method did converge to a minimum which is something we want to look for in a search method.Local vs global minimum explains a major issue with GSS. One of the main requirements for GSS is that a function must be unimodal. Now what does unimodal mean? This basically means that the function has a single local extremum. As we saw above this becomes important in terms of converging to the correct (and if unimodal, only) minimum.To review, when should be use GSS: Function has one minimum (unimodal), you have an idea of the interval that contains the minimum, the function is of one variable.Hopefully this gave you a better understanding of a basic search method. This is only the beginning. I will clean up my code and post it below, for both matlab and python. I will also post it to my github at github.com/mgric.-Marcello


The two new boundaries are shown in red. As you can see one of the green lines before is now red and the other boundary is found by the formula x3 = x2 + (1-gr)*(x1-x2). If we had chosen the other line we would need to calculate a new x4. This cold be found by x4 = x1 +(1-gr)*(x2-x1). But in this case we only need x3. We are narrowing down to the minimum, but we are still not there yet. This means we need to do another iteration.




Substituting rho for (x2-x3)/(x3-x1) and solving gives us rho = 1.61803…. or the Golden Ratio. This is where GSS gets its name from. So to come back to our main point each subsequent testing point is chosen so that the golden ratio is maintained with each new section. This allows the search range by a factor of 1-z or 0.61803 with each iteration.But how does that give us our points? Well since we know that they have to be even intervals and they must be proportional by 0.618. This is enough along with a little algebra to determine our points. x3 = x2 + (1-z)*(x1-x2) and x4 = x1 + (1-z)*(x2-x1).Now that we know how the method works we can solve our original problem. Ill save that for part two.-Marcello