-
Notifications
You must be signed in to change notification settings - Fork 35
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
Solution ordering in R 3.x #404
Labels
Comments
Thanks a lot for reporting this. Will look at it asap (probably tomorrow). |
Ok, the problem is due to What I will do to fix and prevent it:
library(magrittr)
library(ROI.plugin.glpk)
model <- ompr::MIPModel() %>%
ompr::add_variable(x[i], i = 1:10, type = "continuous", ub = 2) %>%
ompr::add_constraint(x[i] <= 1, i = 1:9) %>%
ompr::set_objective(sum_over(x[i], i = 1:10))
soln <- ompr::solve_model(model, ompr.roi::with_ROI(solver = "glpk"))
ompr::get_solution(soln, x[i])
#> variable i value
#> 1 x 1 1
#> 2 x 2 1
#> 3 x 3 1
#> 4 x 4 1
#> 5 x 5 1
#> 6 x 6 1
#> 7 x 7 1
#> 8 x 8 1
#> 9 x 9 1
#> 10 x 10 2 Created on 2022-01-31 by the reprex package (v2.0.1) |
dirkschumacher
added a commit
that referenced
this issue
Jan 31, 2022
Merged
dirkschumacher
added a commit
that referenced
this issue
Jan 31, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm running into an issue where
ompr 1.0.1
sorts the resulting data frame byi
treated as acharacter
in R version 3.6.2. Herex[10]
should be2
with the remaining values1
, but insteadx[2]
is2
. The same code in R 4.0.3 behaves as expected.The text was updated successfully, but these errors were encountered: