Archive for December, 2007

Genetic Algorithms in Haskell

I started with the idea of playing around with Genetic Algorithms (GAs) in Haskell.The links I found were to two research papers, not two implementations. Each research paper takes a different approach to developing a GA library, and includes some code as an example.

The two approaches differ mainly in the representation of the genome for the GA. The trade-offs are outlined below.

An Array of Bits

The genome is represented by a bit array :: (Fitness, [Bool]). This is the approach taken by the authors of “A Genetic Algorithm Framework Using Haskell”.

Advantages

  • easy expression of GA algorithms

Disadvantages

  • challenging to encode/decode problem space to a bit array :: [Bool]

My memory of this from Uni is that we spent lots of time simply constructing an appropriate representation in a bit array (in C++), and then building useful fitness functions. The GA framework then did all the heavy lifting as a black box.

I’d really hope there was a more elegant way of representing the Genome using general types. In nature, the genome is essentially a giant array of 2 bit values. GATTACA. However, it takes the entire planet to calculate the fitness function.

Type Classes

The genome is represented by a generic type. The basic operators are then expressed using Haskell type classes. This is the approach taken by the authors of “Genetic algorithms in Haskell with polytypic programming

Advantages

  • logical mapping of problem to genome

Disadvantages

  • requires polytypic language extensions to generalise algorithms
  • polytypic extension requires additional compilation step
  • current polytypic extension limits haskell features used

The polytypic solution is quite elegant in allowing functions such as mutate to be written once and apply to many types. That said, it does introduce some restrictions.

The challenge is to abstract the combinators of Genomes without requiring polytypic extensions. Otherwise, consumers of the library will need to write appropriate library functions specific to their types. This may be more time consuming than mapping the problem space to an array of bits.

My theory is that a well written GA library should be possible that caters to the majority cases for data structures without needing to resort to polytypic extensions. This should allow the consumer of the library to utilize the full power of Haskell without spending time writing too much GA specific code.

Canon 1D Mark III

Canon
I was lucky enough to have a Canon 1D mkIII on loan to play with for a few weeks, along with the wireless kit and a 24-70mm f2.8. The purpose of the loan was to demonstrate it to a customer of ours. To do that, I spent some time with the camera. These are my impressions.

It is rather heavy. Compared to my 350d, it is actually very heavy. Add on the 24-70mm lens, a 580ex flash, the wireless kit and you start to feel like a serious photographer. The sort that would go chasing celebs around for fun.

The downside to all that seriousness is my 50mm f1.8 looks ridiculous on it.

The speed of this camera is just brilliant. If I was shooting sports I’d be incredibly excited by it. Add in the low noise and high iso and you’ll find yourself getting shots you wouldn’t have before. The live view is fun to play with, but unless you’re doing lots of studio or product work, I’m not that sold on it. The viewfinder is so crisp, I was more than happy to use that.

The wireless kit is something of a strange beast. If you need wireless, then it has enough features to suit most needs. It can FTP to a server, or shoot to a USB hard drive, or allow remote shooting with live view over wireless, or act as a web server with camera controls active from a browser.

Enabling wireless tended to make the camera a bit flakey during the configuration process. It was usually okay once things were working. For the purposes of our demonstration, it worked flawlessly. Using the camera in the audience to shoot pictures that turned up on the main projector added a touch of immediacy and wow.

The bit that kills me is the price. The wireless adaptor just isn’t that cheap for what it is. It is a feature you would really need to have to justify the expenditure. And I’m not so sure you’d really need it. Again, product photographers or studio photographers seem to be the main purpose. Showing off at tradeshows would be the other use. I’m still hoping we can have one in the office for that.

I was sad to give it back, but ultimately it is too much camera for the level I’m shooting at. The features I liked are available on the 40d, so like the rest of the planet, I’m waiting for the next revision of the 5d. The full frame is going to work nicely with my fisheye and the reduced weight means it will spend more time at the snow.

Photos from the 1D.

Mobilizing Minds

Mobilizing Minds takes the ideas from a range of sources, including the Origins of Wealth and the authors own experiences, to create a blueprint for the 21st century organization.

It adds to the extensive literature on the War for Talent, but with a twist. Rather than compete on talent acquisition, compete using talent utilization; getting the most out of the people you already have.

The journey covers all aspects of the firm, including organization, strategy, resource allocation and basic mindsets.

Through the POI (Portfolio of Initiatives) process, then, the company can grow entrepreneurs. And these will be the individuals who can create new wealth in the 21st century.

No one company currently embodies all of the ideas in this book (the authors create a fictitious company to discuss), however the ideas are turning up in many of the successful companies of recent times.

For example: Google allocates staff using a talent marketplace, GE and Microsoft manage strong portfolios of initiatives (POI) and several companies are starting to manage using leadership teams (see The Will to Lead for more on this).

If you are looking for a good summary of managing a firm in the 21st century firm, this is a great book. It is a good blend of theory and practical application that I’ve not found in other books.

People at my company are going to be hearing many of these ideas over the coming months as I believe it possible to realize some of the benefits. Not that it will be easy. Some of the basic metrics for measuring progress, such as profit per employee, can be quite complex to calculate.

Looking Sideways, the Art of



Dreams

An export reckons that people who use their visual imagination during the day — artists, designers, architects, photographers, film directors and the like — rarely have spectacular mind-blowing dreams. These, paradoxically, tend to be bestowed on those whose daily work is more predictably routine.

— The art of looking sideways, p67

Ideas

Statistics state that in London you’re never more than seventy feet away from a rat. I often feel the same about finding a solution to a problem. You can’t come up with the answer but know that it’s hanging around somewhere.

Everything is connected to everything else and searching for solutions often requires being alert to spot the unlikely connections …

— The art of looking sideways, p76

Intelligence

Indeed ants are so much like human beings as to be an embarrassment. They farm fungi, raise aphids as livestock, launch armies into war, use chemical sprays to alarm and confuse enemies, capture slaves, engage in child labour, exchange information ceaselessly. They do everything but watch television.

— The art of looking sideways, p118

Paradigms

‘There is nothing more difficult to take in hand, more perilous to conduct, more uncertain in success, than to take the lead in introducing a new order of things’, wrote Machiavelli, ‘because the innovator will have for enemies all who have done well under the old conditions, and only luke-warm defenders who do well under the new.’

— The art of looking sideways, p110

The art of looking sideways is Alan Fletcher’s ode to design, creativity, life and everything in between. Loosely arranged in 72 chapters, I’m only partially through the book as it is quite dense in information. This is a book that I find myself dipping into for inspiration. A book that is likely to be close to hand for as long as I can read.

Design is not a thing you do. It’s a way of life.

— Alan Fletcher

It’s Always a People Problem

From The Secrets of Consulting:

The Second Law of Consulting: No matter how it looks at first, it’s always a people problem.

This was a book I read a few years ago, and this quote has stuck with me as it continues to resonate. Even technology decisions are really people problems.