Пример #1
0
        private static AStarNode RunAlgo(Problem problem)
        {
            // Liste des états déjà visités pour optimisation
            List <CustomEnvState> closed = new List <CustomEnvState>();
            // Frontière des noeuds
            PriorityQueue <AStarNode> fringe = new PriorityQueue <AStarNode>();

            fringe.Enqueue(new AStarNode(problem._initialState));

            while (true)
            {
                if (fringe.Count == 0)
                {
                    return(null);
                }
                AStarNode currentNode = fringe.Dequeue();
                if (problem.HasBeenSolved(currentNode._state))
                {
                    return(currentNode);
                }
                // Vérification de l'absence de l'état dans les états visités
                if (!closed.Contains(currentNode._state))
                {
                    closed.Add(currentNode._state);
                    // Ajout des noeuds suivants
                    List <VacuumAgent.VacuumAction> vacuumActions = VacuumAgent.PossibleActionFromThere(currentNode._state);
                    foreach (var action in vacuumActions)
                    {
                        AStarNode newNode = new AStarNode(currentNode, action);
                        newNode._parentNode = currentNode;
                        fringe.Enqueue(newNode);
                    }
                }
            }
        }
Пример #2
0
 private void FifteenLearningCycle(object sender, RoutedEventArgs e)
 {
     LearningRound.Header = "Cycle d'apprentissage : 15";
     VacuumAgent.ChangeLearningCycle(15);
 }
Пример #3
0
 private void ToAStarAlgo(object sender, RoutedEventArgs e)
 {
     VacuumAgent.ChangeExplorationAlgo(VacuumAgent.Algorithm.ASTAR);
 }
Пример #4
0
 private void ThreeLearningCycle(object sender, RoutedEventArgs e)
 {
     LearningRound.Header = "Cycle d'apprentissage : 3";
     VacuumAgent.ChangeLearningCycle(3);
 }
Пример #5
0
 private void ToBFSAlgo(object sender, RoutedEventArgs e)
 {
     VacuumAgent.ChangeExplorationAlgo(VacuumAgent.Algorithm.BFS);
 }