Abstract. Many bacteria carry gene complexes that code for a toxin-antidote pair, e.g. colicin systems. Such gene complexes can be advantageous for its host by killing competitor bacteria while the antidote protects the host. However, in order to evolve a novel and useful toxin first a proper antidote must be evolved. We present a model of bacteria that can express and evolve such allelopathic systems. Although in the model novel types must evolve from existing types we find that nevertheless in general a high diversity of toxins evolves and, as a sideeffect thereof, generalized immunity mechanisms. We interpret the allelopathic systems in terms of an optimization problem: fitness cases are toxins and solutions present (potential) antidotes. As a side-effect of the evolution of allelopathic systems generalized solutions of the optimization task are evolved as well.