In natural selection, Negative Selection is the selective removal of alleles that are deleterious. This can result in stabilizing selection through the purging of deleterious genetic polymorphisms that arise through random mutations.
The algorithm is very simple. I suggest you read the pseudo code to understand. This implementation is based on pseudo code from Trombini's book.
r = threshold of affinity dim = input dimensions counter = number of lymphocytes to be created self_tolerants_ALC = Array of lymphocytes to be created