simplifying algebraic expressions

DavidM nospam at nowhere.com
Tue Jun 26 23:56:38 CEST 2007


On Tue, 26 Jun 2007 04:22:23 -0700, Mark Westwood wrote:

> I'm with Robin Becker on this one, if GP is good enough for your
> problem, then the answers it produces should be good enough.  Set the
> fitness criteria in favour of shorter rather than longer expressions
> and let you system run a little longer.

Thanks for your comments.

I tried this and came up with some very interesting results.

In the fitness function, I added a multiplier:

   badness *= numnodes


Where 'badness' is the calculated fitness (always >0, lower is better),
and 'numnodes' is the number of nodes in the program tree.

Result? The population never evolved past a certain point, and problem
never got solved.

So I tried to make the multiplier more gentle:

  badness *= math.log(1 + numnodes)

Same result.

Tried even more gentle:

  badness *= math.pow(numnodes, 1.0/12)

That is, multiply badness by the twelfth root of the number of nodes.

Population evolved better, but still didn't breed a winning organism.

Finally, I set a threshold, and only punished organisms if they exceeded
this complexity threshold:

  if numnodes > threshold:
      badness *= math.pow(numnodes - threshold, 1.0/12)

That worked.

Seems that I have to allow a 'punishment free' threshold of complexity,
otherwise the population stagnates.

Cheers
David



More information about the Python-list mailing list