Ejemplo n.º 1
0
        /// <summary>
        /// Assumption: networks has the same predefined structure
        /// </summary>
        public static NetGroup CrossOver(NetGroup a, NetGroup b)
        {
            NetGroup output            = new NetGroup(a.inputLenght);
            bool     connectionsParent = Convert.ToBoolean(Math.Round(new Random(DateTime.Now.Millisecond).NextDouble()));

            for (int networkIndex = 0; networkIndex < a.networks.Count; networkIndex++)
            {
                List <ConnectedNet.Connection> connections = connectionsParent? b.networks[networkIndex].Connections : a.networks[networkIndex].Connections;
                output.networks.Add(new ConnectedNet(TemporalNetwork.CrossOver(a.networks[networkIndex].Network, b.networks[networkIndex].Network, -1, true, connectionsParent)
                                                     , connections, a.networks[networkIndex].OutputToGatherBounds));
            }
            return(output);
        }