<div dir="ltr">Thanks for the suggestion, I think that makes the most sense. I'll go ahead and implement that.<div><br></div><div>Ross</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 28, 2014 at 2:49 PM, Brian G. Peterson <span dir="ltr"><<a href="mailto:brian@braverock.com" target="_blank">brian@braverock.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What about generating an rp set for each portfolio constraint set, and using the superset as the rp object passed into optimize.portfolio in the loop?<br>

<br>
I think this will automatically penalize the non-conforming portfolios (or can if we set a single parameter to do so), and the conforming portfolios will be the ones chosen on a objective value basis.<br>
<br>
Should work with a minimum of messing with the code.<br>
<br>
Regards,<br>
<br>
Brian<div><div class="h5"><br>
<br>
On 05/28/2014 04:36 PM, Ross Bennett wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
All,<br>
<br>
I am close to wrapping up adding support for regime switching as per my<br>
proposal. I added a demo so you can see an example of the functionality<br>
(see demo/regime_switching.R).<br>
<br>
There is one issue that came up that I would like some input on. The<br>
case is running optimize.portfolio.rebalancing with<br>
optimize_method="random".  If the rp object is not passed in as an<br>
argument to optimize.portfolio.<u></u>rebalancing, then we try to generate the<br>
random portfolios there so the random portfolios are not (re)generated<br>
inside the loop in optimize.portfolio.<br>
<br>
Since the regime portfolio has N portfolios for N regimes, the challenge<br>
here is knowing what portfolio to use for generating the random<br>
portfolios because the constraints could be very different in each<br>
portfolio. This only impacts optimize.portfolio.rebalancing because we<br>
do not know the portfolio specification based on the regime at the time<br>
we check the rp object. We do know inside optimize.portfolio.<br>
<br>
The check for rp in optimize.portfolio.rebalancing looks like this<br>
if(optimize_method=="random"){<br>
     if(is.null(rp))<br>
       rp<-random_portfolios(<u></u>portfolio=portfolio, permutations=search_size)<br>
   }<br>
<br>
I have a couple proposed solutions<br>
<br>
Solution 1:<br>
Require that the user pass in a random portfolios object for the rp<br>
argument. We don't try to generate random portfolios and we throw an<br>
error if rp is null. We could just use a single rp object or allow for a<br>
list of rp objects with one rp object for each regime portfolio.<br>
<br>
Solution 2:<br>
Bypass this check and let optimize.portfolio generate random portfolios<br>
for each regime at each iteration. This is flexible, but could result in<br>
very long run times.<br>
<br>
Are there any other solutions I should consider.<br>
<br>
Please let me know your thoughts on this.<br>
<br>
Thanks,<br>
Ross<br>
<br>
<br>
<br>
<br></div></div>
______________________________<u></u>_________________<br>
GSoC-PortA mailing list<br>
<a href="mailto:GSoC-PortA@lists.r-forge.r-project.org" target="_blank">GSoC-PortA@lists.r-forge.r-<u></u>project.org</a><br>
<a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta" target="_blank">http://lists.r-forge.r-<u></u>project.org/cgi-bin/mailman/<u></u>listinfo/gsoc-porta</a><br>
<br><span class="HOEnZb"><font color="#888888">
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
-- <br>
Brian G. Peterson<br>
<a href="http://braverock.com/brian/" target="_blank">http://braverock.com/brian/</a><br>
Ph: <a href="tel:773-459-4973" value="+17734594973" target="_blank">773-459-4973</a><br>
IM: bgpbraverock<br>
______________________________<u></u>_________________<br>
GSoC-PortA mailing list<br>
<a href="mailto:GSoC-PortA@lists.r-forge.r-project.org" target="_blank">GSoC-PortA@lists.r-forge.r-<u></u>project.org</a><br>
<a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta" target="_blank">http://lists.r-forge.r-<u></u>project.org/cgi-bin/mailman/<u></u>listinfo/gsoc-porta</a><br>
</font></span></blockquote></div><br></div>