<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: Genetic Algorithms in Perl</title>
	<atom:link href="http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/</link>
	<description>If it ain&#039;t broke, fix it!</description>
	<lastBuildDate>Fri, 13 Jan 2012 05:43:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: JJ</title>
		<link>http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/comment-page-1/#comment-20</link>
		<dc:creator>JJ</dc:creator>
		<pubDate>Fri, 12 Dec 2008 16:26:38 +0000</pubDate>
		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=38#comment-20</guid>
		<description>Actually, Perl is not so slow for the bread and butter of GA, string handling. And, of course, you (and mostly everybody else) is able to write faster and tighter code in a language they know well (which, in my case, is Perl), than in other that&#039;s supposed to be faster but is unknown.
BTW, you can use anything as a genome in Algorithm::Evolutionary, as long as you match the operators you use with it. There are even several underlying representations for things like bitstrings (string vs. bit vector, guess which one is faster?)</description>
		<content:encoded><![CDATA[<p>Actually, Perl is not so slow for the bread and butter of GA, string handling. And, of course, you (and mostly everybody else) is able to write faster and tighter code in a language they know well (which, in my case, is Perl), than in other that&#8217;s supposed to be faster but is unknown.<br />
BTW, you can use anything as a genome in Algorithm::Evolutionary, as long as you match the operators you use with it. There are even several underlying representations for things like bitstrings (string vs. bit vector, guess which one is faster?)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sethjust</title>
		<link>http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/comment-page-1/#comment-14</link>
		<dc:creator>sethjust</dc:creator>
		<pubDate>Fri, 12 Dec 2008 08:21:43 +0000</pubDate>
		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=38#comment-14</guid>
		<description>I&#039;ve been playing with AI::Genetic and it&#039;s quite good... I especially value the ability to define your own strategies, as well as the flexibility in defining the genome.

As to performance, I wouldn&#039;t be using Perl if I wanted it to be fast, only if I wanted it to be pretty, which this is. Perl makes for a nice interface to a genetic algorithm, and makes it very easy to modify to any problem. Even my homegrown code has that advantage, and it&#039;s even more present in the modules that are available.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been playing with AI::Genetic and it&#8217;s quite good&#8230; I especially value the ability to define your own strategies, as well as the flexibility in defining the genome.</p>
<p>As to performance, I wouldn&#8217;t be using Perl if I wanted it to be fast, only if I wanted it to be pretty, which this is. Perl makes for a nice interface to a genetic algorithm, and makes it very easy to modify to any problem. Even my homegrown code has that advantage, and it&#8217;s even more present in the modules that are available.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JJ</title>
		<link>http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/comment-page-1/#comment-13</link>
		<dc:creator>JJ</dc:creator>
		<pubDate>Fri, 12 Dec 2008 08:16:07 +0000</pubDate>
		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=38#comment-13</guid>
		<description>I hadn&#039;t seen AI::Genetic::Pro; it looks nice, and it&#039;s been XS-ed for performance. However, it doesn&#039;t look too flexible. I did Algorithm::Evolutionary for my own research, and thus what I valued the most was the possibility to easily add new stuff.</description>
		<content:encoded><![CDATA[<p>I hadn&#8217;t seen AI::Genetic::Pro; it looks nice, and it&#8217;s been XS-ed for performance. However, it doesn&#8217;t look too flexible. I did Algorithm::Evolutionary for my own research, and thus what I valued the most was the possibility to easily add new stuff.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JJ</title>
		<link>http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/comment-page-1/#comment-17</link>
		<dc:creator>JJ</dc:creator>
		<pubDate>Fri, 12 Dec 2008 08:13:52 +0000</pubDate>
		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=38#comment-17</guid>
		<description>WRT to performance, you can get strong gains by compiling your own perl, eliminating threads and some other features.</description>
		<content:encoded><![CDATA[<p>WRT to performance, you can get strong gains by compiling your own perl, eliminating threads and some other features.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sethjust</title>
		<link>http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/comment-page-1/#comment-16</link>
		<dc:creator>sethjust</dc:creator>
		<pubDate>Fri, 12 Dec 2008 00:11:33 +0000</pubDate>
		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=38#comment-16</guid>
		<description>I would definitely use a module as well, over home-grown code, both for performance and reliability. However, it&#039;s a fun learning experience. And you&#039;re right, there is some inefficiency in doing the straight sort(), so it&#039;s good to learn a bit about better ways of doing the same thing.</description>
		<content:encoded><![CDATA[<p>I would definitely use a module as well, over home-grown code, both for performance and reliability. However, it&#8217;s a fun learning experience. And you&#8217;re right, there is some inefficiency in doing the straight sort(), so it&#8217;s good to learn a bit about better ways of doing the same thing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan</title>
		<link>http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/comment-page-1/#comment-15</link>
		<dc:creator>Ivan</dc:creator>
		<pubDate>Thu, 11 Dec 2008 23:42:44 +0000</pubDate>
		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=38#comment-15</guid>
		<description>as an alternative to Algo::Evolutionary, http://search.cpan.org/search?query=genetic&amp;mode=all shows also AI::Genetic and AI::Genetic::Pro. I know you did this for fun, but if I was to use Perl genetic algos for serious work, I&#039;d probably go for the ::Pro module.

Another comment on your code -  sort {fitness($b)  fitness($a)} - will evaluate your fitness function ~ N log(N) times, which is usually not what you want. For education, you should probably read about Orcish maneuver and Schwartzian Transform... as for real work you should probably use Sort::Key.</description>
		<content:encoded><![CDATA[<p>as an alternative to Algo::Evolutionary, <a href="http://search.cpan.org/search?query=genetic&#038;mode=all" rel="nofollow">http://search.cpan.org/search?query=genetic&#038;mode=all</a> shows also AI::Genetic and AI::Genetic::Pro. I know you did this for fun, but if I was to use Perl genetic algos for serious work, I&#8217;d probably go for the ::Pro module.</p>
<p>Another comment on your code &#8211;  sort {fitness($b)  fitness($a)} &#8211; will evaluate your fitness function ~ N log(N) times, which is usually not what you want. For education, you should probably read about Orcish maneuver and Schwartzian Transform&#8230; as for real work you should probably use Sort::Key.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sethjust</title>
		<link>http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/comment-page-1/#comment-18</link>
		<dc:creator>sethjust</dc:creator>
		<pubDate>Thu, 11 Dec 2008 17:09:40 +0000</pubDate>
		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=38#comment-18</guid>
		<description>Thanks for the replies...

@JJ: I hadn&#039;t seen that module. It looks interesting. However, the point here was to write one from scratch, which seems to have worked out fairly well. I wasn&#039;t sure how Perl would do, and it seems to have come through admirably.

@Ivan: Good call on anonymous functions. I&#039;ve made that change and I&#039;ll post updated code in a little bit.</description>
		<content:encoded><![CDATA[<p>Thanks for the replies&#8230;</p>
<p>@JJ: I hadn&#8217;t seen that module. It looks interesting. However, the point here was to write one from scratch, which seems to have worked out fairly well. I wasn&#8217;t sure how Perl would do, and it seems to have come through admirably.</p>
<p>@Ivan: Good call on anonymous functions. I&#8217;ve made that change and I&#8217;ll post updated code in a little bit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan</title>
		<link>http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/comment-page-1/#comment-19</link>
		<dc:creator>Ivan</dc:creator>
		<pubDate>Thu, 11 Dec 2008 15:58:53 +0000</pubDate>
		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=38#comment-19</guid>
		<description>Don&#039;t use string eval - it slows you down significantly, and it&#039;s rather inelegant.

what you are looking for is anonymous functions -

my $init = sub { rand(10) };

and then replace all eval($init_string) with $init-&gt;();</description>
		<content:encoded><![CDATA[<p>Don&#8217;t use string eval &#8211; it slows you down significantly, and it&#8217;s rather inelegant.</p>
<p>what you are looking for is anonymous functions -</p>
<p>my $init = sub { rand(10) };</p>
<p>and then replace all eval($init_string) with $init-&gt;();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JJ</title>
		<link>http://sethjust.com/2008/12/11/genetic-algorithms-in-perl/comment-page-1/#comment-21</link>
		<dc:creator>JJ</dc:creator>
		<pubDate>Thu, 11 Dec 2008 13:27:15 +0000</pubDate>
		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=38#comment-21</guid>
		<description>Or... you can sudo cpan Algorithm::Evolutionary and download a nifty and venerable cpan module.
The code looks nice, anyways, and just goes out to prove that Perl is as good a language as any other for programming evolutionary algorithms. Better than many others, in fact.</description>
		<content:encoded><![CDATA[<p>Or&#8230; you can sudo cpan Algorithm::Evolutionary and download a nifty and venerable cpan module.<br />
The code looks nice, anyways, and just goes out to prove that Perl is as good a language as any other for programming evolutionary algorithms. Better than many others, in fact.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

