[Returnanalytics-commits] r3287 - pkg/PortfolioAnalytics/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 16 16:52:09 CET 2013


Author: rossbennett34
Date: 2013-12-16 16:52:09 +0100 (Mon, 16 Dec 2013)
New Revision: 3287

Modified:
   pkg/PortfolioAnalytics/R/optimize.portfolio.R
Log:
Modifying optimize.portfolio_v1 to use '::' instead of ':::' for R CMD check

Modified: pkg/PortfolioAnalytics/R/optimize.portfolio.R
===================================================================
--- pkg/PortfolioAnalytics/R/optimize.portfolio.R	2013-12-16 15:50:18 UTC (rev 3286)
+++ pkg/PortfolioAnalytics/R/optimize.portfolio.R	2013-12-16 15:52:09 UTC (rev 3287)
@@ -227,7 +227,7 @@
     # ROI constraint object, but with an additional solver arg.
     # then we can do something like this
     print("ROI_old is going to be depricated.")
-    roi.result <- ROI:::ROI_solve(x=constraints$constrainted_objective, constraints$solver)
+    roi.result <- ROI::ROI_solve(x=constraints$constrainted_objective, constraints$solver)
     weights <- roi.result$solution
     names(weights) <- colnames(R)
     out$weights <- weights
@@ -265,8 +265,8 @@
       }
     }
     plugin <- ifelse(any(names(moments)=="var"), "quadprog", "glpk")  
-    if(plugin == "quadprog") ROI_objective <- ROI:::Q_objective(Q=2*lambda*moments$var, L=-moments$mean)
-    if(plugin == "glpk") ROI_objective <- ROI:::L_objective(L=-moments$mean)
+    if(plugin == "quadprog") ROI_objective <- ROI::Q_objective(Q=2*lambda*moments$var, L=-moments$mean)
+    if(plugin == "glpk") ROI_objective <- ROI::L_objective(L=-moments$mean)
     Amat <- rbind(rep(1, N), rep(1, N))
     dir.vec <- c(">=","<=")
     rhs.vec <- c(constraints$min_sum, constraints$max_sum)
@@ -298,7 +298,7 @@
     }
     if(any(names(moments)=="CVaR")) {
       Rmin <- ifelse(is.na(target), 0, target)
-      ROI_objective <- ROI:::L_objective(c(rep(0,N), rep(1/(alpha*T),T), 1))
+      ROI_objective <- ROI::L_objective(c(rep(0,N), rep(1/(alpha*T),T), 1))
       Amat <- cbind(rbind(1, 1, moments$mean, coredata(R)), rbind(0, 0, 0, cbind(diag(T), 1))) 
       dir.vec <- c(">=","<=",">=",rep(">=",T))
       rhs.vec <- c(constraints$min_sum, constraints$max_sum, Rmin ,rep(0, T))
@@ -309,10 +309,10 @@
         rhs.vec <- c(rhs.vec, constraints$cLO, -constraints$cUP)
       }
     }
-    opt.prob <- ROI:::OP(objective=ROI_objective, 
-                         constraints=ROI:::L_constraint(L=Amat, dir=dir.vec, rhs=rhs.vec),
+    opt.prob <- ROI::OP(objective=ROI_objective, 
+                         constraints=ROI::L_constraint(L=Amat, dir=dir.vec, rhs=rhs.vec),
                          bounds=bnds)
-    roi.result <- ROI:::ROI_solve(x=opt.prob, solver=plugin)
+    roi.result <- ROI::ROI_solve(x=opt.prob, solver=plugin)
     weights <- roi.result$solution[1:N]
     names(weights) <- colnames(R)
     out$weights <- weights



More information about the Returnanalytics-commits mailing list