private void setupSubstrate()
 {
     if (isMulti)
     {
         substrate = new SkirmishSubstrate(25, 15, 25, HyperNEATParameters.substrateActivationFunction);
         network   = substrate.generateMultiGenomeModulus(seedGenome.Decode(null), 5).Decode(null);
     }
     else
     {
         substrate = new SkirmishSubstrate(5, 3, 5, HyperNEATParameters.substrateActivationFunction);
         network   = substrate.GenerateGenome(seedGenome.Decode(null)).Decode(null);
     }
 }
        private void loadCCEAGenomesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var dlg = new OpenFileDialog())
            {
                dlg.Multiselect = true;
                dlg.Filter      = "*.xml|*.xml";
                if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                var fileNames = dlg.FileNames;
                if (fileNames.Length != 5)
                {
                    MessageBox.Show("You must select 5 files!");
                    return;
                }

                Array.Sort(fileNames);

                INetwork[] predNetworks = new INetwork[5];

                for (int i = 0; i < predNetworks.Length; i++)
                {
                    try
                    {
                        XmlDocument doc = new XmlDocument();
                        doc.Load(fileNames[i]);
                        var genome = XmlNeatGenomeReaderStatic.Read(doc);

                        var curSubstrate = new SkirmishSubstrate(5, 3, 5, HyperNEATParameters.substrateActivationFunction);
                        predNetworks[i] = curSubstrate.GenerateGenome(genome.Decode(null)).Decode(null);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                        return;
                    }
                }

                this.isMulti = false;
                SkirmishNetworkEvaluator.NetworkPerPred = predNetworks;
            }
        }
        public double EvaluateNetwork(INetwork cppn)
        {
            lock (locker)
            {
                NeatGenome tempGenome  = m_substrate.GenerateGenome(cppn);
                INetwork   tempSubsNet = tempGenome.Decode(null);
                double     fitness     = 0.0;

                Program.TheWorldSimulator.NetworksToEvaluate[m_agentId] = tempSubsNet;
                Program.TheWorldSimulator.EventsNetworkReady[m_agentId].Set();
                Program.TheWorldSimulator.EventsFitnessReady[m_agentId].WaitOne();

                fitness = Program.TheWorldSimulator.Fitness;

                //if (!SkirmishExperiment.multiple)
                //    fitness += doEvaluation(tempNet);
                //else
                //    fitness += doEvaluationMulti(tempNet);
                return(fitness);
            }
        }