MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Improving Genetic Programming Efficiency

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43156] Improving Genetic Programming Efficiency
  • From: hacksaw <hacksaw at toadmail.com>
  • Date: Fri, 15 Aug 2003 04:27:03 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I am writing a genetic programming package in Mathematica. I would like 
to be able to create a Mathematica expression and store it in a variable 
or a list. The problem is that Mathematica will do some internal 
rearranging to place the expression in a canonical form. Here is an example:

In[1]:= y := Plus[Times[Power[b, 2], a], Times[c, b]]

In[2]:= FullForm[y]

	Out[2]//FullForm= Plus[Times[a,Power[b,2]],Times[b,c]]

Previous, people who have written genetic programming packages have 
gotten around this "feature" of Mathematica by defining their own 
function names. This prevents the expression from being evaluated. At 
the time they want to evaluate the expression they uses the ReplaceAll[] 
function to change the name of the function to a Mathematica function.

In[3]:= y := myPlus[myTimes[myPower[b, 2], a], myTimes[c,b]]

In[4]:= FullForm[y]

	Out[4]//FullForm= myPlus[myTimes[myPower[b,2], a],myTimes[c,b]]

In[5]:= FullForm[ReplaceAll[y,{myPlus -> Plus, myTimes -> Times,
          myPower -> Power}]]

Out[5]//FullForm= Plus[Times[a,Power[b,2]],Times[b,c]]

My issue is that this is a lot of extra overhead. If I had 4000 
expressions, each with a 1000 functions, this would be 4,000,000
ReplaceAll[] function calls to rewrite the names of the functions.

Does anyone have any suggestions that might be more efficient.

Thanks in advance,
David


  • Prev by Date: Re: Re: von Neumann entropy
  • Next by Date: Re: Simplifying a "fixed-point" inner loop
  • Previous by thread: Re: how to specify something is "real"
  • Next by thread: Re: Improving Genetic Programming Efficiency