Maybe I misunderstood your question about indexed variables, you do can create and use arrays of oovars and oofuns, eg from FuncDesigner import * N = 100 a = oovars(N) # create array of N oovars b = oovars(N) # another array of N oovars some_lin_funcs = [i*a[i]+4*i + 5*b[i] for i in xrange(N)] f = some_lin_funcs[15] + some_lin_funcs[80] point = {} for i in xrange(N): point[a[i]] = 1.5 * i**2 point[b[i]] = 1.5 * i**3 print f(point) print a[15](point) print some_lin_funcs[25](point) # [ 4638755.] # [ 337.5] # [ 140725.] Regards, D.
On Aug 26, 11:04 pm, Nathann Cohen <nathann.co...@gmail.com> wrote: > > Yes, you can use indexation like some_oovar[i] or some_oofun[i] > > (probably with several indexes, or negative ones that are start from > > array end), however, I think it should be avoided if possible (you'd > > better split your oovar into several > > oovars).http://www.openopt.org/FuncDesignerDoc#Some_issues_to_be_aware > > I sent a message on sage-support to know to which extent I could use > multivariate Polynomials in Sage to represent constraints and Linear > functions, but it seems to be troublesome... This said, there is no > way for me to use Linear Programming if I can not use indexed > variables... At the moment, even though the syntax could be > tremendously improved, I can use any hashable Sage object as a > variable, and most of the time in Graph theoretic function my > variables are edges, vertices, or arbitrary tuples and strings. > Anyway, most of the Linear Programs are generated from graphs and I > have to find a way to let a computer create as many variables as > possible :-/ > The current syntax, though, is not nearly satisfying. > > > Maybe I have translated it wrong with my small knowledge of English. > > I'm french. We bear the same cross ;-) > > > I had awared of OSI, but I'm not skilled in connecting code of other > > languages to Python, that's why I hadn't go for it. > > > This is very nice to hear, still I think it would be better to provide > > Python-OSI API instead of SAGE-OSI, it would benefit more wield > > auditory (PythonXY, EPD, mere Python-scipy users etc). Of course, it's > > up to you - mb you are SAGE developer at first. > > I'm sorry to give you this "cheap" an answer, but if anyone wants to > write such code, it will always be available as it is GPL-Licensed. I > am not particularly interested in LP, I just began to write these > interfaces because I thought the Graph functions I needed would be > much harder to write otherwise, and often less effective. I just wrote > a shortcut. Now, if LP can be of independent interest in Sage, why not > spending some time over it as I know how it works ? > Besides, in Sage I only have to care about the stuff that interests > me... If I need symbolics, plots, interfaces, I can ask people whose > interest lies there and they'll give me answer, sometimes solutions. > If they need anything dealing with Graphs, I'll do what I can. > Pretty naive, but so relieving :-) > > Regards, > > Nathann --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---