very simple Genetic Algorithm completed

Matthew_WARREN at bnpparibas.com Matthew_WARREN at bnpparibas.com
Fri Feb 1 06:19:16 EST 2008


looking into speeding up the GA code I posted, I ran it with cProfile.

Fri Feb 01 11:05:57 2008    evprof

         30100116 function calls in 93.614 CPU seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
  7160929   34.542    0.000   37.844    0.000 random.py:147(randrange)
  7160929   13.634    0.000   51.478    0.000 random.py:211(randint)
    80080   12.321    0.000   62.645    0.001 quickga.py:88(mutate)
    80330    8.631    0.000    8.891    0.000 {eval}
    80380    8.324    0.000   14.243    0.000 quickga.py:42(floatify)
  7568392    7.546    0.000    7.546    0.000 {method 'replace' of 'str'
objects}
  7160929    3.302    0.000    3.302    0.000 {method 'random' of
'_random.Random' objects}
    80380    2.659    0.000    4.592    0.000
quickga.py:15(rationalise_signs)

... Does this in essence mean the main place I should be looking is mutate()
I'm imagining randint and randrange are already as fast as they can be..


Matt.


This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 
Do not print this message unless it is necessary,
consider the environment.

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.
N'imprimez ce message que si necessaire,
pensez a l'environnement.



More information about the Python-list mailing list