(i) | Input: population_size, crossover_rate, mutation_rate, interactive_generation, termination_generation |
| Output: none |
| (1) generation = 0 |
| (2) population[generation] = initialize_population(population_size) |
| (3) model = KDT.build(DB.dataset()) |
| (4) While generation<=termination_generation do |
| (5) model.prediction(population[generation]) |
| (6) If generation > interactive_generation && is_adjust() then |
| (7) adjust(population[generation]) |
| (8) end If |
| (9) evaluate(population[generation]) |
| (10) DB.save(population[generation]) |
| (11) chromosomes = encode(population[generation]) |
| (12) While(population[generation+1].size() < population_size) do |
| (13) pairs = select(chromosomes) |
| (14) If rand() < crossover_rate then |
| (15) pairs = crossover(pairs) |
| (16) end If |
| (17) If rand() < mutation_rate then |
| (18) pairs = mutate(pairs) |
| (19) end If |
| (20) population[generation+1].add(decode(pairs.first)) |
| (21) If(population[generation+1].size() < population_size) |
| (22) population[generation+1].add(decode(pairs.second)) |
| (23) end If |
| (24) end While |
| (25) generation++ |
| (26) end While |