-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
make LP return bounds on variables #13205
Comments
comment:1
Do you have something different from http://goo.gl/HEUdk in mind ? |
make (I)LP return bounds on variables |
comment:2
Attachment: trac_13205_LP_return_bounds_on_variables.patch.gz Replying to @nathanncohen:
I don't want to access variables via dictionaries, as this is flaky. |
This comment has been minimized.
This comment has been minimized.
comment:5
Yep, but then we would have two ways to do the same thing, with methods that take different arguments. What about changing get_min and get_max so that they accept integers instead ? All that would need to be added is a type check : if the given value is a MIPVariable type then the old code (one line) is used, and otherwise the backend function is called. Actually, the only line that this function contains is
That is : first take the integer corresponding to the variable, then return the value. More or less what you want to do too Nathann |
comment:6
Replying to @nathanncohen:
But then one would also want to have this for |
comment:7
Yeah, I guess. Or we can also merge everything into a variable_min and variable_max functions with which you can also set values. What do you think is best ? |
comment:8
Replying to @nathanncohen:
I pondered this question deeply :–) No, it's bad enough that I'd really prefer this two-tier approach, when user-defined variables and solver variables are kept apart interface-wise. By the way, it also looks strange that |
comment:9
I know it's ugly, but consider all the LP that only work this way. Honestly, having to declare the variables first would really be a huge mess.
Yeah, but then again it would mean that we need to have two copies of each command, according to how the data is given... Actually, do you really need to work with MixedIntegerLinearProgam ? It looks like all you want is to access the backend's methods directly, and this you can do if you just deal with GenericBackend.
Well, you can mess up with two instances of MixedIntegerLinearProgram so badly that they would have common variables, and this would work, but that would just be for the show Some time ago I think the variables knew about their LP, but because the LP also knew about the variables it produced a cyclic reference, and Python had to be forced to deallocate the two elements -- I think we removed that not so long ago, while dealing with Cliquer's many memory leaks. Which are fixed in a patch, btw Nathann |
comment:10
Replying to @nathanncohen:
OK, I can move this function into
hmm, I thought that one just cannot have |
comment:11
Well, that's the point : the GenericBackend class already has such methods that let you read/set variables bounds from their ID. And of course at this level everything is done through ID.
Yep, they were garbage-collected but you had to wait for the garbage collector to be called, which is not all the time. A user complained of memory leaks when solving many many many LP in a loop (solving a LP for all graphs on n vertices), and this was one source of problems. When youi remove cyclic dependencies the objects are deallocated without any call to the garbage collector, and in his case it made a difference. |
This comment has been minimized.
This comment has been minimized.
comment:13
Do you mean to say that this ticket is not needed? If so, this should be closed. |
comment:14
Please give it a positive review, and we'll mark it as won't fix or some such... |
comment:15
Sorry, I must have missed this last message. |
comment:16
Please clarify: does something need to be merged or not (if not: set the milestone to sage-duplicate/invalid/wontfix). |
comment:17
Replying to @jdemeyer:
OK, I was not sure how to do this. |
Reviewer: Dmitrii Pasechnik |
Currently there is no bulletproof way to find the lower and the upper bounds on the variables of an LP, as some variables can be added by the backend on the fly, etc. However, this (often crucial!) information is readily available from the backend. Hence the patch attached.
UPDATE:
OK, I was convinced by Nathann that this is not needed.
Depends on #13148
CC: @ppurka
Component: linear programming
Reviewer: Dmitrii Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/13205
The text was updated successfully, but these errors were encountered: