Skip to content
Snippets Groups Projects
Commit 0b7a61e2 authored by a.croix's avatar a.croix
Browse files

Correction in doReproduction method. Use only parents elements for reproduction

parent d4928a3e
No related branches found
No related tags found
No related merge requests found
Pipeline #1111 passed
......@@ -236,14 +236,15 @@ public class Trainer {
final List<SolutionDistance> doReproduction(
final List<SolutionDistance> solutions) {
int original_solution_size = solutions.size();
int nbr_weights = solutions.get(0).getWeightsP().length;
//we add children to the current list of solutions
while (solutions.size() < this.parameters.getPopulationSize()) {
int dad = Utils.randomInteger(0, solutions.size() - 1);
int dad = Utils.randomInteger(0, original_solution_size - 1);
int mom;
do {
mom = Utils.randomInteger(0, solutions.size() - 1);
mom = Utils.randomInteger(0, original_solution_size - 1);
} while (dad == mom);
int cut_position = Utils.randomInteger(0, nbr_weights - 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment