Class ProgramGene<A>

java.lang.Object
io.jenetics.ext.AbstractTreeGene<Op<A>,ProgramGene<A>>
io.jenetics.prog.ProgramGene<A>
All Implemented Interfaces:
TreeGene<Op<A>,ProgramGene<A>>, FlatTree<Op<A>,ProgramGene<A>>, Tree<Op<A>,ProgramGene<A>>, Gene<Op<A>,ProgramGene<A>>, Factory<ProgramGene<A>>, Self<ProgramGene<A>>, Verifiable, Serializable, Iterable<ProgramGene<A>>, Function<A[],A>

public final class ProgramGene<A> extends AbstractTreeGene<Op<A>,ProgramGene<A>> implements Gene<Op<A>,ProgramGene<A>>, Function<A[],A>
This gene represents a program, build upon an AST of Op functions. Because of the tight coupling with the ProgramChromosome, a ProgramGene can't be created directly. This reduces the possible error space. Since the ProgramGene also is a Tree, it can be easily used as a result.
final ProgramGene<Double> program = engine.stream()
    .limit(300)
    .collect(EvolutionResult.toBestGenotype())
    .getGene();

final double result = program.eval(3.4);
Since:
3.9
Version:
5.2
See Also: