rsolverconvexcvx

Convex optimization in R with sqlp function


With the following convex problem:

minimize ∥Ax−b∥2
subject to l⪯x⪯u

It could be done in matlab with CVX, with SDPT3 solver:

cvx_begin
    variable x(n)
    minimize( norm(A*x-b) )
    subject to
        l <= x <= u
cvx_end

In this way, R has a sdpt3r package as well, but i dont know how could it be done to translate this problem with this package.

An example of use of this R package is:

# NOT RUN {
#Solve the MaxCut problem using the built in adjacency matrix B
data(Bmaxcut)
out <- maxcut(Bmaxcut)
blk <- out$blk
At <- out$At
C <- out$C
b <- out$b

out <- sqlp(blk,At,C,b)

#Alternatiee Input Method (Not Run)
#out <- sqlp(sqlp_obj=out)

# }

Anyone knows how could be done?


Solution

  • Using

    min y'y
    y = Ax-b
    L <= x <= U
    

    this is just a QP. E.g. use quadprog.