simplifying algebraic expressions
Robin Becker
robin at reportlab.com
Tue Jun 26 06:11:39 EDT 2007
> Hi,
>
> Are there any libraries for manipulating algebraic expression trees?
> In particular, take an expression tree and simplify it down.
>
> I'm working up the next release of PyGene, the genetic programming and
> genetic algorithms library.
>
> Part of PyGene works with trees holding algebraic expressions. For
> example, the expression:
> f = x**2 + sqrt(y) + 7
> is represented as the tree:
>
> +
> **
> x
> 2
> +
> sqrt
> y
> 7
>
> My GP code is successfully evolving expression trees to solve problems,
> however they're often full of redundancies, eg adding y in one part then
> subtracting y later on.
I have seen this sort of evolution strategy in the past and it's very wrong to
attempt to simplify outside the genetic framework. The implication is that you
know better than the overall fitness requirement. The additional expressions and
redundancies allow for extra mutation and combination possibilities which is a
good thing for the whole population. If you must, add the requirement to the
target ie give extra fitness points to organisms which perform efficiently.
--
Robin Becker
More information about the Python-list
mailing list