Monday, March 26, 2012

Last Pet Project: Glowworm Swarm Optimization in C++

Lately @irrati0nal and I have been working on a C++ pet project: glowworm++
It is a C++ implementation of the Glowworm Swarm Optimization algorithm as described in the original paper from Krishnanand, K.N. and Ghose, D., Glowworm swarm optimization for simultaneous capture of multiple local optima of multimodal functions, published in Swarm Intelligence, 3, 2, June 2009, 87-124.

I wanted to practice TDD in C++ and was looking for an interesting pet project. So when I knew about @irrati0nal wanting to use GSO optimization for his research on protein docking, I asked him if he wanted to implement it in C++ with me and he gladly accepted. I had worked with genetic algorithms before and I thought that Bio-inspired algorithms were just beautiful.

We worked in short sessions once a week after work and in longer sessions during the weekend once a month, we called the long ones "hackathons". It wasn't difficult to follow the description of the algorithm in the paper, but we had to implement the coordinates and objective function code several times until we were happy enough with the result.

From the very beginning we wanted to release glowworm++ so other people could use it if they wanted. Now it's finally done. If you want to use it you can find the code here.

We applied TDD using the CppUTest framework and pair programming throughout the whole development. We are newbies in these two thecniques. We tried to do our best but, in the end, I think we did a nice job at TDD but not that good at pair programming. We had a lot of fun though. We need to read more about how pair programming works and how to do it well.
We also learn a lot of C++ and realize that we still have so much more to learn.

I'll try to improve my TDD and pair programming skills with my next pet project: I'm working with @remosu on a single page application using Backbone.js

In the near future, I'll have to devote most of my time after work to the UOC, so I won't have more time for glowworm++. However @irrati0nal is starting to use it in his research and will go on improving it to adapt it to his needs. Next summer, once the semester in the UOC is over, I'd like to use glowworm++ as well. I'll try to apply it to search special genetic networks.

@irrati0nal, thanks a million for all the good times we spent rubbing elbows together.


I've continued evolving the code in this fork.
I mainly fixed a bug, simplified the code a bit and used some C++11 new features.

Wednesday, March 14, 2012

Articles and Posts read

Inspiring and Curious
El fundador de Minecraft reparte 3 millones de dólares entre sus empleados

Living up to your potential is BS
Life off the clock
The Journey of the Apostles, National Geographic March 2012
How to manage a career in 2012

Learning and Software Craftsmanship
Thoughts On Learning New Things
Comedic genealogy
The power of value objects
Anemic Domain Model
Las buenas maneras de un programador
Choose Your Tools with Care
Road Thoughts - Apprenticeship
Los "malos olores" del código
Are programmers born or made?
Understanding Test Driven Development with Python, Agile Record 9
Pair Programming Harmful?
What I learned from Google - You get fifteen years

Agile and Lean
Agile practices for revision control, Agile Record 9
Introduction to Scrum - An Agile Process, Agile Record 9
Every software project I’ve worked on has used the "Spanish Theory" of project management, and its likely yours have too
Scrum, Kanban y la matriz de Eisenhower
Optimizar la felicidad del equipo de desarrollo

Trip Report: February 2012 C++ Standards Meeting
Sandwich Dilemma

Computer Science
Learning Natural Language Processing from Stanford — early review
Paradox of a CS major

Depression Is Linked to Hyperconnectivity of Brain Regions, a New Study Shows
Death threats, intimidation and abuse: climate change scientist Michael E. Mann counts the cost of honesty
Atención, pregunta: ¿Puede una universidad española convertirse en un referente a nivel mundial?
Un famoso ecólogo congoleño pillado in fraganti por plagiar multitud de artículos científicos
El postdoc, entre el continuo de la ciencia y las rémoras del pasado

Entrepreneurship and Management
Instantaneous Feedback
Magical Transformation
¿Te han despedido? Consuélate, a tu empresa tampoco le queda mucho tiempo
Tú no tienes una startup (ni falta que hace)
Esta es mi vida, pero no soy yo
Guía para calcular el precio por hora que debes cobrar por tus servicios
7 ideas para emprender en Internet desde España
Fish On Fridays II
Deuda Gerencial

At work
General Born Model Based On Surface Integral Formulation
Building Static Libraries and Test Program with Eclipse CDT

Spain and Europe
Borrando el I+D
Los recortes amenazan al único centro español que estudia las malformaciones congénitas
España, capital Madrid
Consecuencias actuales de la guerra del Peloponeso
Alemania no ahorra tanto como predica
Is Spain Waking Up? Pharoahs, Culture and Protests

Friday, March 2, 2012

How to install cppcheck and use it in Eclipse CDT

I have to thank my colleague Dani for this post.

Cppcheck is an static analysis tool for C/C++ code that we are using at work.
It's helping us to detect some problems that the compiler can not detect.

1- Install cppcheck:
  • Go to cppcheck project site and download the current version of cppcheck.
  • Untar it and compile it (e.g. "make" in the corresponding folder).
  • Move it to a convenient folder (e.g. /home/bscuser/ )
2- Install the cppcheclipse plugin to use cppcheck from Eclipse:
  • In Eclipse, go to Help > Eclipse Marketplace
  • Look for "cppcheclipse" in the bar and click in "install"
3- Configure it:
  • In Eclipse, go to Window > Preferences. In the C/C++ > cppcheclipse select the binary path (e.g. /home/bscuser/cppcheck-1.52/cppcheck)
Now we are going to configure cppcheclipse for this particular project.
The next menus can be found in Eclipse, go to Project > Properties.
  • The configuration in the cppcheclipse menu can be found in the following snapshot:
  • In cppcheclipse > Problems choose "Use project settings" and unselect "portability" (we are still not interested in this point). Keep the other ones selected.
4- Run it!
  • In the Project Explorer (by default at the left of the screen) right click on "src" and select cppcheck > Run cppcheck. Alternatively, use the shortcut: Shift + Ctrl + c.
The results are prompt in an alternative Console. To see them click on "Display Selected Console" and choose the "cppcheck" one, or open a new one with the "Open Console" button.
Have fun!