以下代碼有問題。它是人口演變的實施。在我的情況下,最大適應度每次都會以當地最大值出現,並且無法達到最大可能值。請建議必要的編輯和相同的理由。 Individual.java package genetic.algorithm.project;
import java.util.Random;
public class Individual {
public static int
我有興趣在Python中使用使用DEAP的遺傳算法。 knapasack can be seen here的示例實現。我試圖創建自己的交叉功能,我想保留父母的長度如下: # Crossover
def crossover(ind1, ind2):
print len(ind1), len(ind2) #<------ length at the beginning
temp1