[sage-support] Re: Making a copy of a MixedIntegerLinearProgram

2012-05-15 Thread Nathann Cohen
Hellooo Emil !!! Well, I just tried something and it ended upi crashing Sage, so I can just advise you to create all your variables in the first LP from the start, *then* to copy the MixedIntegerLinearProgram object. Of course it is a bad answer :-) John Perry was the one who needed this

Re: [sage-support] Re: Making a copy of a MixedIntegerLinearProgram

2012-05-15 Thread Emil
Hi Nathann, Thanks for writing the MILP class - it works very well. Now, I can do: x = lp.new_variable() Is there any way to do something like x = lp.get_existing_variables() ? I'm working on some graph theoretic stuff: I'm solving two LPs for each graph, for as many graphs as I can. - Emil.

[sage-support] Re: Making a copy of a MixedIntegerLinearProgram

2012-05-15 Thread john_perry_usm
On Monday, May 14, 2012 7:32:25 PM UTC-5, Emil wrote: lp = MixedIntegerLinearProgram(maximization=True) x = lp.new_variable() Then I do: nlp = copy(lp) x = nlp.new_variable() The variable 'x' now seems to contain different variables. So I cannot add any constraints that use the

Re: [sage-support] Re: Making a copy of a MixedIntegerLinearProgram

2012-05-15 Thread Emil
Next issue is that the Gurobi backend doesn't support the copy: AttributeError: 'sage.numerical.backends.gurobi_backend.GurobiBacke' object has no attribute 'copy' Any idea how much work this would be to do? (I can now do what I wanted to do before, at least with GLPK.) Emil -- To post to

Re: [sage-support] Re: Making a copy of a MixedIntegerLinearProgram

2012-05-15 Thread Nathann Cohen
Hellooo !! Next issue is that the Gurobi backend doesn't support the copy: Oops ^^; Any idea how much work this would be to do? Oh, it's usually quite straightforward to implement such things. Usually the feature already exists in the solver's C api, and all the work that needs to be

Re: [sage-support] Re: Making a copy of a MixedIntegerLinearProgram

2012-05-15 Thread Emil
OK I'll take a look :) On 15 May 2012 21:55, Nathann Cohen nathann.co...@gmail.com wrote: Hell Emil !! Any chance you could make a patch? :)   (I'd volunteer myself, but I would probably mess it up!) H I could, but this patch is so local that it really is an ideal occasion