나는 룰렛 휠 선택을 사용하여 유전 알고리즘을 구현하려고하고 있는데, 만약 우리가 아이를 낳을 때 같은 부모가 선택된다면 어떻게 될까? 결과적으로 자녀가 부모와 같기 때문에 우리는 여전히 교차를합니까?룰렛 휠 셀렉션이 동일한 부모를 반환하면 어떻게 될까요?
breedChild: function() {
//blah blah blah
//blah blah blah
//blah blah blah
var mom = this.rouletteWheelSelection(),
dad = this.rouletteWheelSelection();
}
rouletteWheelSelection: function() {
var total = 0,
//totalFitnessScore is precalculated, and represents the sum of all the fitness scores in current population
threshold = totalFitnessScore * Math.random();
for (var i = 0; i < genomesArr.length; i++) {
total += genomesArr[i].fitnessScore;
if (total >= threshold) break;
};
return genomesArr[i];
}
이것은 * 프로그래밍 * 문제가 아닙니다. 귀하의 질문은 프로그래밍 행위 나 프로그래밍에 사용 된 도구와 관련이 없습니다. – meagar
@meagar 알고리즘에 대한 설명을 요구하는 질문입니다. 주제에 관한 것입니다. –