I'm currently working on a mathematical optimization framework.
Briefly, solving an optimization problem means finding the best
possible solution from a set of feasible solutions.  Usually, this
involves maximizing or minimizing one or more "objective" functions,
but within the confines of a number of constraints.  One problem might
be

Maximize f(x,y) = x^2 + x - 2y
subject to
  constraint 1:   y > 5     "y must be greater than 5"
  constraint 2:   x < 40    "x must be less than 40"
  constraint 3:  3x + 3y + 2x - 3x < 40    "the eqn must be less than
40"

This is a very simplistic problem.  For starters it has but 2
variables, x and y.  Many of the problems posed to our optimization
framework regularly have hundreds of thousands or millions of
variables.

Currently, our framework can handle this size problem, but it spends a
significant amount of time in our reduction phase, I think roughly
what Sympy calls simplification.  As our core competency is in
optimization, not variable and expression manipulation in this regard,
I'm looking at possible options to outsource this part of our work.

As I've only recently discovered Sympy, I am impressed by what the API
can currently do and plans to do in the future.  However, I'm curious
at its state of performance.  i.e. Speed.  I note that there's a
difference between sympycore and sympy, as far as the wiki goes, but
I'm wondering how strong the interest of the core developers is toward
performance.

Here's example code to illustrate one calculation set a user of our
codebase might do.  Specifically, I note that this Sympy snippet is
only "feasible" for values of size about 100 (which takes 7 minutes on
my machine).  I submit that as I'm new to Sympy, this is perhaps not a
"proper" Sympy interaction, so please educate me as necessary.

<code language='python'>
from sympy import *

size = int(30)

Xvars = [ Symbol( 'X%i' % i ) for i in xrange(size) ]
Yvars = [ Symbol( 'Y%i' % i ) for i in xrange(size) ]

mysum = lambda x, y: x + y

answer = reduce( mysum,
   [x * y
   for x in Xvars
   for y in Yvars]
)

print answer
</code>

Questions in bullet form:
 - Is this is a "Sympy" way of doing this multiplication and
summation?

 - We would regularly have that size variable be on an order greater
than 10,000.  Currently, this code seems only feasible for values of
up to about 100, which takes this snippet on my machine about 7
minutes.  What is the inclination towards performance optimization
within the Sympy project and developer community?

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to