File Exchange

image thumbnail

Mean-variance portfolio optimization using GA and PATTERNSEARCH

version 1.0 (44.7 KB) by

(A not-too-serious experiment / code sample)



View License

Please see PORTOPTGADS, by following link 'Published m-files' below.
PS. The cool picture is a visualization of Rastrigin's function, taken from Genetic Algorithm and Direct Search Toolbox documentation.

Comments and Ratings (4)


Roji (view profile)


Roji (view profile)

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.

Dimitri Shvorob

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 ;)

Marcelo Perlin

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.

And yes, I also found the picture pretty cool :)




MATLAB Release
MATLAB 7.2 (R2006a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video