#include "postgres.h"
#include "optimizer/geqo_mutation.h"
#include "optimizer/geqo_random.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; } }