@alenaksu/neatjs
Version:
NEAT (Neuroevolution of Augmenting Topologies) implementation in JavaScript
41 lines (40 loc) • 1.17 kB
TypeScript
import { ConnectionGene } from './ConnectionGene';
import { NodeGene } from './NodeGene';
import { NEATConfig } from '../types';
export declare class Genome {
connections: Map<number, ConnectionGene>;
nodes: Map<string, NodeGene>;
id: string;
constructor(id?: string);
copy(): Genome;
/**
* Returns a list of enabled connections
*/
getConnections(): ConnectionGene[];
/**
* Checks whether a connection between two nodes exists
* @param node1
* @param node2
*/
connectionExists(node1: NodeGene, node2: NodeGene): boolean;
addConnection(connection: ConnectionGene): void;
addNode(node: NodeGene): void;
/**
* Adds a connection mutation
*/
mutateAddConnection(config: NEATConfig): void;
mutateAddNode(config: NEATConfig): void;
/**
* Enable first disabled gene
*/
reEnableGene(): void;
/**
* Mutate a connection by enabling/disabling
* @param times
*/
mutateToggleEnable(times?: number): void;
/**
* Mutate all connections
*/
mutateConnectionsWeights({ mutationPower, genomeWeightPerturbated }: NEATConfig): void;
}