help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wish to avoid multiple for loops, but don't know how to do it


From: Brad Ridder
Subject: Re: Wish to avoid multiple for loops, but don't know how to do it
Date: Thu, 19 May 2011 15:44:49 -0400

I am not particularly interested in using grid search for practical purposes; the purpose is to compare grid search with better methods (e.g. simulated annealing, genetic algorithm, etc.).
The point is to compare the performance of simulated annealing with grid search in terms of accuracy and run time.
The toy functions I am using are indeed very hilly.

Thank you very much for your time,

-Brad Ridder

On Thu, May 19, 2011 at 3:00 PM, Doug Stewart <address@hidden> wrote:


On Thu, May 19, 2011 at 1:43 PM, clustro <address@hidden> wrote:
Hello everyone,

I am trying to write a grid search algorithm for optimization. It would
evaluate an objective function over all the possible points on the grid, and
return the minimum value and its location.

I was able to do this easily for a 4-dimensional function. This needed four
nested for loops. This solution however, its not elegantly scalable to a
20-dimensional function.

For example, let's say the search domain over any search direction is -10 to
10, with some grid resolution. To do it for a 4-dimensional function, I
used:

for i = 1:N
       for j = 1:N
               for k = 1:N
                       for l = 1:N
                               xPoint = [x(i) x(j) x(k) x(l)]';
                               fEval_x = colville(xPoint);
                               if fEval_x < fmin
                                       fmin = fEval_x;
                                       xmin = xPoint;
                               endif
                       endfor
               endfor
       endfor
endfor

Where colville() is an optimization toy function.

Does anyone have a suggestion on how to avoid 20 nested for loops when
trying to scale this algorithm up to higher dimensions?

Thanks a bunch,

-Brad Ridder

--
V

Why do every point?
Is the the function smooth of hilly in each dimension?  
Are there lots of local minimums?

das




--
Bradley James Ridder
Chakrabart Group
Graduate Student
School of Chemical Engineering
Purdue University



reply via email to

[Prev in Thread] Current Thread [Next in Thread]