#include "optimizer/geqo.h"

Go to the source code of this file.
Functions | |
| void | geqo_mutation (PlannerInfo *root, Gene *tour, int num_gene) |
| void geqo_mutation | ( | PlannerInfo * | root, | |
| Gene * | tour, | |||
| int | num_gene | |||
| ) |
Definition at line 39 of file geqo_mutation.c.
References geqo_randint.
Referenced by geqo().
{
int swap1;
int swap2;
int num_swaps = geqo_randint(root, num_gene / 3, 0);
Gene temp;
while (num_swaps > 0)
{
swap1 = geqo_randint(root, num_gene - 1, 0);
swap2 = geqo_randint(root, num_gene - 1, 0);
while (swap1 == swap2)
swap2 = geqo_randint(root, num_gene - 1, 0);
temp = tour[swap1];
tour[swap1] = tour[swap2];
tour[swap2] = temp;
num_swaps -= 1;
}
}
1.7.1