I need help help for defining mutation operator for traveling salesman problem.
I'm currently using this now (pseudocode):
mutate ( strand ):
for n in random_interval ( min_gene_index, max_gene_index ):
i := random_interval ( min_gene_index, max_gene_index );
j := random_interval ( min_gene_index, max_gene_index );
swap ( strand[i], strand[j] );
So when swapping is executed two cities in the route is swapped. The goal is that it needs to be fast and effective. I don't want it to be a performance hit in the main loop. Can I improve my implementation or is there any other alternative that is better?