Your strategy sounds very good to me.
1. Make a unified interface to using LP solvers, and include GLPK in
Sage by default, to provide the LP functionality.
2. Make it possible to also use COIN-OR and CPLEX by simply changing
one parameter, and speed up code.
This is very similar to what we do now with Groebner basis. The
default is Singular, but for users with Magma, they can easily use
Magma instead to computer Groebner basis.
William
--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
It may be a good idea to interface to OSI in order to avoid having to
interface to both CPLEX and COIN-OR, but for license reasons we can
not use OSI to interface to GLPK as OSI is GPL-Uncompatible and the
only reason we want glpk installed by default is that it is the only
gpl LP solver ;-)
Your best bet is to look at the many complete working examples of
wrapping substantial C++ libraries that are already in Sage. E.g., I
like the wrapper of givaro in the rings/finite_field_givaro* files.
Also, there are extensive wrappers of NTL in libs/ntl/*
William
+1
We (e.g. the Sage-Combinat people) definitely would have a use for
it. We would even love it better if the interface could be consistent
with other related problems (e.g. testing for the existence of /
counting / iterating trough the integral points of a polytope).
I don't foresee manpower from us to work on this though ...
Good luck!
Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" <nth...@users.sf.net>
http://Nicolas.Thiery.name/
I should mention that at various times, people have proposed that you
could create symbolic variables x[1], x[2], etc. As far as I know,
these proposals have just been ideas and have never been implemented or
experimented with.
Maybe we could make x[1] a symbolic variable automatically. We would
have to make an indexing function for symbolic variables that would
return a symbolic variable that would be cached somewhere (so that x[1]
always referred to the same variable). That would also give us nested
indices, as x[1][1] would take a symbolic variable x, create a new one
x[1], and then x[1] would create another symbolic variable x[1][1].
Jason
That sounds pretty easy to implement by defining __getitem__ for
symbolic variables, and making it cache its answer using a dictionary.
Should one only allow x[integer] or more generally x[anything
hashable]?
William
I've advocated for this before--I think it's a great idea.
> Should one only allow x[integer] or more generally x[anything
> hashable]?
I would say x[anything symbolic]. Thus one could do
sage: var('x,a')
sage: x[a]
x[a]
sage: x[a].subs(a=1)
x[1]
I don't think x[a].subs(x=y) should be y[a], but you should be able
to sub for x[...] as a normal variable.
- Robert
Yes, this makes a lot of sense to me, since it's very common in
mathematics to have expressions like x_i, where i is some variable.
So would we have
sage: latex(x[3])
x_{3}
William
On Thu, Aug 27, 2009 at 1:00 AM, William Stein<wst...@gmail.com> wrote:
>
> On Wed, Aug 26, 2009 at 7:56 PM, Robert
> Bradshaw<robe...@math.washington.edu> wrote:
>>>> x[1], and then x[1] would create another symbolic variable x[1][1].
>>>>
>>>
>>> That sounds pretty easy to implement by defining __getitem__ for
>>> symbolic variables, and making it cache its answer using a dictionary.
>>
>> I've advocated for this before--I think it's a great idea.
>>
>
> Yes, this makes a lot of sense to me, since it's very common in
> mathematics to have expressions like x_i, where i is some variable.
Does GiNaC/pynac's native "indexed object" help here?
http://www.ginac.de/tutorial/Indexed-objects.html#Indexed-objects
If so then it may be a good idea to expose these to sage by wrapping
them suitably.
Cheers,
Golam
+1
> Should one only allow x[integer] or more generally x[anything
> hashable]?
+1 on anything hashable.
We (= the *-combinat people) often need to create systems of equations
with indeterminates indexed by various combinatorial objects (trees,
tableaux, permutations, ...). And in MuPAD we struggled all too often
because the various solvers did not support well such variables.