MathGroup Archive 2003

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

Search the Archive

Re: Improving Genetic Programming Efficiency

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43176] Re: [mg43156] Improving Genetic Programming Efficiency
  • From: William K Reinholtz <kirk.reinholtz at jpl.nasa.gov>
  • Date: Sat, 16 Aug 2003 02:53:57 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

This is usually done with one of the Hold forms, and ReleaseHold[] when 
you're ready to let it evaluate.

Is your overall desire to prevent evaluation of any kind until you get 
the expression into a context where a,b, etc are properly defined?

On Friday, Aug 15, 2003, at 01:27 US/Pacific, hacksaw wrote:

> 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: how to specify something is "real"
  • Next by Date: Re: Justification of graphics in cells
  • Previous by thread: Re: Improving Genetic Programming Efficiency
  • Next by thread: nonfunctions