[SciPy-user] Question about implementation of a directed acyclic graph of formulas and variables

Dmitrey dmitrey15@ukr....
Sun Feb 22 02:53:20 CST 2009

Hi Christopher,
I'm working on OpenOpt oofun concept


it doesn't have any graphical back-end yet but I hope someday it will be 
binded to a one. The concept is something like MATLAB's SIMULINK (as I 
have mentioned, without graphical back-end yet). Also,it is intended 
first of all to numerical optimization (so oofuns have derivatives 
subfield, and in future some more will be added, like desired lb-ub 
bounds for each oofun) rather than SIMULINK that is keen on signal 

There are other persons in our numerical optimization dept that are 
working on directed acyclic graph of formulas and variables (including 
SQL databases), however, unfortunately they work using C++/Rational 
Rose, no Python. BTW they handle even cyclic graphs (via separating 
cycles and handling them via non-linear systems solver, like 
scipy.optimize fsolve).

Regards, D.
P.S. unfortunately, because of some my changes oolin concept doesn't 
work for latest svn snapshot.

Christopher Mutel wrote:
> Hello all-
> I am working on a model that uses a large set of linear equations.
> SciPy provides a set of tools that help very much in my case
> (especially sparse matrix stuff), and I hope it is okay if I ask the
> general SciPy community for advice on a further development of my
> model. I am sure that some of you have already dealt with the
> questions that I am struggling with.
> I would like to replace some of the numbers used to construct my
> matrix with a directed acyclic graph of formulas and variables, to
> represent the fact that many model components are not independent of
> one another. This is especially useful when doing Monte Carlo
> analysis, where every element in the set of linear equations has an
> associated uncertainty distribution. In the model I am working on, the
> linear equations represent physical processes in the industrial
> economy, and its makes the model more accurate to say that, for
> example, the NOx production in a boiler is a function of the
> temperature of the boiler, or the fuel consumption of a truck is a
> function of the load. The alternative, which is what I do now, is
> assume these parameters are independently distributed.
> My questions are:
> 1. To store my graph of references, I need to choose an existing
> python graph implementation. Does anyone have ideas on what would be
> best in my specific case? I only need a graph implementation to ensure
> transitive closure (no circular references), and to allow a way to
> keep track of references so the entire graph can be easily and
> correctly re-calculated. NetworkX seems like tremendous overkill in
> this case.
> 2. Is there a "best" way to write a formula? Perhaps there are
> libraries for something like this? I was thinking of a class like:
> class Formula(object):
>     formula = "foo"
>     references = [bar1, bar2]
> A key point here is that the formula itself must be stored in a SQL
> database, and human-readable (at least to some extent). I am sure that
> there is someone out there who has though a lot about these types of
> issues, and has a decent solution. I don't think something like SymPy
> would work here, though of course I may be wrong.
> Respectfully yours,
> Chris

More information about the SciPy-user mailing list