<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Because solve.QP does not have MIP but Rglpk_solve_LP does, my plan has been to use the latter for illustrating MIP (unless we find a good QP solver that does MIP and integrate it, which seems unlikely in the near term).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Doug<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>P.S.  I have a project started to do a careful comparison of global minimum variance portfolios and global minimum ETL portfolios, with a focus on the impact of their different sources of estimation error (covariance matrix in the former and ETL in the latter, which are not directly comparable).  In large samples they both give the same results for normally distributed asset returns, so their finite sample differences arise from their estimation errors differences (large dimensions produce more covariance estimation error and small tail probabilities produce more ETL estimation error).  <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> gsoc-porta-bounces@lists.r-forge.r-project.org [mailto:gsoc-porta-bounces@lists.r-forge.r-project.org] <b>On Behalf Of </b>Ross Bennett<br><b>Sent:</b> Friday, July 12, 2013 12:23 PM<br><b>To:</b> PortfolioAnalytics<br><b>Subject:</b> Re: [GSoC-PortA] mixed integer constraints<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Round Lot Constraints<o:p></o:p></p></div><div><p class=MsoNormal>Just thinking through out loud how to incorporate this into fn_map. The sum of portfolio weights would still sum to near 1 for a full investment constraint. We would need a user input value of total wealth to calculate the lots.<o:p></o:p></p></div><div><p class=MsoNormal>The constraint could be specified with something like:<o:p></o:p></p></div><div><p class=MsoNormal>add.constraint(portfolio, type="round_lot", total_wealth=1500000)<o:p></o:p></p></div><div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal># randomly generate some weights<o:p></o:p></p></div><div><p class=MsoNormal>set.seed(123)<o:p></o:p></p></div><div><p class=MsoNormal>tmp <- runif(5)<o:p></o:p></p></div><div><p class=MsoNormal>w <- tmp/sum(tmp)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>total_wealth <- 1200000<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal># round the lot values to the nearest integer<o:p></o:p></p></div><div><p class=MsoNormal>lots <- round(w * total_wealth, 0)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal># calculate the new weights<o:p></o:p></p></div><div><p class=MsoNormal>new_w <- lots/sum(lots)<o:p></o:p></p></div></div><div><p class=MsoNormal><br>Am I on the right track for the round lot constraints?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Cardinality Constraints<o:p></o:p></p></div><p class=MsoNormal>I thought I had a good handle on cardinality constraints to set a limit on the maximum number of positions. This is implemented in random_portfolios by using fn_map and specifying max_pos as a position limit constraint. This is also currently working with DEoptim by using the optional function argument fnMap=fn_map. This is not doable with quadprog. This is supported in rglpk. I suppose we can use the fn_map function for the other solvers, pso and GenSA. Am I missing a different application of cardinality constraint?<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>P.S. Enjoy your trip to Alaska!<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Regards,<o:p></o:p></p></div><div><p class=MsoNormal>Ross<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Fri, Jul 12, 2013 at 10:49 AM, Brian G. Peterson <<a href="mailto:brian@braverock.com" target="_blank">brian@braverock.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal>On 07/12/2013 10:30 AM, Brian G. Peterson wrote:<o:p></o:p></p><p class=MsoNormal>I just realized that we haven't done any work on mixed integer<br>constraints, forcing weights to be round numbers.<br><br>Trivial to do in fn_map, and supported by a handful of optimization<br>solvers, but I didn't want to forget it.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>I suppose the other one to look at in this vein is cardinality constraints.<span style='color:#888888'><br><br>-- <br>Brian</span><o:p></o:p></p><div><div><p class=MsoNormal><br>_______________________________________________<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-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-project.org/cgi-bin/mailman/listinfo/gsoc-porta</a><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>