I'm using the ROI package in R and am trying to setup an optimization with a quadratic objective function.
It looks like the default function is of the form: 1/2 x^T Q x+ C^T x. I'd like to alter this function so that I'm optimizing to maximize: x.V/(x^T Q x) Where v is the sq root of the diagonals for the covariance matrix Q.
Here is an example I have:
C1 <- matrix(runif(100, min=10, max=100),nrow=10)
C <- as.matrix(forceSymmetric(C1))
V <- sqrt(diag(C))
full_invest <- L_constraint(rep(1, 10), "==", 1)
qcqp <- OP(Q_objective(Q = C, L = rep(0, 10)),
full_invest,
bounds = V_bound(ui = seq_len(10), ub = rep(0.25, 10)),
max = FALSE)
sol1 <- ROI_solve(qcqp, solver = "alabama", start = rep(1/10, 10))
In this example the optimization is minimizing 1/2 x^T Q x+ C^T x How can I set this up so that my optimization function includes the sum of the product of x and V.