30 Jan 2010 @ 11:43 PM 

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’s completely open source and available under the GNU General Public License.

Downloads

You can also download the project code directly via SVN from the SourceForge source code repository, at https://csgalib-tsp.svn.sourceforge.net/svnroot/csgalib-tsp. From a command line, you can call the following:  svn checkout https://csgalib-tsp.svn.sourceforge.net/svnroot/csgalib-tsp

Application features

  • Graphical WPF interface
  • Multiple selection algorithms
  • Pause, resume and cancellation support
  • Control over mutation ratio’s and elitism percentage
  • Optional removal of identical twins or individuals
  • “Take over the world” button

Background

The idea for creating this application came to me after reading the first part of Bio-Inspired Artificial Intelligence by Dario Floreano and Claudio Mattiussi. I figured I needed to do an implementation of what I’ve read to test myself. I split up the general GA code from the application itself and created GALib, a small C# Library that provides the scaffolding for Genetic Algorithm based functionality. All work was done in my free time.

See this page for more screenshots.

Using the application

Although the application interface should be pretty straight forward to use, I’ve written some documentation, which can be found here. If you have any questions, let me know :)

How it works

This section on my wiki explains how Skynet works as an implementation of GALib. If you are not familiar with how genetic algorithms work, you are advised to first have a good look at this Wikipedia article 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 GALib. I’m also planning to write a Code Project article about this implementation of GALib.

This is a full dependency digram generated in a Visual Studio solution containing both the GALib and Skynet projects.

Skynet and GALib dependency diagram

Points of interest

Since my main motivation for creating this application was exercise, I learned a lot from building it. It’s my first decent C# application, as well as the first time I’ve created one using WPF and the first time I’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 GALib), 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’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 :)

Profiling of Skynet

I’ve been working on this application on an off for a month now, and have implemented everything I’ve planned and more. Although a lot of cool stuff could still be added, I’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.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Posted By: Jeroen De Dauw
Last Edit: 30 Jan 2010 @ 11:57 PM

EmailPermalinkComments (0)
Tags
 24 Jan 2010 @ 11:31 PM 

Yesterday I released GALib version 0.1, a small C# Library that provides the scaffolding for Genetic Algorithm based functionality. It’s completely open source and available under the GNU General Public License. (See other blog posts about GALib) You can download both the source and compiled .dll from SourceForge.

I’ve done the effort to do some core documentation, in the form of comments in the source code, and an article explaining the usage of the library that I’ve put both on my wiki and on The Code Project.

Since my main motivation for creating this library was exercise, I learned a lot from building it. This is the first C# library I’ve ever written, as well as the first time I’ve done any GA programming (or AI in general). Abstracting the library in a way so that it can be used for GA in general was very interesting, and required me to expanded my knowledge of how to use interfaces and inheritance and use generics in a non-basic way for the first time.

I’m not planning to further develop this lib, although I might when I can re-use it for a future project. I hope to similarly release the first version of DownloadLib, which I’m having some lame multithreading issues with, before halfway through next week, after which I’ll start doing some development on Semantic MediaWiki.

Downloads

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Posted By: Jeroen De Dauw
Last Edit: 25 Jan 2010 @ 09:10 AM

EmailPermalinkComments (0)
Tags
 03 Nov 2009 @ 10:12 PM 

Last few months I haven’t really done a lot of .Net work, apart from the .Net DownloadLib project, and therefore also not released anything. After someone on The Code Project gave me a poke on an update to my custom made ProgressbarWithPercentage component I had promised, I made an update to that component and released it.

ProgressbarWithPercentage is not at version 1.0.10. The changes I made since the last release are:

  • Style support for XP and earlier
  • You can now customize the display format of the percentage

I also updated the demo, to include both an XP and a Vista/Win7 layout, and added a property grid that enables you to change the properties of the progress bars at runtime. On top of that, I decided it was a good idea to create a repository for this component on SourceForge, where you can now freely download and browse the code. I’ve send an update request to TCP with a new version of my article, but this has yet to appear.

Downloads:

Some nice screenshots of the new demo (click to enlarge):

ProgressbarWithPercentage v1.0.10 Vista/Win7 demo

ProgressbarWithPercentage v1.0.10 XP/earlier demo

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Posted By: Jeroen De Dauw
Last Edit: 17 Nov 2009 @ 02:51 AM

EmailPermalinkComments (0)
Tags
 28 Aug 2009 @ 12:20 AM 

While translating some of the C# code of MyDownloader to VB.Net for the .Net download library, I’ve already come across quite some awkward code. IMHO, the underneath example could go into the code horrors section of The Code Project.

        private void RestartDownload()
        {
            int currentTry = 0;
            Stream stream;
            RemoteFileInfo newInfo;

            try
            {
                do
                {
                    lastError = null;

                    SetState(DownloaderState.Preparing);

                    currentTry++;
                    try
                    {
                        newInfo = defaultDownloadProvider.GetFileInfo(this.ResourceLocation, out stream);

                        break;
                    }
                    catch (Exception ex)
                    {
                        lastError = ex;
                        if (currentTry < Settings.Default.MaxRetries)
                        {
                            SetState(DownloaderState.WaitingForReconnect);
                            Thread.Sleep(TimeSpan.FromSeconds(Settings.Default.RetryDelay));
                        }
                        else
                        {
                            return;
                        }
                    }
                }
                while (true);
            }
            finally
            {
                SetState(DownloaderState.Prepared);
            }

            try
            {
                // check if the file changed on the server
                if (!newInfo.AcceptRanges ||
                    newInfo.LastModified > RemoteFileInfo.LastModified ||
                    newInfo.FileSize != RemoteFileInfo.FileSize)
                {
                    this.remoteFileInfo = newInfo;
                    StartSegments(this.RequestedSegments, stream);
                }
                else
                {
                    if (stream != null)
                    {
                        stream.Dispose();
                    }

                    RunSegments();
                }
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (Exception ex)
            {
                lastError = ex;
                SetState(DownloaderState.EndedWithError);
            }
        }

Why? It uses breaks and returns in the middle of the code, like if C# is some lame generic language without selection structures. The use of the try-catch bloks also seems odd. Also have a look at the condition for the do while loop – lol. The only thing missing are a few GoTo statements, which would have convinced me to print this out and torture fellow geeks with :D

I started off translating this literally, but got so annoyed by the bad coding practice I decided to attempt to rewrite it. I say ‘attempt’, cause code written like that is not easy to understand, esp for people who are used to ‘decent’ structured code. I splitted the code into 2 subs instead of one, removed all breaks, returns, the insane do while true and put only the required code in try catches.

        Private Sub RestartDownload()
            Dim tryNr As Int32 = 0
            Dim stream As Stream
            Dim newInfo As RemoteFileInfo
            Dim reachedMaxTries, hasError As Boolean

            Do
                m_lastError = Nothing

                Me.SetState(DownloadState.Preparing)

                Try
                    newInfo = Me.ProtocolProvider.GetFileInfo(Me.FileLocation, stream)
                Catch ex As Exception
                    m_lastError = ex
                End Try

                hasError = m_lastError IsNot Nothing

                If hasError Then
                    tryNr += 1
                    reachedMaxTries = tryNr >= Me.Settings.MaxRetries
                End If

                If hasError And Not reachedMaxTries Then
                    Me.SetState(DownloadState.WaitingForReconnect)
                    Thread.Sleep(Me.Settings.RetryDelay)
                End If
            Loop Until Not hasError Or reachedMaxTries

            If hasError Then
                Me.SetState(DownloadState.EndedWithError)
            Else
                Me.SetState(DownloadState.Prepared)
                Me.RestartSegments(newInfo, stream)
            End If
        End Sub

        Private Sub RestartSegments(ByVal newInfo As RemoteFileInfo, ByVal stream As Stream)
            If Not newInfo.AcceptRanges Or newInfo.ModifyDateTime > Me.FileInfo.ModifyDateTime Or newInfo.FileSize <> Me.FileInfo.FileSize Then
                m_fileInfo = newInfo
                Me.AttemptToStartSegements(stream)
            Else
                If stream IsNot Nothing Then stream.Dispose()
                Me.RunSegments()
            End If
        End Sub
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Posted By: Jeroen De Dauw
Last Edit: 29 Aug 2009 @ 01:46 PM

EmailPermalinkComments (0)
Tags
 21 Aug 2009 @ 2:37 AM 

Now the Google Summer of Code coding period has finished, I can divide my attention between multiple projects again. Since I’ve been doing PHP and JavaScript only for over 2 months now, I’m starting off with taking a PHP-break. This means I won’t do any development of mayor new features for Maps or Semantic Maps, and definitely won’t work on any other PHP project. Of course I’ll still ensure bugs get fixed for my mapping extensions, and help people out with code when needed, but that’s about it. So basically I’m closing my Zend Studio, which has become one of my most used applications in the last months, and starting my Visual Studio again. Now I think of it, this is really awkward. I used to start my VS practically every time I booted my computer for over a year, and then only opened it a handful of times in a 2 month period.

So, what am I going to work on now? One of my last projects before I started GSoC was a VB.Net background file downloader, of which I released an article on The Code Project, and later on created a C# version. I got quite some positive feedback on this project by people, although it was initially created with the sole purpose of helping that needed a simple downloader someone out, to improve my own skills, and to demonstrate how to create a simple to implement downloader. I’m now continuing this project, by rewriting it from scratch, to both add some mayor new features, and mess around with some multi-threading stuff I’ve been wanting to try out for months now.

The mayor new features that will be added are simultaneous downloads (the current classes only support one download at a time), segmented downloads (woot!), download priorities and bandwidth limitation options. This will require a nice OOP approach, with some more advanced multi-threading. I’m basing part of my code on MyDownloader, an extremely nice C# downloader, which has quite some more functionality then what I’m doing. It’s more extensive then required for most people though, and not all that easy to implement. I also don’t really agree with some naming choices, and it lacks both code docs for devs that want to modify it, and devs that want to implement it. So clearly, I’ll put a lot of effort in keeping the new project as small and to-the-point as possible, and pay attention to easy of implementation, and usability. Another obvious difference is that this project is in VB.Net and not C#.Net. This has more advantages then disadvantages IMHO. If the project is compiled to a .dll or is used in a multi-project solution, it simply doesn’t matter what language it uses. A lot of casual programmers don’t know how to handle either, and the majority of these uses VB.Net, and not C#. And the ones that do know C# are more likely to know VB.Net then the other way around.

I’ve created a project on SourceForge to host the code, and be able to commit to the project’s SVN. Since the project now contains multiple classes, I renamed it to .Net DownloadLib.

After that project I’m planing to put some real effort into my mapping extension for MediaWiki again, and possibly to have a look at Python and Ruby. When school starts again, somewhere half way through September, some new project opportunities will probably arise for me, but I guess I’ll see that then. I’m also looking forward to ‘learning to program’ at school, which is destined to give me some great laughs. Luckily for me I’ll have to learn C++ at university, so I won’t be totally bored with it. I hope they don’t drive the low-level aspects of the language to far, since that’s pretty useless in today’s world IMHO.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Posted By: Jeroen De Dauw
Last Edit: 21 Aug 2009 @ 05:29 AM

EmailPermalinkComments (0)
Tags
 21 May 2009 @ 11:47 PM 

I’ve just released a new version of BN+ framework. It features a variety of new classes since version 2.0.2 plus some bug fixes and stability improvements. Also some classes have been added the the class library or control library repositories on BN+ Discussions, and a few of them now have detailed articles on The Code Project. Here you have an outtake from the release notes:

New classes
* BugSubmitter: A dialog that enables user to submit variouse types of bugs with build in validation. Sends it’s info to a webservice.
* PasswordDialog: Password editting dialog with optional authentication and live validation .
* SimpleLoginDialog: A simple login dialog that prompts for a password.
* FileDownloader: A class for downloading files in the background that supports info about their progress, the total progress, cancellation, pausing, and resuming. The downloads will run on a separate thread so you don’t have to worry about multihreading yourself.

Revised classes
* CryptoProvider: Now allows you to pass more advanced settings for AES and offers easier to use methods for RSA, DES and TrippleDES.
* CryptoStr: Has been rewritten to work with the new CryptoProvider and is now easier to use.
* Updater: A bug in the version compare algorithm has been fixed
* BruteForceAttacker: New version included (BN+ Framework 2.0.2 contained an unstable alpha build of this version)

* …

Further development
* The CyrptoProvider class will be rewritten from scratch and be made abstract, and serve as a base for separate DES, TDES, RSA and AES CryptoProviders.
* BruteForceAttacker will be made more modular and work on multiple threads.
* FileDownloader will get support for multiple downloads at the same time and segmented downloads.

I’d also like to thank everyone who helped with this project by providing bug reports, suggestions, contributions, or by simply using it!

If you are interested and consider to use this framework, please review the official topic and framework documentation.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Posted By: Jeroen De Dauw
Last Edit: 21 May 2009 @ 11:47 PM

EmailPermalinkComments (0)
Tags
 28 Apr 2009 @ 10:13 PM 

Half a month ago I published a .Net dialog, written in VB, that allows users to easily submit bugs and other feedback on an application. The dialog features 2 types of validation, submits the data to a webservice on a separate thread, and is designed to be very user friendly.

I’m very happy with the result, and I’m now using this dialog in all of my .Net applications. I also got quite some positive feedback from people. This  prompted me to create a more extensive article with examples and an explanation of how to create a webservice that handles the bug report. You can find my new article on the Code Project.

You can download the source code here, and find Dutch support here. For english support, please refer to the Code Project or the relevant article on BN+ Discussions.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Posted By: Jeroen De Dauw
Last Edit: 28 Apr 2009 @ 10:13 PM

EmailPermalinkComments (0)
Tags
 27 Apr 2009 @ 10:13 PM 

About a week ago I published A FileDownloader class written in VB.Net. This class enables you to easily download multiple files in the background (via a separate thread), and will provide information about the amount of downloaded data, the percentage of completion, and the download speed. On top of this, you can cancel downloading, pause it, and of course also resume.

Yesterday I started working on a C# Implementation of this class, with as goal to both increase my C# knowledge, and mess around with WPF (which is used for the demo app). I had a lot of fun creating this new version, and definitly learned a lot. It’s completely finished, documented and tested, except for 1 small WPF issue. I’m hoping to release the class tomorrow, but can already provide you with a preview screenshot:

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Posted By: Jeroen De Dauw
Last Edit: 27 Apr 2009 @ 10:13 PM

EmailPermalinkComments (0)
Tags

 Last 50 Posts
 Back
Change Theme...
  • Users » 1293
  • Posts/Pages » 169
  • Comments » 119
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About me



    No Child Pages.