Cellular Automata and Swarm Intelligence

I have been playing around with HxCAS a little bit today in preparation for a demonstration the team and myself are giving tomorrow. For a while I have been wanting to write a small CA program that demonstrates some very simple swarm intelligence. Today I finally got it working 🙂

The program is quite simple. The goal of the swarm agents are to locate a beacon. So the agents will randomly roam about looking for any beacon. If they find a beacon or another agent which has reportedly found a beacon then they will stop and report the found beacon. (Thus they can tell any other agents in the vicinity that they found a beacon) While the agents roam about they have the potential to crash into each other (which will result in one of the agents being lost)

I have added the world (complete with rules and colour settings) to the newly created Downloads page. Feel free to play around with it. Note that you will need the latest version of HxCAS to run the compile the rules as I had to add a function the the standard library to get it all working nicely.

Google Analytics – There is always a price

I track the hit count of this Blog with Google Analytics. It is the first time I am personally using the service and so I will share my thoughts thus far about it.

Firstly it is simple enough to add to your website. Just register on the Analytics web site, add a bit of Javascript to your site and you’re off. There is a simple WordPress plugin that I have used for this site that adds it for you and thus all you have to do is specify the unique identifier that Google gives you when you register.

It seems to take a while to kick in but before you know it all the collected data can be viewed on the Google Analytics web site. When you log in you are confronted with a control panel (more like a reporting/statistics panel … thing). You are able to view all sorts of metrics – such as the location of your visitors and the time the spent on your site. You can track which other sites have provided the web traffic to your site. There is also a handy little tool (in beta at the time of writing) which allows you to view real-time statistics of your site.

There are however some things that I am unhappy with (which is expected – you can’t please everyone). First of all the default date range never seems to include the current day. You can of course select different pre-defined date ranges such as “today” but this is all unnecessary clicking that could have been avoided. Another problem is that there are many…and I mean many different metrics that can be customised and added and removed and changed – it is all a little overwhelming especially considering there are no clear guidelines on how to use some of the metrics or what they even mean. However the most irritating thing to date is trying to filter your own traffic from being logged. In some cases in can be simple, such as simply excluding an IP address. This is however South Africa – all us home internet users have dynamic IP addresses assigned to us by our ISP and this makes it very difficult to try and filter the traffic. Other methods include dabling with the Javascript and adding cookies to the machines that you expect to access the site from – not at all ideal.

Today however I had an idea and searched for a browser extension that could block Google Analytics scripts from running. First it was Hallelujah as Google makes there very own “Opt Out” plugin from Chrome. I never got round to installing it though since the most voiced complaint was that you cannot specify which sites you want to block – it is the all or nothing approach. I expected more from Google at this point. However I didn’t give up and continued the search. I quickly came across another plugin (Analytics Blocker) that did exactly the same but (drum-roll) – allows one to specify the sites. I had a little bit of trouble with the wild-card specifications since it didn’t always seem to work, but I think I have it sorted. I have been viewing my real-time statistics on Google Analytics and it now seems to work.

I think I have ranted enough now (feeling much better)

Use cases – Menace or Miracle

I am sure I can say that any programmer who has been involved in any sort of formal software engineering will agree with me when I say that the process of formalising a system in documentation is tedious and boring. In many cases it has been found that too many resources has been spent on documentation for the benefits it has brought about which is why agile development methodologies have become more and more popular.

However, it doesn’t matter what type of methodology you are using when developing a complex system, there is still some documentation that always seems to exist. The first is of course some sort of requirements specification. History has shown that incomplete requirements is one of the main reasons software projects fail. The next piece of documentation that seems to always exist in one form or another is some sort of behavioural overview of the system that depicts how users interact with the system. This is normally shows the goals that the system needs to accomplish. In agile these are normally user stories. Similar to user stories are use cases which are depicted using use case diagrams and explained using use case narratives. During this past year (with the final year project) I had become tired of use case diagrams, at one stage I was basically eating and breathing them.

I am currently developing a complex system. I am the only developer and I know what the system needs to do. I couldn’t believe my own surprise when I ended up drawing use case diagrams for the system on my whiteboard. They just seemed to capture the essence of what the system needs to do and how it interacts with the users. Normally I would start hacking away at a new software project of mine, but here with one that I hope to expand to sell one day I just felt more comfortable in formalising in what the system will do – it provides a measure of confidence. This sort of documentation has always accompanied a fear of “what if I forget something”, but now I see that this is forcing me to actually take some time to think and brainstorm of absolutely everything.

So, is all this planning and formalising a system a complete waste of time – probably not. There is an entire industry that will probably back me on that answer. I know how frustrating it can be sometimes, especially for those doing these sorts of projects at university for the first time – trust me when I say that it is all done for a reason.

The end of an era approaches

I am two more results away from finishing my degree. The highlight and the greatest challenge of the year has been the final year software engineering project. The project was a resounding success – and so have dedicated a page to it (See HxCAS ).

It seems that each year goes by faster than the previous. The past three years have become a blur. I have sent in my registration for my Honours degree – which ought to be very interesting indeed.