在Matlab中使用遗传算法选择一个股票子集

时间:2016-01-12 20:03:12

标签: matlab genetic-algorithm

我想从一组可能的给定股票中选择10只股票,这些股票应该给予一定的权重,而剩下的应该给予零权重。我已经阅读了协方差矩阵并从文件中返回。我的代码是

<map name="Map" id="Map">
 <area alt="" title="" href="#" shape="poly" coords="248,165,275,136,
  316,127,327,117,314,96,321,77,337,68,344,68,336,90,332,97,335,114,
  352,120,373,111,387,125,394,163,361,175,367,193,378,198,368,205,369,
  215,363,214,350,226,323,240,288,238,312,197,274,185"
  onclick="alert('Germany'); return false" />
 <area alt="" title="" href="#" shape="poly" coords="159,199,194,202,
  196,186,202,184,218,192,235,179,236,169,249,167,277,186,314,197,289,
  235,302,239,304,274,292,286,260,281,250,298,222,289,215,291,193,285,
  202,256,196,232,175,216,159,213"
  onclick="alert('France'); return false" />
 <!-- et cetera -->
</map>
<img src="http://i.stack.imgur.com/pGuAF.jpg" alt="" usemap="#Map" />

此代码为所有股票提供权重。我无法弄明白如何将数字限制为10。

1 个答案:

答案 0 :(得分:0)

mutationFcn参数指定在每个时期存在多少实体(在您的案例组合中),它与分配给每个资产的权重无关。

您需要编写适当的CustomerID CustomerName CompanyName CompanyPhone CompanyEmail AddressL1 PostalCode 1 terbubbs terbubbs incorporated 1234567890 terbubbs@gmail.com 5 Main St 06482 1. CustomerName CompanyName CompanyPhone CompanyEmail AddressL1 PostalCode terrbubbs terbubbs inc 11234567890 terbubbs@gmail.com 7 Main St 06482 2. CustomerName CompanyName CompanyPhone CompanyEmail AddressL1 PostalCode terribble Terribble Incorporated 1254643789 terribble@gmail.com 12 State St 04422 3. CustomerName CompanyName CompanyPhone CompanyEmail AddressL1 PostalCode john doe JD inc 5468791313 john@gmail.com 12 Main St 06482 函数,明确包括维护10个非零权重。