UNPKG

@thi.ng/gp

Version:

Genetic programming helpers & strategies (tree based & multi-expression programming)

36 lines 1.52 kB
import type { ASTNode, MEPChromosome, MEPGene, MEPOpts } from "./api.js"; export declare class MEP<OP, T> { opts: MEPOpts<OP, T>; probTerminal: number; choices: IterableIterator<number>; constructor(opts: MEPOpts<OP, T>); /** * Returns a new random {@link MEPChromosome} with the configured * probabilities of operator and terminal nodes (constants). * * @remarks * See {@link MEP.decodeChromosome} for conversion to * {@link ASTNode}s. * */ randomChromosome(): MEPChromosome<OP, T>; /** * Decodes given chromosome into an array of {@link ASTNode}s and * optionally applies tree depth filter (by default includes all). * * @remarks * A {@link MEPChromosome} encodes multiple solutions (one per gene * slot), therefore a chromosome of length `n` will produce the same * number ASTs (less if min/max tree depth filters are applied). * * @param chromosome - * @param minDepth - * @param maxDepth - */ decodeChromosome(chromosome: MEPChromosome<OP, T>, minDepth?: number, maxDepth?: number): ASTNode<OP, T>[]; crossoverSingle(chromo1: MEPChromosome<OP, T>, chromo2: MEPChromosome<OP, T>, cut?: number): MEPChromosome<OP, T>[]; crossoverUniform(chromo1: MEPChromosome<OP, T>, chromo2: MEPChromosome<OP, T>): MEPChromosome<OP, T>; mutate(chromo: MEPChromosome<OP, T>): MEPChromosome<OP, T>; protected randomGene(i: number): MEPGene<OP, T>; } //# sourceMappingURL=mep.d.ts.map