Amazing work Dimitri. However, I am running it on 2010a and the loop from line 123 takes hours. Really, I cannot see the results. And the elapsed time should not be more than 360 seconds. Have you got a clue of why is it? Best Regards, and thank you very much for your work in this file.
16 Oct 2007
Thanks, Marcelo! First, my apologies for the 'close all'; I ran the file in cell mode, where figures, though closed, remain in the HTML report. On GA, I have to confess, I myself would like to understand if there is an a priori reason for the underperformance. (I had had an uneducated notion of GA being suitable for combinatorial/sequencing tasks, but Mathworks' Rastrigin-function example gave me high hopes). For this problem, of course, any optimizer is unnecessary - just Google and code up the optimal-portfolio formula - but I will be extending the exercise with something more complicated ;)
15 Oct 2007
This is pretty neat Dimitri. Specially for teaching (that's probably will you did it).
But I have a question.
From the output, it seems to me that GA is performing worst than direct optimization, is that right ?
This sound intuitive because port optimization is a pretty simple mathematical problem and it seems to me that GA doesn't really fit the problem.
Anyway, just with direct opt, still a great submission.
Another thing, please delete the 'close all' in the end. I wanted to see the plots, not close them.