Description
2 particle swarms compete in a game of matching pennies.
| 1, -1 | -1, 1 |
| -1, 1 | 1, -1 |
Nash equilibrium: {0.5, 0.5}. During each round of play, the swarm is allowed to optimize it's play versus the opponents' last played strategy. The swarm is hardwired with a max change of 10% each round.
Display
During each round a box is drawn for the current strategy of both swarms. Both strategies start out random. White denotes %0 in A, black is 100% A. Boxes are drawn, line by line, until the end of the screen, then repeated starting at the top. The right-most box is reserved to display the current average play.
Analysis
Both swarms quickly reach equilibrium play and stay there. Depending on the max allowed change, oscillations occur around the equilibrium, with a period that increases linearly with allowed change. The average however, is consistently at the Nash.
Below is the same swarm optimization algorithm on 2 dimensions. The swarm attempts to minimize the distance between itself and the mouse pointer. Left-clicking adds "attractors" the swarm is attracted to. Right-clicking removes attractors. Black dots are the swarm particles, red is the best current solution (last 10 solutions are kept). This has zero purpose, not that the other applet had a purpose, but it sure looks cool.