Beispiel #1
0
        private void NextEpisode(SMDPAgent agent)
        {
            config = RLConfig.Load("RLConfig.xml");
            if (this.Episodes > config.numEpisodes)
            {
                return;
            }
            Console.WriteLine("Gets to NextEpisode() {0} times", cnt++);
            if (this.Episodes == 0)
            {
                fitness = 1;
                sum     = 0;
                counter = 0;
            }
            this.Episodes++;

            agent.setEpsilon(config.lambda);
            fitness = RLGameWorld.FitnessValue(agent);
            reward  = fitness; // This is to send a reward to endEpisode
            sum    += fitness;
            if (this.Episodes % count_fit == 0)
            {
                counter++;
                average_fitness = sum / count_fit;
                // recordPerformance(this.Episodes, fitness);
                recordPerformance(counter, average_fitness);
                sum = 0;
            }

            //this.Previous = this.Current;
            //this.Current = this.Next;
            //this.Next = new KPEnvironment(this.Episode + 1);
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            RLGameWorld ng   = new RLGameWorld();
            Thread      play = new Thread(new ThreadStart(ng.Game));

            play.IsBackground = true;
            play.Start();
            config = RLConfig.Load("RLConfig.xml");
            RLProgram mainprog = new RLProgram();

            Console.WriteLine("Gets here before it calls main program visualize = {0} and learning ={1}", config.visualize, config.learning);
            if (config.visualize == 0 && config.learning == 1)
            {
                Console.WriteLine("Gets to call main program ");
                mainprog.AllEpisodes();
            }
            Console.WriteLine("It got here");
            Console.ReadLine();
        }