Beispiel #1
0
        /// <summary>
        /// Create a new trainer and use it to run a single run cycle.
        /// </summary>
        /// <param name="mycaffe">Specifies the MyCaffeControl to use.</param>
        /// <param name="nDelay">Specifies a delay to wait before getting the action.</param>
        /// <returns>The results of the run are returned.</returns>
        public ResultCollection RunOne(Component mycaffe, int nDelay = 1000)
        {
            if (m_itrainer == null)
            {
                m_itrainer = createTrainer(mycaffe);
            }

            ResultCollection res = m_itrainer.RunOne(nDelay);

            cleanup(50);

            return(res);
        }
        /// <summary>
        /// Create a new trainer and use it to run a single run cycle.
        /// </summary>
        /// <param name="mycaffe">Specifies the MyCaffeControl to use.</param>
        /// <param name="nDelay">Specifies a delay to wait before getting the action.</param>
        /// <returns>The results of the run are returned.</returns>
        ResultCollection IXMyCaffeCustomTrainerRL.RunOne(Component mycaffe, int nDelay)
        {
            if (m_itrainer == null)
            {
                m_itrainer = createTrainer(mycaffe, Stage.RL);
            }

            IxTrainerRL itrainer = m_itrainer as IxTrainerRL;

            if (itrainer == null)
            {
                throw new Exception("The trainer must be set to to 'C51.ST', PG.SIMPLE', 'PG.ST' or 'PG.MT' to run in reinforcement learning mode.");
            }

            ResultCollection res = itrainer.RunOne(nDelay);

            cleanup(50, false);

            return(res);
        }