Re: Admissible values for variables

*To*: mathgroup at smc.vnet.net*Subject*: [mg29940] Re: [mg29909] Admissible values for variables*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Thu, 19 Jul 2001 03:57:04 -0400 (EDT)*References*: <200107180608.CAA18980@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Etienne wrote: > > I am trying to speed up a genetic algorithm (running with Mathematica 4) and > was wondering if there is an efficient way of declaring variables (e.g. x > must be a list, y must be real, etc.). Will it reduce my run time? If not, > what will? > > Thanks in advance. > > Etienne Ayotte-Sauvé You can frequently do this sort of thing with Compile. When successful, you get typically a factor of 5 or better speed improvement. There are caveats (okay, let's be forthright and call them limitations) but our experience is that one can implement genetic optimization algorithms in this way for a large class of objective functions. Another point to consider is that actual algorithmic complexity is frequently not as expected. So it makes good sense to time examples of various sizes, assess actual vs expected complexity, and if they do not agree you can then start looking closely at various pieces of code to see where the problems lie. Daniel Lichtblau Wolfram Research

**References**:**Admissible values for variables***From:*"Etienne" <etienne98@hotmail.com>