[GSoC-PortA] Random Portfolios Speed Improvement with Rcpp

Ross Bennett rossbennett34 at gmail.com
Wed Nov 13 05:43:31 CET 2013


All,

Over the course of the google summer of code project, I learned a lot about
the random portfolios algorithm (among many other topics) and became quite
fascinated with the concept. I had some free time over the weekend and
decided to implement random portfolio optimization using Rcpp. My
motivation for doing this was to learn C++ and Rcpp with no expectation of
how much faster this could actually be.

Here are the results of two benchmarks I did.

This first benchmark is just generating random portfolios.

    test replications elapsed relative
1     pa             10 188.74     6.583
2 rcpp_s           10   28.67    1.000

The next benchmark is the actual optimization.

  test replications elapsed relative
1   pa            10  211.027    808.5
2 rcpp           10      0.261    1.000

I am a beginner at C++ so I am pretty sure there are further improvements
that can be made with my C++ code.

The benchmark results got me thinking that we might be able to use this in
PortfolioAnalytics. The RcppRP package I started this weekend is really
rough around the edges, but with some more improvements could serve as an
alternate optimization method for random portfolios. We could have
something like optimize.portfolio(..., optimize_method="random_rcpp") that
calls the proper functions from RcppRP.

The RcppRP package is on my github page if you are interested in looking at
the code.
https://github.com/rossb34/RcppRP

Any thoughts on if this is worth continuing to pursue? Either way I plan to
continue working on RcppRP for the sole purpose of learning C++ and Rcpp.

Regards,
Ross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/gsoc-porta/attachments/20131112/c26e35e8/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: benchmark.pdf
Type: application/pdf
Size: 51265 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/gsoc-porta/attachments/20131112/c26e35e8/attachment-0001.pdf>


More information about the GSoC-PortA mailing list