Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DCP check is too slow #53

Open
flodel opened this issue Aug 31, 2019 · 0 comments
Open

DCP check is too slow #53

flodel opened this issue Aug 31, 2019 · 0 comments

Comments

@flodel
Copy link

flodel commented Aug 31, 2019

Hello, I am working on an optimization problem with a complex formulation and although the problem is easy to solve (<1 sec once Rglpk::Rglpk_solve_LP is called), the DCP check (CVXR::is_dcp) within CVXR::solve is very, very slow (minutes).

Here is a small reproducible example. Though unrelated to my optimization problem, it shows the kind of slow DCP check I am experiencing:

library(CVXR)
n <- 5L; m <- 3L
X <- Variable(n, m)
y <- runif(n)
cumX <- cumsum_axis(X, axis = 2) # %*% diag(m)
cumE <- sum_entries(cumX, axis = 1) - y
posE <- sum_entries(pos(cumE))
negE <- sum_entries(neg(cumE)) # * 1
objective <- Minimize(posE + negE)
problem <- Problem(objective)
system.time({ result <- is_dcp(problem) })
## user system elapsed
## 3.234 0.021 3.447

If you then run the same code but uncomment the * 1 multiplication, it runs in

## user system elapsed
## 12.278 0.104 14.546

If you then run the same code but uncomment the %*% diag(m), it runs in

## user system elapsed
## 52.452 0.646 69.411

I hope you will be able to find the problem and speed up is_dcp. If not or if it looks like it will take some time to implement, would you please consider making the ignore_dcp option skip completely the DCP check? Or provide a separate option?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant