No Slide Titleeol/PRODEI/mpe1617_eng_files/STRIPS.pdf3 •Body Text •Second Level •Third Level...
Transcript of No Slide Titleeol/PRODEI/mpe1617_eng_files/STRIPS.pdf3 •Body Text •Second Level •Third Level...
1
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 1 Planning and Scheduling, FEUP/PRODEI /MIEIC 1
Eugénio Oliveira/FEUP
PLANEADORES
Lineares
Planeadores
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 2 Planning and Scheduling, FEUP/PRODEI /MIEIC 2
Eugénio Oliveira/FEUP
-A pesquisa é feita com retrocesso nos pontos não deterministas
-Escolha de ações
-Instanciação de variáveis
-Ordenação de ações
-Escolha de sub-objetivos para resolver
Planeadores
-Planeamento envolve pesquisa em um Espaço de Estados:
- Como guiar a pesquisa?
-Como representar o Espaço de Estados
-Como avaliar as soluções?
2013/ MIEIC-ProDEI
F
2
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 3 Planning and Scheduling, FEUP/PRODEI /MIEIC 3
-Encadeamento Inverso: -1 Escolha ação cujo efeito esteja de acordo com um (sub) objetivo
-2 Junte pré-condições do operador ao conjunto de sub-objetivos ainda não atingidos (se fôr o caso)
-3 Até o conjunto dos sub-objetivos não atingidos sêr vazio, regresse a 1
Eugénio Oliveira/FEUP
-Direção da pesquisa (do plano de ações):
-Encadeamento Direto:
-1 Selecione a ação cujas pré-condições são satisfeitas e aplique-a
-2 Altere descrição do Estado corrente
-3 Até Objetivo estar satisfeito regresse a 1
Planeadores
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 4 Planning and Scheduling, FEUP/PRODEI /MIEIC 4
Eugénio Oliveira/FEUP
-Direcção da pesquisa (Vantagens / Desvantagens)
-Encadeamento Direto:
- Vantagem: Simples
- Desvantagem: -Fator de Ramificação grande
- Pesquisa não focalizada
Planeadores
-Encadeamento Inverso: - Vantagens:
-Focalizada na resolução dos Objetivos
- Normalmente mais eficiente
- Desvantagens: -Necessidade de raciocinar acerca das ações
- o encadeamento inverso (regressão) é incompleto
2013/ MIEIC-ProDEI
3
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 5 Planning and Scheduling, FEUP/PRODEI /MIEIC 5
Eugénio Oliveira/FEUP
-Planeamento Linear:
-Pesquisa usando PILHA dos Objetivos ainda não atingidos
-Resolução de um Objetivo de cada vez
-Vantagens: Pesquisa simples e eficiente se objetivos independentes
-Desvantagens: Planos podem ser sub-óptimos. Incompleto
Planeadores
-Planeamento Não-Linear: -Pesquisa usando um Conjunto de Objetivos
-Resolução concorrente de sub-objetivos
-Vantagens: Completo e pode produzir planos mais curtos
-Desvantagens: Espaço de Estados maior (objetivos podem ser dependentes)
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 6 Planning and Scheduling, FEUP/PRODEI /MIEIC 6
-Plano Parcialmente Ordenado: o Plano é uma ordenação parcial que pode ser linearizado antes da execução
-Vantagens: Compromissos adiados o mais possível e fácil de lidar com planos concorrentes
-Desvantagens: Difícil saber quais os objetivos a executar em cada instante
Eugénio Oliveira/FEUP
-Plano resultante:
-Plano Totalmente Ordenado: o Plano é sempre uma sequência estrita de ações
-Vantagens: Algoritmo mais simples
-Desvantagem: Não há planos concorrentes e pode forçar a tomar decisões desnecessárias.
Planeadores
2013/ MIEIC-ProDEI
4
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 7 Planning and Scheduling, FEUP/PRODEI /MIEIC 7
Eugénio Oliveira/FEUP
-Espaço de Estados:
- Nós: estados.
- Arcos: ações.
- Caminho nesse Espaço: Plano
Planeadores
-Descrição do Estado corrente:
-Usando Base de factos inicial e atualizando-a através das listas Junte e Apague dos Operadores do Plano
-Problemas: tendo de haver retrocesso na computação do Plano pode ser impossível devido a efeitos colaterais.
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 8 Planning and Scheduling, FEUP/PRODEI /MIEIC 8
Eugénio Oliveira/FEUP
-Espaço de Planos:
-Espaço de estados é conjunto de planos. Arcos são operadores de plano (junte, ordene,…). A ordem de pesquisa é diferente da ordem de execução do plano
Planeadores
-Encontrar o Plano solução é como provar de axiomas da descrição do estado inicial, e dos estados entretanto derivados, o Objetivo final.
-A Lógica de Predicados é um formalismo apropriado para este algoritmo
2013/ MIEIC-ProDEI
5
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 9 Planning and Scheduling, FEUP/PRODEI /MIEIC 9
Eugénio Oliveira/FEUP
-Planeamento Parcialmente Ordenado (PPO) (Partial Ordered Planning)
-No Cálculo situacional um problema de planeamento é representado
por fórmulas lógicas descrevendo:
Estado Inicial, Estado Final, Operadores
A Linguagem dos Planeadores tipo-STRIPS usa Operadores descrevendo Ações suas pré-condições e efeitos.
Planeadores
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 10 Planning and Scheduling, FEUP/PRODEI /MIEIC 10
Eugénio Oliveira/FEUP
Plano:
Conjunto de passos (Operadores)
Conjunto de Restrições de Ordenação dos passos
(Si < Sj)
Conjunto de ligações das Variáveis
Conjunto das ligações causais (Si c Sj)
i.e.: Si realiza a pré-condição c para Sj
Planeadores
2013/ MIEIC-ProDEI
6
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 11
Eugénio Oliveira/FEUP
Robótica Inteligente
Planos parcial e totalmente Ordenados
Plano Parcialmente Ordenado Plano Totalmente Ordenado
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 12 Planning and Scheduling, FEUP/PRODEI /MIEIC 12
Eugénio Oliveira/FEUP
FUNÇÃO PPO(inicio,objetivo,operadores) RETORNA plano
plano Faz_Plano_Mínimo(início, objetivo) {aplica o 1ºop}
REPETIR (até todos os sub-objetivos selecionados)
SE solução(plano) RETORNAR(plano)
{pré-condição c Si,c Selecionar_Sub-objetivo (plano)
não satisfeita Selecionar_Operador(plano,Operadores, Si,c }
de Si } Resolver_inconsistências (plano)
FIM
Planeadores
2013/ MIEIC-ProDEI
Algoritmo de Planeamento Parcialmente Ordenado (PPO) { PPO começa com plano parcial mínimo e estende cada passo
pela realização de cada pré-condição desse passo}
7
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 13 Planning and Scheduling, FEUP/PRODEI /MIEIC 13
Eugénio Oliveira/FEUP
FUNÇÃO Selecionar_Operador(plano,Operadores, Si,c )
Escolher passo Sj (operador) tendo c como efeito
SE ~existe Sj ENTÃO FALHA
SENÃO Juntar ligação_causal Sj c Si a Ligações(plano)
Juntar Restrições de Ordem Sj < Si a Ordenação(plano)
SE Sj novo passo ENTÃO
Juntar Sj a Passos(plano)
Juntar início< Sj <Objectivo a Ordenação(plano)
Planeadores
2013/ MIEIC-ProDEI
Algoritmo de Paneamento Parcialmente Ordenado (PPO) FUNÇÃO Selecionar_Sub-objetivo(plano) RETORNAR(Si,c )
Escolher_passo(Si , plano)
RETORNAR pré-condição não satisfeita c de Si , Si,c
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 14 Planning and Scheduling, FEUP/PRODEI /MIEIC 14
Eugénio Oliveira/FEUP
Algoritmo de Planeamento Parcialmente Ordenado (PPO) PROCEDIMENTO resolver_inconsistências(plano)
PARA CADA
Sinc ameaçando ligação causal Sa c Sb em Ligações(plano)
FAZER {escolher promover} Junte Sinc < Sa a Ordenação(plano)
OU
{ou despromover} Junte Sb < Sinc a Ordenação(plano)
SE Não Consistente(plano)
ENTÃO FALHA
FIM
Planeadores
2013/ MIEIC-ProDEI
8
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 15 Planning and Scheduling, FEUP/PRODEI /MIEIC 15
Eugénio Oliveira/FEUP
Algoritmo de Planeamento Parcialmente Ordenado (PPO)
Sinc = S3
Promoção Despromoção
Planeadores
S2
S1
c
~c
S3
S1
S3
~c
c
S2
S1
S2
S3
c
~c
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 16 Planning and Scheduling, FEUP/PRODEI /MIEIC 16
Eugénio Oliveira/FEUP
- Representação simplificada das ações relativamente à
representação em Lógica:
-Consideram-se só conjunções de pré-condições ou efeitos
- Não há condicionais
- Não há quantificações
Planeador tipo- “STRIPS”
-Estado é uma base de factos (literais instanciados)
-O que não está na Base de Factos não é verdadeiro
-Representam-se os efeitos do operador através de duas listas que atuam na Base de factos (JUNTE e APAGUE)
-Não há representação explícita do tempo
-Não há regras de inferência explícitas
2013/ MIEIC-ProDEI
9
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 17 Planning and Scheduling, FEUP/PRODEI /MIEIC 17
Eugénio Oliveira/FEUP
- A lista dos Efeitos está dividida em duas listas (Junte, “Add” e Apague, “Delete”).
- Assunção do STRIPS: Literais não mencionados nas listas não se alteram. STRIPS evita o “frame problem” da representação.
- Linguagem STRIPS pode não ser suficiente para representar certos problemas. Usa-se a ADL- Action Description Language.
- ADL e STRIPS são consideradas sub-linguagens de PDDL- Planing Domain Definition Language
Planeador tipo- “STRIPS”
― Ex de Representação de Ações: •STRIPS : Action(Fly(p,from,to) )
PRECOND:At(p,from)LPlane(p)LAirport(from)LAirport(to)
EFFECT: ~At(p,from) L At(p,to)
• ADL: Action(Fly(p:Plane,from:Airport,to:Airport)
PRECOND:At(p,from)L (from =/= to)
EFFECT: ~At(p,from) L At(p,to)
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 18 Planning and Scheduling, FEUP/PRODEI /MIEIC 18
Eugénio Oliveira/FEUP
- Comparação entre Linguagens STRIPS e ADL:
STRIPS ADL
Estados só com literais positivos positivos e negativos
CWA literais não mencionados são falsos OWA não mencionados são desconhecidos
PL ~Q significa Junte P apague ~Q PL~Q significa Junte PL~Q.
Apague ~(PL~Q)
Objetivos só com literais baseados Objetivos com variáveis quantificadas
Objetivos e efeitos são Conjunções Objetivos e efeitos podem ter Dijunções
Não suporta tipos e igualdade Suporta tipos e igualdade
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
10
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 19 Planning and Scheduling, FEUP/PRODEI /MIEIC 19
Eugénio Oliveira/FEUP
Planeador tipo- “STRIPS”
Init(At(Flat,Axle) L At(Spare,Trunk)) Goal(At(Spare,Axle))
Action(Remove(Spare,Trunk)
PRECOND: At(Spare,Trunk) EFFECT: ~At(Spare,Trunk) LAt(Spare,Ground) )
Action(Remove(Flat,Axle)
PRECOND: At(Flat,Axle) EFFECT: ~At(Flat.Axle) LAt(Flat,Ground) )
Action(PutOn(Spare, Axle)
PRECOND:At(Spare,Ground)L~At(Flat,Axle)) EFFECT:~At(Spare,Ground) LAt(Spare,Axle) )
Action(LeaveOvernight)
PRECOND: EFFECT: ~At(Spare,Ground) L ~At(Flat,Ground) L ~At(Flat,Trunk)
2013/ MIEIC-ProDEI
― Ex de representação de problema usando ADL
Planeamento para mudar um pneu furado pelo pneu sobresselente:
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 20 Planning and Scheduling, FEUP/PRODEI /MIEIC 20
2013/ MIEIC-ProDEI Eugénio Oliveira/FEUP
- Plano Parcialmente Ordenado: -Plano para mudar um pneu furado pelo pneu sobresselente:
-Init(At(Flat,Axle) L At(Spare,Trunk)) Goal(At(Spare,Axle))
leaveOvernight :~At(Spare,Ground) L ~At(Flat,Ground) L ~At(Spare,Trunk) L ~At(Flat,Axle) L ~At(Spare,Axle)
conflito
Em conflito com At(Spare,Ground) retrocede para próximovpossivel Operador: Remove(Flat, Axle)
PPO vazio
PPO Incompleto
solução do PPO
Planeador tipo- “STRIPS”
11
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 21
Eugénio Oliveira/FEUP
Robótica Inteligente
Robô Shakey (Stanford) Operadores: Go, Push, Climb
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 22 Planning and Scheduling, FEUP/PRODEI /MIEIC 22
Eugénio Oliveira/FEUP
- STRIPS (Stefike) é um Planeador usando: - PILHA de OBJETIVOS
-Técnica usada para resolver alguns dos problemas que incluem Objetivos compostos que podem interagir.
Planeador tipo- “STRIPS”
-Utiliza-se uma só PILHA quer para Objetivos quer para Operadores usados para os satisfazer.
-São necessários ainda: - uma BASE de FACTOS descrevendo a situação corrente
- Conjunto de OPERADORES com as respectivas LISTAS:
-Pré-Condições
-Junte
-Apague
2013/ MIEIC-ProDEI
12
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 23 Planning and Scheduling, FEUP/PRODEI /MIEIC 23
Eugénio Oliveira/FEUP
- Representação das Ações no STRIPS (no “mundo dos blocos”):
-Esquemas de Operadores:
-PEGAR_da_mesa(a)
Pré-Condições: Bloco(a), Manip_livre, Limpo(a), Em(a,Mesa)
Junte: Segura(a)
Apague: Manip_livre, Em(a,Mesa)
Planeador tipo- “STRIPS”
-RETIRAR_de_outro_bloco(a)
Pré-Condições: Bloco(a), Manip_livre, Limpo(a), Em(b,a),Bloco(b)
Junte: Segura(a), Limpo(b)
Apague: Manip_livre, Em(a,b)
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 24 Planning and Scheduling, FEUP/PRODEI /MIEIC 24
Eugénio Oliveira/FEUP
-Esquemas de Operadores:
-LARGAR_na_mesa(a)
Pré-Condições: Bloco(a), Segura(a)
Junte: Manip_livre, Em(a,Mesa)
Apague: Segura(a)
Planeador tipo- “STRIPS”
-EMPILHAR(a,b)
Pré-Condições: Bloco(a), Segura(a) Bloco(b), Limpo(b)
Junte: Manip_livre, Em(a,b)
Apague: Segura(a), Limpo(b)
2013/ MIEIC-ProDEI
13
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 25 Planning and Scheduling, FEUP/PRODEI /MIEIC 25
Eugénio Oliveira/FEUP
-Técnicas para tornar mais eficiente o algoritmo de pesquisa (em árvore):
-Detecção de “folhas mortas”. Chegados a estados dos quais não se pode progredir para o objetivo, retrocede-se
-Cortar passos que se afastam da solução (em encadeamento direto). Por exemplo:
Planeador tipo- “STRIPS”
-Se se juntar sub-objecivos a resolver incompatíveis com outros que se devem atingir;
-Se para se resolver A é preciso resolver B, C e de novo A (ciclos).
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 26 Planning and Scheduling, FEUP/PRODEI /MIEIC 26
Eugénio Oliveira/FEUP
- Mesmo que os problemas sejam “quase-decomponíveis” assume-se a decomponibilidade e resolve-se. Compara-se a solução intermédia com o objetivo e tenta-se anular a diferença (esperando que seja menor que a inicial).
- Usar o mais possível a técnica do “least commitment”
-Ex: adiar o mais possível a ordenação das operações mantendo-as em paralelo.
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
14
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 27 Planning and Scheduling, FEUP/PRODEI /MIEIC 27
Eugénio Oliveira/FEUP
-STRIPS(e_inicial, objetivos)
estado=e_inicial; plano=[ ]; pilha=[ ]
Colocar objetivos na pilha
Repetir até pilha vazia
Se topo da pilha=objetivo unificável com estado corrente
Então retirar da pilha
Senão Se topo da pilha é objetivo conjuntivo (de sub-objetivos)
Planeador tipo- “STRIPS”
Então ordenar sub-objetivos e colocá-los na pilha
Senão Se topo da pilha objetivo simples
Então selecione op cuja lista-junte unifica com objetivo
substitua objetivo pelo operador
coloque pré-condições do op na pilha
Senão Se topo da pilha é operador op
estado=aplicar(op,estado);plano=[plano, op]
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 28 Planning and Scheduling, FEUP/PRODEI /MIEIC 28
Eugénio Oliveira/FEUP
Início Objetivo
Planeador tipo- “STRIPS”
A
B
C D
Modelo do Mundo: Pilha dos Objetivos:
Em(B,A) L Na_mesa(C ) L Em(C,A) L
Na_mesa(D) L Na_mesa(A) L Em(B,D) L
Manip_livre Na_mesa(A) L
Na_mesa(D)
1ª hipótese: 2ªhipótese (solução trivial)
Em(C,A) Em(B,D)
Em(B,D) Em(C,A)
Em(C,A) L Em(B,D) L Na_mesaA) L Na_mesa(B) (idem)
A
B
D
C
2013/ MIEIC-ProDEI
15
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 29 Planning and Scheduling, FEUP/PRODEI /MIEIC 29
Eugénio Oliveira/FEUP
Limpo(A) Esta ordem porque uma heurística diz que Segura (x)
Segura(C) deve ser a última ação da conjunção
Limpo(A) L Segura(C)
COLOCAR(C,A)
Em(B,D)
Objetivo final
Limpo(A) é verdadeiro? Não! Operador a usar: RETIRAR(x,A)
Em(x,A) Em(x,A) é Em(B,A) na base de dados
Limpo(x) Limpo(B) ? “Axioma de Enquadramento”
Manip_livre se nada em B então Limpo(B)
Em(x,A) L Limpo(x) L Manip_livre Manip_livre é verdade
*RETIRAR(x,A)
Segura(C)
Limpo(A) L Segura(C)
*COLOCAR(C,A)
Em(B,D)
Objetivo final
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 30 Planning and Scheduling, FEUP/PRODEI /MIEIC 30
Eugénio Oliveira/FEUP
A consideração de uma posição na PILHA com a conjunção de todas as condições que depois aparecem isoladamente noutras posições não é supérflua. Devem testar-se as conjunções dos sub-objetivos como precaução. Poderia acontecer que para satisfazer uma das condições isoladamente se tivesse desfeito outro já entretanto satisfeito No caso vertente não é o que se passa.
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
16
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 31 Planning and Scheduling, FEUP/PRODEI /MIEIC 31
Eugénio Oliveira/FEUP
Estado Atual da Pilha: As pré-condições do operador *RETIRAR(B,A) são aplicáveis, logo cria-se novo Modelo Segura(C) L Limpo(A) do Mundo com as listas Junte e Apague *COLOCAR(C,A) do operador RETIRAR(B,A) Em(B,D) Objetivo 1º OPERADOR RETIRAR(B,A) Modelo do Mundo Segura(B)L Segura(C) para resolver Segura(C) Limpo(A) L Segura(C) L Limpo(A) duas hipóteses: Na_mesa(A) L *COLOCAR(C,A) 1ª PEGAR(C) Na_mesa(D) L Em(B,D) 2ª RETIRAR(C,x) Na_mesa(C) Objetivo
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
A
B
C D
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 32 Planning and Scheduling, FEUP/PRODEI /MIEIC 32
Eugénio Oliveira/FEUP
Sem olhar à frente (“look ahead”) criámos duas possíveis pilhas: Na_mesa(C) Em(C,x) Limpo(C) Limpo(C) Manip_livre Manip_livre M_lLLimpo(C)LNa_mesa(C) M_lLEm(C,x)LLimpo(C) PEGAR(C) RETIRAR(C,x) Segura(C)LLimpo(A) Segura(C)LLimpo(A) COLOCAR(C,A) COLOCAR(C,A) Em(B,D) Em(B,D) Objetivo Objetivo 1ª hipótese 2ªhipótese
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
A
B
C D
17
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 33 Planning and Scheduling, FEUP/PRODEI /MIEIC 33
Eugénio Oliveira/FEUP
Comparando os Objetivos com a Base de Dados, é preferível A 1ª hipótese porque: Na_mesa(C) é verdade
Modelo do Mundo Segura(B)L Limpo(A) L Na_mesa(A) L Na_mesa(D) L Na_mesa(C)
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
A
B
C D
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 34 Planning and Scheduling, FEUP/PRODEI /MIEIC 34
Eugénio Oliveira/FEUP
Optando pela 2ª hipótese, teriamos que resolver Em(C,x) o que implicava COLOCAR(C,x). Nas pré-condições deste Operador existe Segura(C) que é precisamente o que estamos a tentar resolver. Isto é entravamos em ciclo. Na 1ª hipótese, Na_mesa(C) L Limpo(C) são verdadeiros. Manip_livre não Porque é verdeiro Segura(B).
Planeador tipo- “STRIPS”
Modelo do Mundo Segura(B)L Limpo(A) L Na_mesa(A) L Na_mesa(D) L Na_mesa(C) Podemos então usar dois operadores
cujo resultado é Manip_livre (sendo x=B): COLOCAR(x,y) POUSAR(x)
2013/ MIEIC-ProDEI
A
B
C D
18
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 35 Planning and Scheduling, FEUP/PRODEI /MIEIC 35
Eugénio Oliveira/FEUP
Olhando “à frente”, queremos Em(B,D), logo é mais eficiente seleccionar COLOCAR(x,y) Como o algoritmo vai descobrir qual selecionar? Compara as listas Junte dos dois operadores selecionáveis com os Objetivos na PILHA e escolhe aquele que resolveria algum deles. Isto é escolhe COLOCAR(B,D)
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 36 Planning and Scheduling, FEUP/PRODEI /MIEIC 36
Eugénio Oliveira/FEUP
Planeador tipo- “STRIPS”
Sem olhar à frente (“look ahead”) criariamos duas possíveis pilhas Limpo(D) Limpo(D) L Segura(B) Segura(B) verdadeiros Limpo(D)LSegura(B) implica 2º OPERADOR: *COLOCAR(B,D) COLOCAR(B,D) M_lLLimpo(C)LNa_mesa(C) PEGAR(C) Segura(C)LLimpo(A) Novo Modelo do mundo: COLOCAR(C,A) Na_mesa(A) L Em(B,D) Na_mesa(C) L
Objetivo final Na_mesa(D) L
Em(B,D) L
Manip_livre
A D
B
C
2013/ MIEIC-ProDEI
true
19
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 37 Planning and Scheduling, FEUP/PRODEI /MIEIC 37
Eugénio Oliveira/FEUP
Agora o 2º Objetivo: Em(B,D) já tinha sido satisfeito. Finalmente testar o objetivo conjunto. O Gerador Automático de Planos retorna então o Plano:
RETIRAR(B,A) COLOCAR(B,D) PEGAR(C) COLOCAR(C,A)
Usaram-se heurísticas para detectar passos incorrectos e interação entre objetivos Mas Infelizmente esta técnica não é eficaz em muitos casos…
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
A
B
C D
A
B
C
D
Todas as Pré-condições de PEGAR(C) são verdadeiras. Então: 3º OPERADOR PEGAR(C)
Todas as pré-condições de COLOCAR(C,A) são verdadeiras. Então: 4º OPERADOR COLOCAR(C,A) em muitos casos…
B
D
C
A
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 38 Planning and Scheduling, FEUP/PRODEI /MIEIC 38
Eugénio Oliveira/FEUP
VANTAGENS do STRIPS: Espaço de pesquisa reduzido (um objectivo de cada vez) Bom se os objetivos são independentes Planeamento Linear é um Algoritmo Correcto DESVANTAGENS do STRIPS: Pode produzir soluções sub-óptimas Planeamento linear é Não Completo
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
20
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 39 Planning and Scheduling, FEUP/PRODEI /MIEIC 39
Eugénio Oliveira/FEUP
Problemas com o Planeador STRIPS: Pode propôr ações irreversíveis que inviabilizam o Plano OPERADORES: Carregar(c,a) Descarregar(c,loc) Mover(a,nloc)
Planeador tipo- “STRIPS”
Pré-cond: Em(a,loc) L Em(c,loc) Dentro(c,a) L Em(a,loc) Em(a,loc) L Comb(a) Junte: Dentro(c,a) Em(c,loc) Em(a,nloc) Apague: Em(c,loc) Dentro(c,a) Em(a,loc) L Comb(a) Ex: Início { Em(Ob1,La) L Em(Ob2,La) L Em(A,La) L Comb(A) } Objetivo {Em(Ob1,Lb) L Em(Ob2,Lb) }
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 40 Planning and Scheduling, FEUP/PRODEI /MIEIC 40
Eugénio Oliveira/FEUP
Problemas com o Planeador STRIPS: Pode propor ações irreversíveis que inviabilizam o Plano Utilizando o Planeamento Linear resolvia primeiro um sub-objetivo e depois tentaria resolver o outro sub-objetivo: Plano: Carregar(Ob1,A), Mover(A,Lb), Descarregar(Ob1,Lb), Mover(A,La), Carregar(Ob2,A),… mas agora ~Comb(A) era verdadeiro e isso inviabilizaria a satisfação do segundo Objetivo
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
21
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 41 Planning and Scheduling, FEUP/PRODEI /MIEIC 41
Eugénio Oliveira/FEUP
Anomalia de “Sussman” não resolúvel eficientemente por Planeadores Lineares:
Planeador tipo- “STRIPS”
C
A B C
B
A
Início Fim Modelos do Mundo: Em(C,A) L Em(A,B) L
Na_mesa(A) L Em(B,C) L
Na_mesa(B) L Na_mesa(C) Manip_livre 1ª hipótese 2ªhipótese Em(A,B) Em(B,C) Em(B,C) Em(A,B) Em(A,B) L Em(B,C) Em(B,C) L Em(A,B)
2013/ MIEIC-ProDEI
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 42 Planning and Scheduling, FEUP/PRODEI /MIEIC 42
Eugénio Oliveira/FEUP
Planeador tipo- “STRIPS”
C
A B Em(x,A) X=C Verdade Limpo(x) X=C Verdade Manip_livre Verdade Limpo(x) L M_l L Em(x,A) Verdade RETIRAR(x,A) Executa 1º OPERADOR RETIRAR(C,A) Manip_livre Limpo(A) L M_l PEGAR(A) Limpo(B) L Segura(A) COLOCAR(A,B) Em(B,C) Em(A,B) L Em(B,C)
Anomalia de “Sussman” não resolúvel eficientemente por Planeadores Lineares:
2013/ MIEIC-ProDEI
22
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 43 Planning and Scheduling, FEUP/PRODEI /MIEIC 43
Eugénio Oliveira/FEUP
Planeador tipo- “STRIPS”
C A B
Para tornar Verdadeiro Manip_livre Implica executar POUSAR(C) Então retira da PILHA Manip_livre Até Em(B,C) OPERADORES a executar: 1º RETIRAR(C,A) 2º POUSAR(C)
Anomalia de “Sussman” não resolúvel eficientemente por Planeadores Lineares:
2013/ MIEIC-ProDEI
Estado atual da PILHA Manip_livre Limpo(A) L M_l PEGAR(A) Limpo(B) L Segura(A) COLOCAR(A,B) Em(B,C) Em(A,B) L Em(B,C)
A
C B
3º PEGAR(A) 4º COLOCAR(A,B) Modelo do Mundo: Na_mesa(B) L Em(A,B) L
Na_mesa(C) L Manip_livre
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 44 Planning and Scheduling, FEUP/PRODEI /MIEIC 44
Eugénio Oliveira/FEUP
Planeador tipo- “STRIPS”
A
C B
Mas agora, para solucionar Em(B,C) temos de seleccionar COLOCAR(B,C) O que vai implicar: OPERADORES a executar: 5º RETIRAR(A,B) 6º POUSAR(A) 7º PEGAR(B) 8º COLOCAR(B,C) 9º PEGAR(A) 10º COLOCAR(A,B) Resolveu… Mas é muito ineficiente. Tal se verificaria igualmente com a ordem contrária de resolução dos sub-objetivos.
Anomalia de “Sussman” não resolúvel eficientemente por Planeadores Lineares:
2013/ MIEIC-ProDEI
23
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 45 Planning and Scheduling, FEUP/PRODEI /MIEIC 45
Eugénio Oliveira/FEUP
Resultava o seguinte novo Plano mais eficiente:
1ºRETIRAR(C,A) 2º POUSAR(C) 3º PEGAR(B) 4º COLOCAR(B,C) (anterior 8º) 5º PEGAR(A) (anterior 9º)
6º COLOCAR(A,B) (anterior 10º) Mas em tarefas complexas pode ser difícil computar um plano complexo Que depois se desperdiça pois se deve simplificar!
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
1st RETIRARC,A) POUSAR(C) PEGAR(A) COLOCAR(A,B)
RETIRAR(A,B) POUSAR(A) PEGAR(B) COLOCAR(B,C) PEGAR(A) COLOCAR(A,B)
Como resolver esta ineficiência? Há duas hipótese de solução: 1ª Hipótese: Obter um Plano como anteriormente e depois retirar todas as ações do plano que imediatamente a seguir são desfeitas. Para o caso concreto do exemplo deve cortar-se 4 com 5 e depois 3 com 6.
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 46 Planning and Scheduling, FEUP/PRODEI /MIEIC 46
Eugénio Oliveira/FEUP
2ª Hipótese: Construir diretamente um Plano mais eficiente! Seguem-se agora algumas técnicas de Planeamento que tentam responder a estes Problemas. Planeamento Não-Linear
Planeador tipo- “STRIPS”
2013/ MIEIC-ProDEI
24
• Body Text
• Second Level
• Third Level
• Fourth Level
• Fifth Level
Planning and Scheduling, FEUP/PRODEI /MIEIC 47 Planning and Scheduling, FEUP/PRODEI /MIEIC 47
Eugénio Oliveira/FEUP
Planeamento Não-Linear usando um Conjunto de objetivos:
Planeador NÃO-Linear
2013/ MIEIC-ProDEI