How to represent a sum of quadratic over linear functions in CVXR?

123 Views Asked by At

My objective function is a sum of n quadratic over linear terms. Here is how the problem looks like:

I know that the denominators of each of these n terms is positive and m<<n. I am trying to represent this objective function in CVXR. Is it possible to do this in CVXR? Thank you!

1

There are 1 best solutions below

0
G. Grothendieck On

I doubt that that function is convex but you can try implementing it with CVXR and it will tell you if it is not.

At any rate we can do it with a general nonlinear optimizer such as optim. Define a function ontof that maps R^m onto the feasible region and then we can implement it as below. Try it from multiple starting points just to be sure.

# test input
m <- 2
n <- 3
A <- matrix(1:(m*n), m, n)

ontof <- function(w) w*w / sum(w*w)
obj <- function(w) sum( sum(w*w) / colSums(A * w) )

res <- optim(1:m, function(x) obj(ontof(x)))

str(res)
## List of 5
##  $ par        : num [1:2] 1.37 1.55
##  $ value      : num 0.559
##  $ counts     : Named int [1:2] 39 NA
##   ..- attr(*, "names")= chr [1:2] "function" "gradient"
##  $ convergence: int 0
## $ message    : NULL

ontof(res$par) # solution
## [1] 0.4398606 0.5601394