JHeatChart: heat map charting for Java

More than once over the last couple of years, my research has required me to be able to visualise 3-dimensions of data in a way that is achieved perfectly by a heat map. The most convenient approach is if I can generate the charts on the fly during execution of my experiments. However, it seems that very few of the many many charting APIs that are out there seem to contain the facility to create heat maps (heat charts). The newer releases of JFreeChart do contain some support for heat maps, but they’re hard to get to grips with amongst the unwieldy mess that is the JFreeChart API.

My solution was to knock up a quick and dirty bit of code to draw the heat maps that I wanted. I’ve now tidied this code up and generalised it so that it can provide extremely simple solutions to most heat map requirements. You can easily grab the generated charts as an Image object or save them to disk as a png, jpg or gif. So, here it is, free to use and modify as you see fit, under an LGPL license.

Here’s an example of something it threw out with just a few lines of code:

A basic heat map generated with JHeatChart


Downloads, javadoc and example code are all available on the JHeatChart project website.

Tagged with: , , , , , , , ,
Posted in Java

Positional Effect of Crossover and Mutation in Grammatical Evolution

Not exactly a catchy title is it. But that’s the name of the paper I’ve just had accepted for the 2010 EuroGP conference in Istanbul, Turkey. For interested parties, here is the abstract:

Abstract. An often-mentioned issue with Grammatical Evolution is that a small change in the genotype, through mutation or crossover, may completely change the meaning of all of the following genes. This paper analyses the crossover and mutation operations in GE, in particular examining the constructive or destructive nature of these operations when occurring at points throughout a genotype. The results we present show some strong support for the idea that events occurring at the first positions of a genotype are indeed more destructive, but also indicate that they may be the most constructive crossover and mutation points too. We also demonstrate the sensitivity of this work to the precise de finition of what is constructive/destructive.

And the full paper is available as a pdf, and postscript.

Tagged with: , , ,
Posted in Genetic Programming

Website optimisation

I’ve been doing some performance work on Devex-Templates lately and spent some time reading up on web optimisation and compression techniques. While there are many many articles about optimising websites around, one excellent one I’ve been referring to is http://developer.yahoo.com/performance/rules.html. It covers all the usual ground, but there are a few ideas I’d not heard before and some nice tips, so I thought it was working linking to.

While on the topic of optimisation, I might as well also put a pointer to a decent analysis tool so you can check the load times of your website: WebPageAnalyzer.com. I should probably note that I’m not affiliated to either of these websites, merely a grateful user.

Tagged with: , ,
Posted in Web development

Automatic programming from informal specifications

One of my worries about genetic programming is that we may just be shifting the problem of programming to the (equally difficult?) task of problem specification in the fitness function. This would be similar to the move made from assembly language to higher level languages such as Fortran in the 1950s. At the time this was seen as essentially solving the problem of programming, but that clearly isn’t the case, the problem was merely shifted to a different (albeit easier to understand) paradigm. In the 50s there were advantages such as easier to read and debug code, and shorter programs. Now, if we make the complete shift to formal specification for an evolving generator, what will the benefits be?

Initially it seemed to me that this would be a no-win situation. By requiring a formal definition of the problem, non-trivial programs are still going to require non-trivial specifications. Further, the skill of writing non-ambiguous and correct formal specifications is a challenging task requiring a reasonably in-depth knowledge of logic and the sort of mathematics that many shy away from.

What would be the ideal situation? Ideally any average non-programmer would be able to generate a program by doing no more than describing what it should do. That is still infeasible, but if we could automatically generate programs from an informal requirements document, then that would be a useful step! This has more practical potential than is immediately obvious. There has been a rather large amount of research, going back as far as the 1980s, into automatically generating formal specifications from informal, natural language definitions. Some of the results appear very impressive. So, if we are able to generate formal specifications from something close to natural language, and if we are able to automatically generate computer programs that satisfy those specifications, then it immediately becomes obvious that we can combine these two steps. We can generate programs from an informal description with very little expert interference. That is the theory at least.

This is not trivial in practice since there are difficulties in expressing formal specifications such that they provide a fitness function which rewards partial solutions and the generation of the specifications from natural language is farĀ  from perfect. However, these problems are certainly solvable and the solution would be a major step towards an admirable aim.

Tagged with: , ,
Posted in Genetic Programming

A new face for EpochX.org

XGE is a serious research tool for grammatical evolution


If you haven’t already heard – EpochX is an amazing new research tool for evolving computer programs using genetic programming. But then I would say that – I helped write it :). For information about EpochX you should see the website, which as it so happens is what this post is all about.



I have just launched the redesigned EpochX website at http://www.epochx.org. The new website is generally clearer and easier to use, it also incorporates the new branding imagery. There is also a discussion group available which will hopefully provide an avenue for questions, feedback and announcements. A sub-site is incorporated for XGE, the grammatical evolution version of the software. The XGE website is accessible directly at http://xge.epochx.org.

There is more work to be done on the website, particularly providing resources such as tutorials and indepth guides. These will come over time, and be published to the website when they’re completed, as will improvements to the code itself.

Tagged with: , , , , ,
Posted in Genetic Programming

Eclipse search – a force for good! (and line counting)

There are tons of excellent plugins for profiling code in eclipse. But that’s probably a bit heavyweight if all you’re after is a crude idea of how many lines of code you’ve written. Obviously you could just turn on line numbers and count the bottom line number in each class on your favourite calculate app. But thats going to get tedious for 20, 100, 1000 files, but ah ha! There is an easier way.

The search facility of Eclipse is extremely powerful, and as well as being good for searching for a snippet of text or a specific declaration, its facility for regular expressions opens up a world of possibilities. But how do you count line numbers you say? Well, allow me to tell you…

Ensure the project you wish to count line numbers for is selected in the Package Explorer. Then, go to the search menu and hit the File… menu item. The search dialog should open on the File Search tab.

Eclipse's search functionality makes all-sorts possible

Eclipse's search functionality makes all-sorts possible

On the right, check the box to use regular expressions and enter our search term as the new line character “\n”. We need to make sure we’re only searching source files, so for file name pattern enter “*.java” if it’s Java you’re working with, or whatever file extension your language choice uses. Finally, make sure Enclosing projects is the selected scope at the bottom. If you wanted to count line numbers over multiple projects you could use workspace or a working set. And we’re done. Hit the Search button and allow Eclipse to do its thing.

Bosh! The number of matches returned is your line count. Of course, this includes comments and blank lines. But if you were picky about it you should be able to write a more fancy regular expression to get what you want.

Creative use of the search feature makes all sorts of other repetitive tasks easy. For example, I used the replace facility yesterday to quickly insert a GPL licence message at the top of every java file, just by searching and replacing on package names. A powerful tool to keep in mind!

Tagged with: , ,
Posted in Eclipse

EpochX: genetic programming for research

The first beta release of EpochX is now available under an LGPL licence from www.epochx.org.

EpochX is a tree based Genetic Programming API written in Java. It is written with GP researchers in mind and makes it simple to analyse runs in real-time. It is designed inside-out to be easy to get started with but with maximum flexibility for modification and extension, to make it easy for you to carry out your own research, gathering whatever statistics are relevant and ignoring any that aren’t.

The first full release will be a couple of months away, but the beta release is generally stable and very usable – we’re already using it for our own research!

Tagged with: , , , ,
Posted in Genetic Programming

Generating Javadoc with Eclipse

Whenever you prepare a release of a Java project, it’s a good idea to create some Javadoc documentation to accompany it. This is especially true for an open source project. Generating Javadoc with the Eclipse IDE really couldn’t be much easier.

  1. Select Project -> Generate Javadoc… from the menubar.

    Eclipse's Javadoc dialog

    Eclipse's Javadoc dialog

  2. The first time you use the Javadoc tool, you may need to set the Javadoc command. Hit the configure button and navigate to the bin directory of your JDK, you’re looking for javadoc.exe. On windows this is likely to be something like: C:\Program Files\Java\jdk1.6.x_xx\bin\javadoc.exe, on linux it may be more like /usr/bin/javadoc.
  3. Check the checkbox for the project you want Javadoc to be generated for.
  4. You probably only want Javadoc for members with Public or Protected visibility.
  5. Hit Finish, and that’s it. Your Javadoc will be generated in a doc directory in your project root.
  6. Open doc/index.html in your browser to view.

Remember that the quality of your Javadoc is dependent on the quality of your comments. For information about writing good doc comments see the Sun style guide.

Tagged with: ,
Posted in Eclipse, Java

A Java Enigma implementation

I’ve just released the first version of JEnigma, a java API to implement the Enigma cipher. It’s a simple piece of code which is easy to use to create a virtual enigma machine, with any combination of rotors, plugboard and reflector. It’s mainly been written as an exercise out of a personal interest in classic ciphers. However, anyone wishing to write an enigma implementation or perform any cryptanalysis on enigma ciphers are likely to find this useful.

It could do with some more work, but I was keen to start getting some of these projects published. Later versions will implement the enigma’s ring and provide better support for the historical versions. I might also consider adding some features aimed at cryptanalysis.

Tagged with: , , ,
Posted in Cryptography