27.2.13

The frustrating attempt at obtaining a stable population size

Todays post is summed up nicely by its title. Two weeks after 'finishing' model construction, I am still finding bugs in the code and still tearing my hair out at trying to get my simulation to generate a stable population size.

With my 'glass is half full' head on, I say to myself that this time has been good and constructive and I'm glad I've found these niggly gremlins now rather than in a month when I've done my analysis and handed in my transfer report. And yes, this is true, but my 'life sucks' head says, why have I been so stupid as to code in these bugs in the first place? Have I not had years of coding experience by now? Am I not a reasonable programmer? Perhaps not? So yes, these bugs are MY fault. I am THAT stupid and model verification is the bane of my existence!



Coding has to be the worlds best way to make you doubt your own abilities and really look hard at yourself. Inevitably I find that a few hours of brilliant genius coding effort leads to some very strong hair-pulling out tactics a few weeks later when the 'simple' changes have done strange and unpredictable things to my agents and the way they behave. So strange in fact that it frazzles my tiny little brain trying to understand why my model is behaving in the way it is.

Agent-based models, it seems, really DO reflect complex systems. Or is it just my bad coding? Only time will tell.

Yesterdays coding blunder, after frustratingly trying to figure out why my population get exploding after about 12 years, was that not all my agents were NOT under-going their 'lose some energy every time step' step. And that only the ones who were actually eating food were doing this, meaning those agents that chose not to eat were perfectly happy and never suffered any negative consequences from choosing to perform actions that denied them the potential to consume resources. This at least explains nicely why my male agents were choosing to move incredibly long distances along trails (that provided no food).

So yes, in essence I am happy I found this bug. But todays problem is finding a set of parameters values that now fixes the opposite problem - generate a population that doesn't fall to zero within about 10 years.

Oh, the joys of programming.




No comments:

Post a Comment