I found the RMosek library to solve optimization problems. In my case, I will use quadratic optimization. This is the documentation about the quadratic optimization present on Rmosek: https://docs.mosek.com/9.0/rmosek/tutorial-qo-shared.html#
For example, I have this problem:
min y1^2 + y2^2 x1 + y1 - x2 - y2 > 0 x1+x2=2
I don't understand how to transform mine formulation as matrix formulation. I don't think the example on the documentation is very clear. Can someone help me?
I assume your variables are ordered as (x1,x2,y1,y2) ie x1 has index 1, and so on until y2 has index 4. Then your quadratic objective is specified with
prob$qobj$i <- c(3, 4)
prob$qobj$j <- c(3, 4)
prob$qobj$v <- c(2, 2)
and for the linear part you should use the matrix
1 -1 1 -1
1 1 0 0
and the bounds are
prob$bc <- rbind(blc=c(0,2), buc=c(Inf,2))
By the way if you really just want to minimize the norm of a vector you would be better off using the quadratic cone and conic optimization instead of formulating it as a quadratic term.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.