|
Algorithm 1 Genetic Algorithm |
|
Input: : a matrix represents the number of nodes required, P: population size, : crossover probability, : mutation probability, T: iterations |
|
Output: Routes: dispatch routes. Cost: dispatching cost |
| begin |
| 1: Initialize population with randomly generated chromosomes using natural number encoding; |
| 2: ; |
| 3: while do
|
| 4: for
to
P do
|
| 5: Evaluate fitness of each chromosome in ; |
| 6: end for
|
| 7: for
to
M do
|
| 8: Select parent chromosomes for crossover from ; |
| 9: end for
|
| 10: for
to
do
|
| 11: Perform crossover operation on selected parent chromosomes; |
| 12: end for
|
| 13: for
to
M do
|
| 14: Perform mutation operation on chromosomes in ; |
| 15: end for
|
| 16: for
to
M do
|
| 17: Decode chromosomes in using the decoding rules; |
| 18: Update chromosomes in according to the decoded results; |
| 19: end for
|
| 20: ; |
| 21: end while
|
| 22: end
|