0

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!

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
  • Given that SO is a programming board, not a maths board, it would be useful to show the `r` code you already wrote so far. Because asking "is it possible to X?" on SO is rarely useful: the only possible answers there are "yes" or "no", so read the docs and see if it looks like it might, then try to write code, and when you get stuck you have code to ask questions about. – Mike 'Pomax' Kamermans Feb 23 '22 at 19:52
  • Please provide enough code so others can better understand or reproduce the problem. – Community Feb 25 '22 at 19:12

1 Answers1

0

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
G. Grothendieck
  • 254,981
  • 17
  • 203
  • 341