-
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
Bug with computed indexes of variables in set_bounds #87
Comments
Hello past me, is this really a bug? Isn't that equal to |
Though this works with |
a <- identity
m <- MILPModel() %>%
add_variable(x[i], i = 1:3) %>%
set_bounds(x[a(i)], i = 1:3, lb = 1)
expect_equal(c(1, 1, 1), m@variables[[1]]@lb) |
how would one use this technique to set bounds if the computed indexes belong to a matrix? |
Can you give me an example? |
Let's use your student assignment example and extend it. I want to create a matrix that says "student i cannot take course j". So for these Build the matrix:
Build the model with additional constraint:
But it might be nice (and maybe in some instances preferable) to do this by setting the bounds on the decision variables. I'm not sure what this would look like though. E.g.,:
Or maybe (with the 0/1 flipped in
|
Hey great work on this package! Looking forward to its release on CRAN. Here's a related bug (I believe so) that I found today -
The expected output is I can get the correct results with
Any thoughts? |
Thanks @shrinidhee indeed a bug. Will post a fix soon |
hi @rickyars @dirkschumacher @shrinidhee Does the below workf for you? we cannot exceed the capacity of a courseadd_constraint(sum_expr(x[i, j], i = 1:n) <= capacity[j], j = 1:m) %>% The last line gives an error:Error in check_for_unknown_vars_impl(model, the_ast) : |
This seems to be fixed now with #130. |
set_bounds(u[e(k)], ub = 0, k = 1:m)
The text was updated successfully, but these errors were encountered: