Esempio n. 1
0
        public static Element Mate(Element e1, Element e2)
        {
            int length = e1.NumWeights();
            int mesto = (int)Math.Floor(length * Functions.rand.NextDouble());

            double[] geni = new double[length];
            double[] temp = e1.GetWeights();

            for (int i = 0; i < mesto; i++)
            {
                geni[i] = temp[i];
            }

            temp = e2.GetWeights();

            for (int i = mesto; i < length; i++)
            {
                geni[i] = temp[i];
            }

            Element novElement = new Element();
            novElement.PutWeights(geni);

            novElement.Mutate();

            return novElement;
        }
Esempio n. 2
0
 public Element(Element el)
 {
     //Kopirni konstruktor
     PutWeights(el.GetWeights());
 }