分類問題を解決するための遺伝的アルゴリズムを作成しています。Genotype.evolve()throws '比較メソッドがその汎用規約に違反しています'
私は自分の設定を、他人がオンラインで行ったことを自分のフィットネス機能(必須)を使って見たのと正確に設定しています。私は母集団を保持し、次にこの集団を進化させるランダムなGenotypeを生成します。ただし、「比較メソッドがその一般契約に違反しています」というエラーが表示されることがあります。
任意の考え
...私は私が何ができるかわからないんだけど)私は、このエラーが何を意味するかを理解し、それは、フレームワークのメソッド.evolve(上と呼ばれていますので、/助けますか?おかげさまで
マイセットアップ:
DefaultConfiguration.reset();
Configuration config = new DefaultConfiguration();
config.setPopulationSize(100);
// Setup fitness function
FitnessFunction fit = new HyperrectFitnessFunction(is);
config.setFitnessFunction(fit);
// Get bounds
double[][] bounds = getInstanceSetBounds(is);
// Setup chromosome
Chromosome sample = new Chromosome(config, createSampleGenes(config, attrCount, bounds));
config.setSampleChromosome(sample);
// Generate initial population
Genotype population = Genotype.randomInitialGenotype(config);
// Evolve
int i = 0;
IChromosome bestSolution = null;
for (i = 1; i < 100 + 1; i++) {
population.evolve();
bestSolution = population.getFittestChromosome();
double bestFitness = bestSolution.getFitnessValue();
if (bestFitness > 0.8)
break;
}
[「比較方法がその一般契約に違反しています!」](https://stackoverflow.com/questions/8327514/comparison-method-violates-its-general-contract) –