[Returnanalytics-commits] r2688 - pkg/PortfolioAnalytics/sandbox

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 31 22:20:36 CEST 2013


Author: rossbennett34
Date: 2013-07-31 22:20:36 +0200 (Wed, 31 Jul 2013)
New Revision: 2688

Modified:
   pkg/PortfolioAnalytics/sandbox/testing_back_compat.R
Log:
Modified test for backwards compatibility to include ROI as optimize_method

Modified: pkg/PortfolioAnalytics/sandbox/testing_back_compat.R
===================================================================
--- pkg/PortfolioAnalytics/sandbox/testing_back_compat.R	2013-07-31 20:12:51 UTC (rev 2687)
+++ pkg/PortfolioAnalytics/sandbox/testing_back_compat.R	2013-07-31 20:20:36 UTC (rev 2688)
@@ -1,5 +1,7 @@
 library(PortfolioAnalytics)
 library(DEoptim)
+library(ROI)
+require(ROI.plugin.glpk)
 
 data(edhec)
 ret <- edhec[, 1:4]
@@ -19,6 +21,10 @@
 optdev1 <- optimize.portfolio_v1(R=ret, constraints=gen.constr, optimize_method="DEoptim", search_size=2000)
 optdev1
 
+# ROI
+optroiv1 <- optimize.portfolio_v1(R=ret, constraints=gen.constr, optimize_method="ROI")
+optroiv1
+
 # When using optimize.portfolio, the user will see that he needs to pass in a
 # portfolio object, so the user will likely just create a portfolio object and
 # then pass in the v1_constraint object
@@ -28,8 +34,15 @@
 # can pass a v1_constraint object in for the constraints arg, but still needs to
 # pass in a portfolio object so that it can be updated with the constraints and
 # objectives from the v1_constraint object
+
+# Random
 optrp <- optimize.portfolio(R=ret, portfolio=pspec, constraints=gen.constr, optimize_method="random", search_size=2000)
 optrp
 
+# DEoptim
 optde <- optimize.portfolio(R=ret, portfolio=pspec, constraints=gen.constr, optimize_method="DEoptim", search_size=2000, traceDE=5)
 optde
+
+# ROI
+optroi <- optimize.portfolio(R=ret, portfolio=pspec, constraints=gen.constr, optimize_method="ROI")
+optroi



More information about the Returnanalytics-commits mailing list