Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
cool concept and the implementation looks well done. i need to study it more in order to make any detailed or deep comments. extremely minor nitpiks and some questions. 1) someone already covered the map in void context. 2) my $min = ${$fitnesses}[0]; for ($i = 0; $i < $size; ++$i) { # set $i = 1 since you used 0th index to load $min. # same thing for the $max value in a diff routine later. $min = ${$fitnesses}[$i] if (${$fitnesses}[$i] < $min); } 3) sub random_gene { my $self = shift; return ${$self->{GENES}}[rand(@{$self->{GENES}})]; why do you allow perl to truncate the above, which provides a fair distribution for the 0th index, but you handle explicitly below, which never includes the 0th index? there may be a good reason, but i couldn't figure out what it was. if (rand(1.0) < 0.005) { my $mutate = 1 + int(rand(@{$self->{NEW_GENES}} - 1)); 4) if (rand(1.0) > 0.5) { my $cut = 1 + int(rand(@genes1 - 1)); # i understand it here - since replacing the entire gene from beginning might not make sense 5) i factored out the following from the code so I could stick everything on the top and play: my $Genes = ['$x+=1 ;', '$x=$y ;', '$y=$x ;', '$x|=$y ;', '$x+=$y ;', + ' ;']; my $IndivGeneLen = 32; my $PopSize = 1999; my $Target = 10512; my $NumGenerations = 100; next thought - this can be generalized into a module. very cool, thanks!
___cliff_AT_rayman.com___

In reply to RE: Genetic Programming or breeding Perls by Crayman
in thread Genetic Programming or breeding Perls by gumpu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-18 09:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found