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

CPLEX solver not giving results based on example data #75

Open
kevlim83 opened this issue May 31, 2023 · 0 comments
Open

CPLEX solver not giving results based on example data #75

kevlim83 opened this issue May 31, 2023 · 0 comments

Comments

@kevlim83
Copy link

kevlim83 commented May 31, 2023

Hi @dirkschumacher ,

Im testing rmpk using CPLEX on the below example data found on the online vignette:

set.seed(42)
n <- 10
returns <- matrix(
rnorm(n * 20,
mean = runif(n, 0.01, 0.03),
sd = runif(n, 0.1, 0.4)),
ncol = n) # 20 time periods
e <- colMeans(returns)
C <- cov(returns)
min_mu <- 0.02

solver <- ROI_optimizer("cplex")
model <- optimization_model(solver)
x <- model$add_variable("x", i = 1:n, lb = 0, ub = 1)
model$set_objective(sum_expr(2 * C[i, j] * x[i] * x[j], i = 1:n, j = 1:n))
model$add_constraint(sum_expr(e[i] * x[i], i = 1:n) >= min_mu)
model$add_constraint(sum_expr(x[i], i = 1:n) == 1)
solver$optimize()

But this does not return a solution. The value columns are NA.
I have also tested that (1) CPLEX is working using the ROI package, and (2) other solvers work for this example problem.
Debugging cplex within rmpk reveals that Q is not a symmetric matrix.

Any ideas?

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