cvxgrp / CVXR

An R modeling language for convex optimization problems.

Home Page:https://cvxr.rbind.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Difficulties with DCP rules

C4lv1n5 opened this issue · comments

Hi,

I am facing the following challenge for which I don't seem to find a solution:

Basically, I want to program some code for StoNED - Stochastic non-smooth envelopment of data. The mathematical problem is described as

Stoned Problem

I started with this:

# dim(G) is 35x15
# dim(X) is 5x15
# dim(y) is 5x1
# dim(h) is 15x1

# y is a vector of output, x a matrix of input, h a vector of zeros, G a matrix of constraint parameters, betaa shall be estimated

library(CVXR)
betaa <- Variable(15,1)
target <- cvxr_norm(log(y)-log(X%*%betaa))
obj <- Minimize(target)
constr <- list(G%*%betaa>=h)
prob <- Problem(obj,constr)
result <- solve(prob)
print(result$getValue(betaa))

Since this didn't work, I tried transforming the problem to this:

library(CVXR)
library(MASS)

#betaa <- Variable((15,1)
test <- Variable(5,1)
target <- cvxr_norm(log(y)-test)
obj <- Minimize(target)
constr <- list(G%*%(ginv(X)%*%exp(test))>=h)
prob <- Problem(obj,constr)
result <- solve(prob)
print(result$getValue(ginv(X)%*%exp(test)))

Through this I shifted the DCP error from the problem expression to the constraint expression. I really don't have a clue how to get around this. Does anyone have a proper solution? Thanks in advance!

You are getting a DCP error because the optimization problem you are trying to solve is nonconvex due to the equality constraint containing the natural log. A convex problem can only have affine equality constraints. You will need to figure out a way to approximate the problem. I recommend looking up MM algorithms.