B |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
Algorithm: for minima Determine N (# of experiment) Determine a and b (domain [a,b]) Set fmin = 9E9 (very large value) LOOP from i=0 to N Generate a random number R from a uniform distribution Set x = a + (b-a)*R Check IF F(x) < fmin THEN fmin = F(x) xmin = x END IF END LOOP OUTPUT N, xmin, fmin |
Output: for a=1, b=5 N xmin fmin --------- -------- --------- 10 3.215880 -3.953396 100 2.974332 -3.999341 1,000 2.994102 -3.999965 10,000 3.000074 -4.000000 100,000 3.000074 -4.000000 |