Research Article
AITSO: A Tool for Spatial Optimization Based on Artificial Immune Systems
Algorithm 1
A C# code sample demonstrates how the common operator works.
| for (int i = 1; i < nNewPop. Count; i++) | | { | | // nNewPop is a list object used to store antibodies | | double nStdAff = (double)(nNewPop[i]. Affinity - MinAffinity)/nAffinityRange; | | // Calculating the mutation rate based on the affinity of the | | // antibody and the generation. | | double nMutationRate = Math.Exp(−2 * nStdAff)/(nCurGeneration); | | CSAntibody nAb = nNewPop[i]; | | // nProblem is an instance of CSOptimizationProblem | | // Call the standard interface "MutateAb" to accomplish the mutation operation | | nProbiem. MutateAb(ref nAb, nMutationRate); | | } |
|