Scala からJenetics HelloWorldの例を実行しようとしています。
import org.jenetics.{BitChromosome, BitGene, Genotype}
import org.jenetics.engine.{Engine, EvolutionResult}
object BitCounting extends App {
val genotypeFactory = Genotype.of(BitChromosome.of(128, 0.5))
val fitness: java.util.function.Function[Genotype[BitGene], Int] = new java.util.function.Function[Genotype[BitGene], Int] {
override def apply(genotype: Genotype[BitGene]): Int = genotype.asInstanceOf[BitChromosome].bitCount()
}
val engine = Engine.builder(fitness, genotypeFactory).build()
val result = engine
.stream()
.limit(100)
.collect(EvolutionResult.toBestGenotype[BitGene, Int])
println(s"Hello world:\n$result")
}
エンジンが初期化されている行でコンパイル エラーが発生します。コンパイラは、適合する型の Engine.Builder が存在しないと不平を言います。誰でも理由を説明できますか?