예제 #1
0
        /// <summary>
        /// Gets the hash code of a potential connection gene pattern. Based off the innovation numbers of the given node gene patterns.
        /// </summary>
        /// <param name="pedigree">The owning pedigree of the potential connection gene pattern.</param>
        /// <param name="from">The from node of the potential connection gene pattern.</param>
        /// <param name="to">The to node of the potential connection gene pattern.</param>
        /// <returns>The hash code.</returns>
        /// <exception cref="ArgumentNullException">When from/to is null.</exception>
        public static int GetHashCode(Pedigree pedigree, NodeGenePattern from, NodeGenePattern to)
        {
            Helpers.ThrowOnNull(from, "from");
            Helpers.ThrowOnNull(to, "to");

            return(from.InnovationNumber * pedigree.MaxNodes + to.InnovationNumber);
        }
예제 #2
0
        /// <summary>
        /// Constructs a connection gene pattern with the given innovation number, from/to nodes, and replacing number.
        /// </summary>
        /// <param name="pedigree">The owning pedigree of this connection gene pattern.</param>
        /// <param name="innovation_number">The innovation number.</param>
        /// <param name="from">The NodeGene to connect from.</param>
        /// <param name="to">The NodeGene to connect to.</param>
        /// <param name="replacing_number">The innovation number of the node that replaces this connection.</param>
        /// <exception cref="ArgumentNullException">When from/to is null.</exception>
        protected internal ConnectionGenePattern(Pedigree pedigree, int innovation_number, NodeGenePattern from, NodeGenePattern to, int replacing_number) :
            base(pedigree, innovation_number)
        {
            Helpers.ThrowOnNull(from, "from");
            Helpers.ThrowOnNull(to, "to");


            From = from;
            To   = to;

            ReplacingNumber = replacing_number;
        }
예제 #3
0
 /// <summary>
 /// Constructs a node gene pattern with the given innovation number and X position.
 /// </summary>
 /// <param name="pedigree">The owning pedigree of this node gene pattern.</param>
 /// <param name="innovation_number">The innovation number.</param>
 /// <param name="x">The X position of the node.</param>
 protected internal NodeGenePattern(Pedigree pedigree, int innovation_number, double x) :
     base(pedigree, innovation_number)
 {
     X = x;
 }
예제 #4
0
파일: GenePattern.cs 프로젝트: polic72/NEAT
 /// <summary>
 /// Constructs a gene pattern with the given pedigree and innovation number.
 /// </summary>
 /// <param name="pedigree">The owning pedigree of this gene pattern.</param>
 /// <param name="innovation_number">The innovation number.</param>
 public GenePattern(Pedigree pedigree, int innovation_number)
 {
     Pedigree         = pedigree;
     InnovationNumber = innovation_number;
 }