Skip to content
nkscape - Kauffman NK fitness landscapes in Python

nkscape

An open-source project by

  • Python
  • NumPy
  • NK model
  • Agent-based modeling

nkscape is a Python library for Kauffman NK fitness landscapes and NK-based agent-based models of organizations, in the tradition of Levinthal (1997), Rivkin and Siggelkow (2003) and Wall (2016). An organization faces N binary decisions with K interdependencies each, its performance comes from random contribution tables, and agents search the landscape with rules you write yourself.

A model consists of a landscape, agents and population rules. The library runs a population period by period, records every configuration and its fitness and can look at a whole landscape at once: all peaks and the global maximum for N up to 24. There is no global random state. Every function takes a seed, and an agent walks the same way alone as in a crowd, so results are reproducible on every machine.

The library is tested, typed and documented, and it is validated by replicating published results: a notebook reproduces Figures 1 to 9 of Levinthal (1997). It needs Python 3.12 and NumPy, nothing else, and is published on PyPI under the MIT licence.