-
Notifications
You must be signed in to change notification settings - Fork 80
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
More fun with lazy update semantics #315
Comments
Gurobi support say
I think we should probably just have a |
Another option is to delete a variable normally, but instead of shifting the column indices, push the variable into a set. Then, in |
I was studying the code yesterday to do the patch, and I think there is a pitfall in doing exactly the same thing, but saving the deleted indexes to a buffer that is traversed and emptied during the The The problem happens in the following situation: add x_1, x_2, x_3, (calls I am not sure if it is just a question of changing the |
I have opened a question for Gurobi support: https://support.gurobi.com/hc/en-us/community/posts/360062325771-Which-is-the-index-of-variables-added-after-variable-deletion- |
Sorry, I didn't get to this yesterday. I've already discussed with Gurobi support. Say you have variables In C, they will have columns |
Thanks. I will work on the solution with this in mind then. I just hope
there is not a bug in Gurobi itself.
Em seg., 4 de mai. de 2020 às 10:56, Oscar Dowson <notifications@github.com>
escreveu:
… Sorry, I didn't get to this yesterday. I've already discussed with Gurobi
support.
Say you have variables x and y.
In C, they will have columns 0 and 1. If you delete y and add z without
updating, you are left with columns 0, 1, and 2. So, to set z lower
bound, you need to modify the 2 element. Calling update deletes y
properly, and shifts the columns to x, z= 0, 1.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#315 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADLVVGYRYE36MNT2RJL4TRLRP3CQNANCNFSM4MOVMSZQ>
.
|
I'm in favor of defining Gurobi.automatic_update() = true
function _update_if_requrired(model)
if automatic_update()
# ...
end
end Users can disable with |
I don't think there is. I had a longer conversation than just the thread I posted above. It's our misuse of the C API. |
Ok. The buffer of deletions idea is to be abandoned then? None of them is specially hard to implement, I could do any of them today, I just need a decision. Also, the |
A model attribute would also work. Good thinking. It depends how hard the buffer is to implement. I haven't looked in enough detail. Up to you to decide which one. |
What is needed for the buffer is:
I think your idea was basically right, the only thing missed is that the The model attribute is just a liitle easier because it is just a field in the model, a value in the constructor, and a if in all delete methods. I just find it a little unsatisfying because the name implies does not make clear what is automatically update, I would expect that adding variables would also trigger the automatic update. |
I will give a try to the buffer and if I discover something I have not thought about I will consider fallbacking to the flag. |
Just to be sure, we are talking only about variables here? I do not know if Gurobi has the same problems with deleting constraints, and the first patch will cover only variables. |
Yes, let's do variables first. Presumably there is the same issue with constraints, however. |
There is some reason because a version 8.0.1 with this fix was not made available? |
Raised on Discourse: https://discourse.julialang.org/t/jump-returning-incorrect-value-after-deleting-adding-anonymous-variable-and-constraint/38036
I don't know whether this is a bug, or expected behavior. I coded in Gurobipy and can't reproduce.
The text was updated successfully, but these errors were encountered: