/// <summary> /// Constructs a node gene with the given node gene pattern and activation function. /// </summary> /// <param name="nodeGenePattern">The node gene pattern that this node gene implements.</param> /// <param name="activationFunction">The activation function of the node.</param> /// <exception cref="ArgumentNullException">When the node gene pattern or activation function is null.</exception> protected internal NodeGene(NodeGenePattern nodeGenePattern, Node.ActivationFunction activationFunction) { Helpers.ThrowOnNull(nodeGenePattern, "nodeGenePattern"); Helpers.ThrowOnNull(activationFunction, "activationFunction"); NodeGenePattern = nodeGenePattern; ActivationFunction = activationFunction; }
/// <summary> /// Gets the hash code of this node gene. Is the ConnectionGenePattern hash code as well. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { return(NodeGenePattern.GetHashCode()); }
/// <summary> /// Constructs a node gene with the given node gene pattern and default activation function (<see cref="NEAT.Neural_Network.Node.Sigmoid(double)"/>). /// </summary> /// <param name="nodeGenePattern">The node gene pattern that this node gene implements.</param> /// <exception cref="ArgumentNullException">When the node gene pattern is null.</exception> protected internal NodeGene(NodeGenePattern nodeGenePattern) : this(nodeGenePattern, Node.Sigmoid) { }
/// <summary> /// String representation of this node gene. /// </summary> /// <returns>String representation of this node gene.</returns> public override string ToString() { return(NodeGenePattern.ToString() + ", ActFunc: " + ActivationFunction.Method.Name); }