示例#1
0
        /// <summary>
        /// This process takes into account the posibility that the evolution algorithm has not been
        /// started yet. The user is pre-registered, and the save files are moved to the correct folder,
        /// so that THE new evolution process will automatically read them.
        /// </summary>
        private void PrepareAndRaiseBranch(int?id, Candidate candidate, string userName)
        {
            ActiveUsersList <NeatGenome> .AddParentToUserName(userName, id);

            ActiveUsersList <NeatGenome> .SetUserWaitingForAlgorithm(userName);

            ActiveUsersList <NeatGenome> .SetUserWaitingForVideos(userName);

            SharpNeat.PopulationReadWrite.MoveSavedFilesToCandidateFolder(candidate.FolderPath, userName);
            EventsController.RaiseBranchEvent(userName);
        }
示例#2
0
        public ActionResult NextGeneration(int candidateIndex, bool isNormalMutations)
        {
            string userName = HttpContext.UserIdentity();

            // The user is active: send a heartbeat
            HeartBeat(userName);
            string line = NextGenerationLineForLog(candidateIndex.ToString(), isNormalMutations);

            WriteLineForDebug(line, userName);
            ActiveUsersList <NeatGenome> .SetUserWaitingForVideos(userName);

            EventsController.RaiseNextGenerationEvent(candidateIndex, userName, isNormalMutations);
            return(RedirectToAction("WaitingForCandidateVideosDisplay"));
        }
示例#3
0
        public ActionResult StopEvolution()
        {
            string userName = HttpContext.UserIdentity();

            if (CheckIfUserExists(userName))
            {
                ActiveUsersList <NeatGenome> .SetUserWaitingForVideos(userName);

                EventsController.RaiseStopEvolutionEvent(userName);
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
示例#4
0
        public ActionResult ResetEvolution()
        {
            string userName = HttpContext.UserIdentity();

            if (CheckIfUserExists(userName))
            {
                WriteLineForDebug("Reset evolution", userName);
                // The user is active: send a heartbeat
                HeartBeat(userName);
                // If we were branching from a saved genome, then the user had that
                // genome as the parent ID. Reseting evolution means this is no longer
                // the parent (there is none) so we set this ID to null
                ActiveUsersList <NeatGenome> .AddParentToUserName(userName, null);

                ActiveUsersList <NeatGenome> .SetUserWaitingForVideos(userName);

                EventsController.RaiseResetEvolutionEvent(userName);
                return(RedirectToAction("WaitingForEvolutionSetup"));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }