Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to find a good solution with an evolution strategy for a 30 dimensional minimization problem. Now I have developed with success a simple (1,1) ES and also a self-adaptive (1,lambda)ES with one step size.

The next step is to create a (1,lambda) ES with individual stepsizes per dimension. The problem is that my matlab code doesn't work yet. I'm testing on the sphere objective function

 function f = sphere(x)
    f = sum(x.^2);
 end

The plotted results of the ES with one step size vs. the one with individual stepsizes: http://i.stack.imgur.com/hLRqI.png

The blue line is the performance of the ES with individual step sizes and the red one is for the ES with one step size.

The code for the (1,lambda) ES with multiple stepsizes

    % Strategy parameters
    tau = 1 / sqrt(2 * sqrt(N));
    tau_prime = 1 / sqrt(2 * N);
    lambda = 10;

    % Initialize
    xp = (ub - lb) .* rand(N, 1) + lb;
    sigmap = (ub - lb) / (3 * sqrt(N));
    fp = feval(fitnessfct, xp');
    evalcount = 1;

    % Evolution cycle
    while evalcount <= stopeval

        % Generate offsprings and evaluate
        for i = 1 : lambda
            rand_scalar = randn();

            for j = 1 : N
                Osigma(j,i) = sigmap(j) .* exp(tau_prime * rand_scalar + tau * randn());
            end

            O(:,i) = xp + Osigma(:,i) .* rand(N,1);
            fo(i) = feval(fitnessfct, O(:,i)');
        end

        evalcount = evalcount + lambda;

        % Select best
        [~, sortindex] = sort(fo);
        xp = O(:,sortindex(1));
        fp = fo(sortindex(1));
        sigmap = Osigma(:,sortindex(1));
 end

does anybody see the problem? Thanks

share|improve this question

1 Answer 1

Your mutations have a bias: they can only ever increase the parameters, never decrease them. sigmap is a vector of (scaled) upper minus lower bounds: all positive. exp(...) is always positive. Therefore the elements of Osigma are always positive. Then your change is Osigma .* rand(N,1), and rand(N,1) is also always positive.

Did you perhaps mean to use randn(N,1) instead of rand(N,1)? With that single-character change, I find that your code optimizes rather than pessimizing :-).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["                  <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2015 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a>                   with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2015.1.30.2257\r\n            </div>\r\n            \r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-warning\">Stack Overflow works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div>\r\n    </nos"], "copyright__copyright__copyright": [" elements of Osigma are always positive. Then your change is Osigma .* rand(N,1), and rand(N,1) is also always positive.\n\nDid you perhaps mean to use randn(N,1) instead of rand(N,1)? With that single-character change, I find that your code optimizes rather than pessimizing :-).\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}