Skip to content

Symbolic regression: Mixing Bool and Double Ops #848

Answered by jenetics
raedma asked this question in Q&A
Discussion options

You must be logged in to vote

You can try an extension to the MultiRootGP example.

static final Codec<ISeq<Function<Double[], Double>>, ProgramGene<Double>> CODEC =
    Codec.of(
        Genotype.of(
            // Discriminator
            ProgramChromosome.of(
                0,
                ISeq.of(Op.of("identity", UnaryOperator.identity())),
                ISeq.of(EphemeralConst.of(() -> (double)RandomRegistry.random().nextInt(100)))
            ),
            // First 'program'
            ProgramChromosome.of(
                5,
                ch -> ch.root().size() <= 50,
                OPERATIONS,
                TERMINALS
            ),
            // Second 'program'
            ProgramChromosome.of(
…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jenetics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants