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 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 to write your f

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

2012-05-15 Thread Nathann Cohen
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 to write your first patch... Are you sure you do not want to give it a try ? It is fun to be

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

2012-05-15 Thread Emil
On 15 May 2012 15:21, Nathann Cohen wrote: > 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 done is to expose it in Sage :-) Any chance you could make a patch? :) (I'd volunteer mys

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 do

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 thi

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

2012-05-15 Thread Emil
On 15 May 2012 13:38, john_perry_usm wrote: >I've found MILP lets you do it this way: > >     sage: x, y = lp[0], lp[1] Ahh! Thanks, this is what I need. (Is this documented anywhere?) - Emil -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, s

[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

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 Nathann Cohen
By the way, could I ask you what lead you to create and solve many LP ? I mean, what are you solving which requires you to do that ? ^^; Nathann -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegr

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

2012-05-14 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 c