Académique Documents
Professionnel Documents
Culture Documents
problèmes
Algorithmes de recherche arborescente
Aymen Ayari
Email : aymen.ayari@gmail.com
GLSI 2
AU: 22-23
Plan
IA comme agents intelligents (Rappel)
Résolution de problèmes : Quels problèmes
? Quelles méthode ?
Techniques de recherche non informée
En largeur d’abord
En profondeur d’abord
Retour en arrière
Techniques de recherche informée
En meilleur d’abord
L’algorithme A*
Naissance du terme IA (rappel)
IA comme Agents Intelligents (rappel)
capteurs
percevoir
Agent
?
agir
Actionneurs
Problèmes comminatoires.
Exemple:
Pathfinding
(Recherche de chemin)
Problème de navigation où il y a
beaucoup de choix pour
commencer.
Pas exploré
Critères d'évaluation des algorithmes
Complétude: est-ce que la méthode garantit
de trouver une solution si elle existe?
Optimalité: est-ce que la méthode trouve
la meilleure solution s'il en existe
plusieurs?
Complexité en temps: combien de nœuds faut-
il produire pour trouver la solution?
Complexité en espace: combien de nœuds
conserver en mémoire pour trouver la
solution?
Mesures de Complexité
Branchement b:
Largeur maximale m
d'ouverture sur un nœud
Profondeur d: la d
profondeur de la meilleur
solution.
Profondeur maximum m: b
la profondeur maximale
de l'arbre.
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertLast(opens,
Expand(node))
end
Recherche Arborescente (BFS)
Breadth-First Search
Algorithme: Tree search
Utilise une liste comme une file (FIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertLast(opens,
Expand(node))
end
Recherche Arborescente (BFS)
Breadth-First Search
Algorithme: Tree search
Utilise une liste comme une file (FIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertLast(opens,
Expand(node))
end
Recherche Arborescente (BFS)
Breadth-First Search
Algorithme: Tree search
Utilise une liste comme une file (FIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertLast(opens,
Expand(node))
end
Recherche Arborescente (BFS)
Breadth-First Search
Algorithme: Tree search
Utilise une liste comme une file (FIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertLast(opens,
Expand(node))
end
Recherche Arborescente
Breadth-First Search
Algorithme: Tree search
Utilise une liste comme une file (FIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertLast(opens,
Expand(node))
end
Recherche en profondeur d’abord
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertFirst(opens,
Expand(node))
end
Recherche Arborescente (DFS)
Depth-First Search
Algorithme: Tree search
Utilise une liste comme une Pile (LIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertFirst(opens,
Expand(node))
end
Recherche Arborescente (DFS)
Depth-First Search
Algorithme: Tree search
Utilise une liste comme une Pile (LIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertFirst(opens,
Expand(node))
end
Recherche Arborescente (DFS)
Depth-First Search
Algorithme: Tree search
Utilise une liste comme une Pile (LIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertFirst(opens,
Expand(node))
end
Recherche Arborescente (DFS)
Depth-First Search
Algorithme: Tree search
Utilise une liste comme une Pile (LIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertFirst(opens,
Expand(node))
end
Recherche Arborescente (DFS)
Depth-First Search
Algorithme: Tree search
Utilise une liste comme une Pile (LIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertFirst(opens,
Expand(node))
end
Recherche Arborescente (DFS)
Depth-First Search
Algorithme: Tree search
Utilise une liste comme une Pile (LIFO)
opens ← MakeList(x)
loop do
if opens is empty then return
failure node ← Pop(opens)
if Goal(node) then return Path(node)
opens ← InsertFirst(opens,
Expand(node))
end
Questions
Est-ce qu’un espace fini d'états donne toujours un arbre de recherche fini ?
Non, Il pourrait y avoir des cas où l’arbre de recherche a une profondeur infini
Backtrack(node)
if promising(node) then
if Goal(node) then
report
Path(node)
else
for each child u of node)
backtrack(u)
Retour en arrière (Backtracking Search)
Backtracking Search
Algorithme: tree search
Ne rajoute qu'un ouvert à la fois
Backtrack(node)
if promising(node) then
if Goal(node) then
report
Path(node)
else
for each child u of node)
backtrack(u)
Retour en arrière (Backtracking Search)
Backtracking Search
Algorithme: tree search
Ne rajoute qu'un ouvert à la fois
Backtrack(node)
if promising(node) then
if Goal(node) then
report
Path(node)
else
for each child u of node)
backtrack(u)
Retour en arrière (Backtracking Search)
Backtracking Search
Algorithme: tree search
Ne rajoute qu'un ouvert à la fois
Backtrack(node)
if promising(node) then
if Goal(node) then
report
Path(node)
else
for each child u of node)
backtrack(u)
Retour en arrière (Backtracking Search)
Backtracking Search
Algorithme: tree search
Ne rajoute qu'un ouvert à la fois
Backtrack(node)
if promising(node) then
if Goal(node) then
report
Path(node)
else
for each child u of node)
backtrack(u)
Retour en arrière (Backtracking Search)
Backtracking Search
Algorithme: tree search
Ne rajoute qu'un ouvert à la fois
Backtrack(node)
if promising(node) then
if Goal(node) then
report
Path(node)
else
for each child u of node)
backtrack(u)
Retour en arrière (Backtracking Search)
Backtracking Search
Algorithme: tree search
Ne rajoute qu'un ouvert à la fois
Backtrack(node)
if promising(node) then
if Goal(node) then
report
Path(node)
else
for each child u of node)
backtrack(u)
Retour en arrière (Backtracking Search)
Backtracking Search
Algorithme: tree search
Ne rajoute qu'un ouvert à la fois
Backtrack(node)
if promising(node) then
if Goal(node) then
report
Path(node)
else
for each child u of node)
backtrack(u)
Retour en arrière (Backtracking Search)
Backtracking Search
Algorithme: tree search
Ne rajoute qu'un ouvert à la fois
Backtrack(node)
if promising(node) then
if Goal(node) then
report
Path(node)
else
for each child u of node)
backtrack(u)
Propriété de l’algorithme DFS
●
Greesy Best-first ordonne par la distance à l'objectif ou le coût en avant h(n)
5
e h=1
1
1 3 2
S a d G
h=6 1 h=5
h=2 h=0
1
c b
h=7 h=6
●
A* Search ordonne par la somme: f(n) = g(n) +
h(n)
Quand doit-on mettre fin à A*?
Doit-on arrêter lors de l'enfilement d'un but?
2 A 2
h=2
S h=3 G
h=0
B 3
2
h=1
●
Non: on ne s'arrêtera que lorsque nous avons un
objectif défilé.
Heuristiques Admissible
●
Une heuristique h est admissible (optimistic) si:
Ne jamis surestimé!
Heuristique triviales et Dominance
● Dominance: ha ≥ hc if
●
Heuristiques forment un demi-treillis:
le Max des heuristiques admissibles est
recevable:
●
Heuristiques triviales
–
En bas du treillis est l'heuristique zéro
(qu'est ce que cela nous donne?)
– En haut du treillis est l'heuristique
exacte
Optimalité de A*: blocage
…
Notation:
●
G*: un nœud de plus bas coût
(but)
●
G: un autre nœud but
Optimalité de A*: blocage
Prouve: …
●
Qu'est-ce qui pourrait aller mal?
●
Nous pourrions avoir de la pop un
objectif sous-optimale G au large de la
frontière avant G *
●
Cela ne peut pas se produire:
●
Imaginez un objectif sous-optimale G
est dans la file.
●
Un certain nœud n qui est un sous-
chemin de G * doit aussi être à la
frontière (pourquoi?)
●
n va apparaitre de la pop avant G
Example: 8 Puzzle
●
Quels sont les états?
●
Combien d'Etats?
●
Quelles sont les actions?
●
Quels sont les Etats que nous pouvions atteindre à partir
de l'état de départ?
●
Ce que les coûts devraient être?