[Returnanalytics-commits] r3134 - pkg/PortfolioAnalytics/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 18 11:28:29 CEST 2013
Author: braverock
Date: 2013-09-18 11:28:29 +0200 (Wed, 18 Sep 2013)
New Revision: 3134
Modified:
pkg/PortfolioAnalytics/R/optimize.portfolio.R
Log:
- add some extra options for pso optimization
Modified: pkg/PortfolioAnalytics/R/optimize.portfolio.R
===================================================================
--- pkg/PortfolioAnalytics/R/optimize.portfolio.R 2013-09-18 09:05:14 UTC (rev 3133)
+++ pkg/PortfolioAnalytics/R/optimize.portfolio.R 2013-09-18 09:28:29 UTC (rev 3134)
@@ -61,7 +61,7 @@
if(inherits(mout,"try-error")) {
message(paste("portfolio moment function failed with message",mout))
} else {
- dotargs <- mout
+ dotargs <- c(dotargs,mout)
}
normalize_weights <- function(weights){
@@ -333,7 +333,12 @@
names(dotargs[pm > 0L]) <- PSOcargs[pm]
controlPSO$maxit <- maxit
controlPSO[pm] <- dotargs[pm > 0L]
- if(!hasArg(reltol)) controlPSO$reltol <- .000001 # 1/1000 of 1% change in objective is significant
+ if(!hasArg(reltol)) controlPSO$reltol <- .0001 # 1/100 of 1% change in objective is insignificant enough to restart a swarm
+ #NOTE reltol has a different meaning for pso than it has for DEoptim. for DEoptim, reltol is a stopping criteria, for pso,
+ # it is a restart criteria.
+
+ if(!hasArg(s)) controlPSO$s<-N*10 #swarm size
+ if(!hasArg(maxit.stagnate)) controlPSO$maxit.stagnate <- controlPSO$s #stopping criteria
if(hasArg(trace) && try(trace==TRUE,silent=TRUE)) controlPSO$trace <- TRUE
if(hasArg(trace) && isTRUE(trace)) {
controlPSO$trace <- TRUE
More information about the Returnanalytics-commits
mailing list