Esempio n. 1
0
        public NeatStrategy(string file, string name)
        {
            NeatGenome genome = null;

            using (XmlReader xr = XmlReader.Create(file))
                genome = NeatGenomeXmlIO.ReadCompleteGenomeList(xr, false)[0];

            var experiment = new HexagonExperiment();

            experiment.Initialize(name);
            // Get a genome decoder that can convert genomes to phenomes.
            var genomeDecoder = experiment.CreateGenomeDecoder();

            // Decode the genome into a phenome (neural network).
            Brain = genomeDecoder.Decode(genome);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            // Initialise log4net (log to console).
            XmlConfigurator.Configure(new FileInfo("log4net.properties"));

            // Experiment classes encapsulate much of the nuts and bolts of setting up a NEAT search.
            HexagonExperiment experiment = new HexagonExperiment();

            // Load config XML.
            //XmlDocument xmlConfig = new XmlDocument();
            //xmlConfig.Load("hexagon.config.xml");
            //experiment.Initialize("Hexagon", xmlConfig.DocumentElement);
            experiment.Initialize("Hexagon");

            // Create evolution algorithm and attach update event.
            _ea = experiment.CreateEvolutionAlgorithm();
            _ea.UpdateEvent += new EventHandler(ea_UpdateEvent);

            // Start algorithm (it will run on a background thread).
            _ea.StartContinue();

            // Hit return to quit.
            Console.ReadLine();
        }