Skip to content
Genetic algorithms, evolutionarily stable strategies, and the loser/winner effects
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
gaLW.tar.gz

README.md

Genetic algorithms, evolutionarily stable strategies, and the loser/winner effects

(A long time ago, around the year 2000) I spent some time working on the loser/winner effects. This is a problem that requires game theory (what is a good strategy depends on what your opponents do) but I could not find simple analytical solutions. So I used genetic algorithms, which seems natural enough here since we are dealing with the evolution of behavioral strategies.

There are several libraries for genetic algorithms. I started using galib, a very nice library. However, I found it hard to use of it for my problem, where fitness is the result of repeated interactions between the genotypes (and not something you evaluate in a sweep over the population at each generation); this is doable with galib, but I found it hard and awkward. Thus, to learn more C++ and to have more control, I wrote a set classes and methods for genetic algorithms (ga.cpp, ga.h). And the code for the loser/winner part (fighting.cpp), plus a few helper functions, etc.

Please note that the documentation is non-existent (you'll need to read the comments), that there are a few comments in Spanish and spanglish, and that indentation and line width are "peculiar" (set to fit my monitor and usage of XEmacs). Its been a while since I worked on these issues. But I'd appreciate that, if you use this code, you let me know.

To run it you will need to install Blitz++ and libRmath, the stand-alone math library from R. If you use Debian GNU/Linux, this is as easy as:

apt-get install blitz
apt-get install r-mathlib

I've also run it with other GNU/Linux distributions.

Download the code. This software is released under the GNU GPL.

You can’t perform that action at this time.