<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jeroens blog &#187; Skynet</title>
	<atom:link href="http://blog.bn2vs.com/tag/skynet/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bn2vs.com</link>
	<description>Blog of Jeroen De Dauw. The latest news on my open source work and interests.</description>
	<lastBuildDate>Fri, 23 Dec 2011 14:44:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Skynet released!</title>
		<link>http://blog.bn2vs.com/2010/01/30/skynet-released/</link>
		<comments>http://blog.bn2vs.com/2010/01/30/skynet-released/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 22:43:10 +0000</pubDate>
		<dc:creator>Jeroen De Dauw</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Artificial intelligence]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[GA]]></category>
		<category><![CDATA[GALib]]></category>
		<category><![CDATA[Genetic Algorithm]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Skynet]]></category>
		<category><![CDATA[SourceForge]]></category>
		<category><![CDATA[The Code Project]]></category>
		<category><![CDATA[Travelling Salesman Problem]]></category>
		<category><![CDATA[TSP]]></category>

		<guid isPermaLink="false">http://blog.bn2vs.com/?p=686</guid>
		<description><![CDATA[Today I released the first public beta of Skynet, which is now at version 0.1.3. Skynet is an implementation of GALib with WPF GUI that solves the Travelling Salesman Problem (TSP) using Genetic Algorithms (GA). It&#8217;s completely open source and available under the GNU General Public License. Downloads Skynet 0.1.3.zip 99.4 KB Skynet 0.1.3 setup.zip [...]]]></description>
			<content:encoded><![CDATA[<p>Today I released the first public beta of Skynet, which is now at version 0.1.3. Skynet is an implementation of <a title="GALib" href="http://wiki.bn2vs.com/GALib">GALib</a> with WPF GUI that solves the Travelling Salesman  Problem (<a rel="nofollow" href="http://en.wikipedia.org/wiki/Travelling_salesman_problem">TSP</a>) using Genetic Algorithms (<a rel="nofollow" href="http://en.wikipedia.org/wiki/Genetic_algorithm">GA</a>). It&#8217;s completely open source and available  under the GNU General Public License.</p>
<p><strong>Downloads</strong></p>
<ul>
<li> <a rel="nofollow" href="https://sourceforge.net/projects/csgalib-tsp/files/Skynet%200.1.3/Skynet%200.1.3.zip/download">Skynet 0.1.3.zip</a> 99.4 KB</li>
<li> <a rel="nofollow" href="https://sourceforge.net/projects/csgalib-tsp/files/Skynet%200.1.3/Skynet%200.1.3%20setup.zip/download">Skynet 0.1.3 setup.zip</a> 331.3 KB</li>
<li> <a rel="nofollow" href="http://csgalib-tsp.svn.sourceforge.net/viewvc/csgalib-tsp.tar.gz?view=tar">Download GNU tarball</a> (latest  version of the source project, straight from SVN)</li>
</ul>
<p>You can also download the project code directly via SVN from the   SourceForge source code repository, at <a rel="nofollow" href="https://csgalib-tsp.svn.sourceforge.net/svnroot/csgalib-tsp">https://csgalib-tsp.svn.sourceforge.net/svnroot/csgalib-tsp</a>.   From a command line, you can call the following:  svn checkout  https://csgalib-tsp.svn.sourceforge.net/svnroot/csgalib-tsp</p>
<p><strong>Application features</strong></p>
<ul>
<li>Graphical WPF interface</li>
<li>Multiple selection algorithms</li>
<li>Pause, resume and cancellation support</li>
<li>Control over mutation ratio&#8217;s and elitism percentage</li>
<li>Optional removal of identical twins or individuals</li>
<li>&#8220;Take over the world&#8221; button</li>
</ul>
<p><strong>Background</strong></p>
<p>The idea for creating this application came to me after reading the  first part of <a rel="nofollow" href="http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&amp;tid=11657">Bio-Inspired Artificial  Intelligence</a> by Dario Floreano and Claudio Mattiussi. I figured I  needed to do an implementation of what I&#8217;ve read to test myself. I split  up the general GA code from the application itself and created <a title="GALib" href="http://wiki.bn2vs.com/GALib">GALib</a>, a small C#  Library that provides the scaffolding for Genetic Algorithm based  functionality. All work was done in my free time.</p>
<p><a href="http://blog.bn2vs.com/wp-content/uploads/2010/01/Skynet-application-interface.gif"><img class="alignnone size-full wp-image-687" title="Skynet application interface" src="http://blog.bn2vs.com/wp-content/uploads/2010/01/Skynet-application-interface.gif" alt="" width="600" height="574" /></a></p>
<p>See <a title="Skynet/Screenshots" href="http://wiki.bn2vs.com/Skynet/Screenshots">this page</a> for more screenshots.</p>
<p><strong>Using the application</strong></p>
<p>Although the application interface should be pretty straight forward to use, I&#8217;ve written some documentation, which can be found <a href="http://wiki.bn2vs.com/Skynet#Using_the_application">here</a>. If you have any questions, let me know <img src='http://blog.bn2vs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>How it works</strong></p>
<p><a href="http://wiki.bn2vs.com/Skynet#How_it_works">This section on my wiki</a> explains how Skynet works as an implementation of <a title="GALib" href="http://wiki.bn2vs.com/GALib">GALib</a>. If you are  not familiar with how genetic algorithms work, you are advised to first  have a good look at <a rel="nofollow" href="http://en.wikipedia.org/wiki/Genetic_algorithm">this Wikipedia article</a> and related pages. This  section will introduce you to how GA logic specific to the TSP works in a  bottom-up fashion. For more information on the actual evolution, see <a title="GALib" href="http://wiki.bn2vs.com/GALib">GALib</a>. I&#8217;m also planning to write a Code Project article about this implementation of GALib.</p>
<p>This is a full dependency digram generated in a Visual Studio solution containing both the GALib and Skynet projects.</p>
<p><a href="http://blog.bn2vs.com/wp-content/uploads/2010/01/GALib-and-Skynet-dependency-graph.gif"><img class="alignnone size-full wp-image-688" title="[Click to enlarge] Skynet and GALib dependency diagram" src="http://blog.bn2vs.com/wp-content/uploads/2010/01/GALib-and-Skynet-dependency-graph.gif" alt="Skynet and GALib dependency diagram" width="599" height="602" /></a></p>
<p><strong>Points of interest</strong></p>
<p>Since my main motivation for creating this application was exercise, I  learned a lot from building it. It&#8217;s my first decent C# application, as  well as the first time I&#8217;ve created one using WPF and the first time  I&#8217;ve done any GA programming (or AI in general). It also gave me the  chance to familiarize myself with some of the new things of .Net 4.0,  some profiling tools (see screenshot below), and have some fun with navigation based windows.  The biggest challenge in the application itself (so not counting <a title="GALib" href="http://wiki.bn2vs.com/GALib">GALib</a>), was  definitely creating the crossover algorithm for the Route individual  type. At first I simply took half of the connections of one parent, and  then the other half from the other parent, but I rewrote this to take  all common connections. Although the crossover algorithm works fine now,  it&#8217;s pretty heavy on the cpu, and limiting the maximum speed of the  application severely. If anyone finds a way to speed it up, be sure to  let me know <img src='http://blog.bn2vs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://blog.bn2vs.com/wp-content/uploads/2010/01/ants-performance-profiler.gif"><img class="alignnone size-full wp-image-689" title="[Click to enlarge] Profiling of Skynet" src="http://blog.bn2vs.com/wp-content/uploads/2010/01/ants-performance-profiler.gif" alt="Profiling of Skynet" width="603" height="411" /></a></p>
<p>I&#8217;ve been working on this application on an off for a month now, and have implemented everything I&#8217;ve planned and more. Although a lot of cool stuff could still be added, I&#8217;m quitting active development of both this application and GALib, so I can focus on new projects that allow me to further expand my understanding of AI.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bn2vs.com/2010/01/30/skynet-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GALib with TSP implementation</title>
		<link>http://blog.bn2vs.com/2010/01/10/galib-with-tsp-implementation/</link>
		<comments>http://blog.bn2vs.com/2010/01/10/galib-with-tsp-implementation/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 01:21:03 +0000</pubDate>
		<dc:creator>Jeroen De Dauw</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[GA]]></category>
		<category><![CDATA[GALib]]></category>
		<category><![CDATA[Genetic Algorithm]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Skynet]]></category>
		<category><![CDATA[TSP]]></category>
		<category><![CDATA[Ttravelling Salesman Problem]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://blog.bn2vs.com/?p=650</guid>
		<description><![CDATA[Over the last week, I&#8217;ve been rewriting my Genetic Algorithm (GA) implementation of the Travelling Salesman Problem (TSP). I&#8217;ve rewritten pretty much everything, but the two most notable changes are: 1. I split the code into 2 projects: one holding the general GA code, which is now called GALib, and one holding the code specific [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last week, I&#8217;ve been rewriting my Genetic Algorithm (<a href="http://en.wikipedia.org/wiki/Genetic_algorithm">GA</a>) implementation of the Travelling Salesman Problem (<a href="http://en.wikipedia.org/wiki/Travelling_salesman_problem" target="_blank">TSP</a>). I&#8217;ve rewritten pretty much everything, but the two most notable changes are:</p>
<p>1. I split the code into 2 projects: one holding the general GA code, which is now called GALib, and one holding the code specific to the TSP, now called <a href="http://en.wikipedia.org/wiki/Skynet_%28Terminator%29" target="_blank">Skynet</a> (lol <img src='http://blog.bn2vs.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ). This allows for making any other GA implementation using GALib, even in .Net languages different from C#. The underneath diagram should give you a good idea of how the who thing works. The 4 most left classes are of Skynet, all remaining classes and interfaces are of GALib.</p>
<p><a href="http://blog.bn2vs.com/wp-content/uploads/2010/01/GALib-TSP-dependencyDiagram.png.gif"><img class="alignnone size-full wp-image-651" title="Dependency diagram of a Visual Studio solution containing the GALib and TSP app (Skynet)" src="http://blog.bn2vs.com/wp-content/uploads/2010/01/GALib-TSP-dependencyDiagram.png.gif" alt="Dependency diagram of a Visual Studio solution containing the GALib and TSP app (Skynet)" width="603" height="333" /></a></p>
<p>2. I rewrote the genotype of the Route individual type, the core of the TSP implementation. Instead of having a list of integers, referring to cities, I now have a list of Connection, each containing 2 instances of Location. I&#8217;ve done this to allow smarter <a href="http://en.wikipedia.org/wiki/Crossover_%28genetic_algorithm%29">crossover</a>, decreasing the chance of not finding a better solution while it&#8217;s still in the converged search space significantly. As a result of this change, I also had to rewrite pretty much everything else of the Route class, including random initialization, mutation and fitness assessment. The biggest challenge here was preventing the creation of multiple loops in the crossover algorithm.</p>
<p>The interface of the TSP app (now called Skynet) also has seen quite some work. I figured out quite a lot of <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation">WPF</a> stuff by further creating it. Some extra controls and progress indicators still need to be added though, and I also haven&#8217;t created the Cancel/Stop functionality.</p>
<p><a href="http://blog.bn2vs.com/wp-content/uploads/2010/01/GALib-TSP.png"><img class="alignnone size-full wp-image-652" title="Skynet interface showing 42 cities arranged in a circle" src="http://blog.bn2vs.com/wp-content/uploads/2010/01/GALib-TSP.png" alt="Skynet interface showing 42 cities arranged in a circle" width="592" height="662" /></a></p>
<p>Although the algorithm is efficient in the way that it takes relatively few generations to find a close to optimal solution, there remain a few mayor performance issues. If I compare the speed of evolution (measured in generations) with similar applications tackling the TSP, there are those performing up to 3 orders of magnitude faster. Although the fastest of those are written in C++ or C, I should be able to significantly speed up my application. Tracking down resource eating parts of code will be one of my next steps in developing this app. Another possible issue is diversity of the population. I have the suspicion that the diversity shrinks pretty fast, resulting into evolution driven only by mutation. I&#8217;m not sure of this though, and also have to investigate how I can prevent this from happening.</p>
<p>Here you have a few screenshots of the app in action <img src='http://blog.bn2vs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://blog.bn2vs.com/wp-content/uploads/2010/01/GALib-TSP-gen41.png"><img class="alignnone size-full wp-image-653" title="Skynet interface showing the evolved route between 42 cities after 41 generations." src="http://blog.bn2vs.com/wp-content/uploads/2010/01/GALib-TSP-gen41.png" alt="Skynet interface showing the evolved route between 42 cities after 41 generations." width="594" height="662" /></a></p>
<p><a href="http://blog.bn2vs.com/wp-content/uploads/2010/01/GALib-TSP-gen2-1470.png"><img class="alignnone size-full wp-image-654" title="Skynet interface showing the evolved route between 42 cities after 1470 generations." src="http://blog.bn2vs.com/wp-content/uploads/2010/01/GALib-TSP-gen2-1470.png" alt="Skynet interface showing the evolved route between 42 cities after 1470 generations." width="592" height="660" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bn2vs.com/2010/01/10/galib-with-tsp-implementation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

