[Returnanalytics-commits] r3098 - pkg/PortfolioAnalytics/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Sep 13 23:05:13 CEST 2013
Author: rossbennett34
Date: 2013-09-13 23:05:13 +0200 (Fri, 13 Sep 2013)
New Revision: 3098
Modified:
pkg/PortfolioAnalytics/R/optimize.portfolio.R
Log:
Adding revised random_portfolios arguments to optimize.portfolio
Modified: pkg/PortfolioAnalytics/R/optimize.portfolio.R
===================================================================
--- pkg/PortfolioAnalytics/R/optimize.portfolio.R 2013-09-13 20:55:28 UTC (rev 3097)
+++ pkg/PortfolioAnalytics/R/optimize.portfolio.R 2013-09-13 21:05:13 UTC (rev 3098)
@@ -615,7 +615,9 @@
if(hasArg(rpseed) & isTRUE(rpseed)) {
# initial seed population is generated with random_portfolios function
# if(hasArg(eps)) eps=match.call(expand.dots=TRUE)$eps else eps = 0.01
- rp <- random_portfolios(portfolio=portfolio, permutations=NP)
+ if(hasArg(rp_method)) rp_method=match.call(expand.dots=TRUE)$rp_method else rp_method="sample"
+ if(hasArg(eliminate)) eliminate=match.call(expand.dots=TRUE)$eliminate else eliminate=TRUE
+ rp <- random_portfolios(portfolio=portfolio, permutations=NP, rp_method=rp_method, eliminate=eliminate, ...)
DEcformals$initialpop <- rp
}
controlDE <- do.call(DEoptim.control, DEcformals)
@@ -651,7 +653,9 @@
if(optimize_method=="random"){
#' call random_portfolios() with portfolio and search_size to create matrix of portfolios
if(missing(rp) | is.null(rp)){
- rp <- random_portfolios(portfolio=portfolio, permutations=search_size)
+ if(hasArg(rp_method)) rp_method=match.call(expand.dots=TRUE)$rp_method else rp_method="sample"
+ if(hasArg(eliminate)) eliminate=match.call(expand.dots=TRUE)$eliminate else eliminate=TRUE
+ rp <- random_portfolios(portfolio=portfolio, permutations=search_size, rp_method=rp_method, eliminate=eliminate, ...)
}
#' store matrix in out if trace=TRUE
if (isTRUE(trace)) out$random_portfolios <- rp
More information about the Returnanalytics-commits
mailing list