2016-06-23 3 views
2

私は、記述言語pddlを使ってプランナを使って(単一エージェント)ゲームを解決しようとしています。私の目指すのは、世界の人々に物を届けられる可能性の高いポイントを得ることです。PDDLの関数を最大化する

機能(puntos)は、次のアクションの説明で与えられる:

(:action dar 
    :parameters (?x - objeto ?y - personaje ?z - robot ?t - zona) 
    :precondition (and (cogido ?x) (not (tiene ?y ?x))(en ?t ?y)(ubicado ?t ?z)) 
    :effect (and (tiene ?y ?x) (manovacia) (not (cogido ?x))(decrease (puntos) (suma-puntos ?x ?y))) 
) 

と私はpuntos機能を最大化することにより、最も可能性のポイントを取得しようとしているが、プランナーは言う:

change on metric in wrong direction. metric replaced with plan length. 

どうすればこの問題を解決できますか?

ドメインの完全なPDDLの説明は次のとおりです。

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;; Mundos de Belkan 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;Autor: Rafael Leyva Ruiz. 
;Asignatura TSI (Tecnicas de los Sistemas inteligentes) 
;grado en ingenieria informatica especialidad en computacion y sistemas inteligentes 
;2015-2016 

;Definicion del dominio para el problema de los mundos de Belkan. 
(define (domain BELKAN-DOMAIN) 
    (:requirements :strips :typing) 
    (:types robot zona personaje objeto tipo mochila) 
    ;Declaracion de los predicados del mundo de Belkan 
    (:functions 
     (total-fuel) ;;representa la energia del problema 
     (coste-zona ?z - tipo) 
     (suma-puntos ?x - objeto ?y - personaje) 
     (capacidad-mochila) 
     (ocupado-mochila) 
     (puntos) 
     (constante) 
    ) 
    (:predicates 
      (en ?x - zona ?y - personaje) 
      (esta ?x - zona ?y - objeto) 
      (ubicado ?x - zona ?y - robot) 
      (tiene ?x - personaje ?y - objeto) 
      (carga ?x - robot ?y - mochila ?z - objeto) 
      (manovacia) 
      (cogido ?x - objeto) 
      (cargado ?x - objeto) 
      (clase ?x - zona ?y - tipo) 
      (camino ?x - zona ?y - zona) 
      (permite-avanzar ?x - tipo ?y - objeto) 
      (no-necesita-objeto ?x - tipo ?q - objeto) 
    ) 

    ;ACC: Coger(x) 
    ;LP: libre(x)^manovacia 
    ;lS: manovacia^libre(x) 
    ;LA: tengo(x) 
    (:action coger 
     :parameters (?x - objeto ?y - zona ?z - robot) 
     :precondition (and (manovacia)(esta ?y ?x)(ubicado ?y ?z)) 
     :effect (and (not (manovacia))(cogido ?x)(not (esta ?y ?x)))) 

    ;ACC: cargar(x) (Carga en la mochila) 
    ;LP: cogido(x)^mochilavacia 
    ;lS: cogido(x) 
    ;LA: manovacia^cargado(x) 
    (:action cargar 
     :parameters (?x - objeto ?y - robot) 
     :precondition (and (cogido ?x) 
        (> (-(capacidad-mochila)(ocupado-mochila)) 0)) 
     :effect (and (increase (ocupado-mochila) 1)(not (cogido ?x))(manovacia)(cargado ?x))) 
    ;ACC:sacar-mochila 
    ;LP: 
    (:action sacar-mochila 
     :parameters (?x - objeto ?y - robot) 
     :precondition (and (manovacia)(cargado ?x)) 
        ;(>= (ocupado-mochila)1)) 
     :effect (and (cogido ?x)(decrease (ocupado-mochila) 1)(not (cargado ?x))(not (manovacia)))) 

    ;ACC: dar(x, y) 
    ;LP: tengo(x)^¬(tiene(y, x)) 
    ;lS: tengo(x) 
    ;LA: tiene(y, x)^manovacia 
    (:action dar 
     :parameters (?x - objeto ?y - personaje ?z - robot ?t - zona) 
     :precondition (and (cogido ?x) (not (tiene ?y ?x))(en ?t ?y)(ubicado ?t ?z)) 
     :effect (and (tiene ?y ?x) (manovacia) (not (cogido ?x))(increase (puntos) (suma-puntos ?x ?y))) 
     ;;en los probl del ejercicio 6 se arranca con 50 puntos y se resta con cada entrega 
    ) 

    ;ACC:dejar(x) 
    ;LP:(tengo(x)) 
    ;lS:(tengo(x)) 
    ;LA:(manovacia) 
    :(:action dejar 
     :parameters (?x - objeto ?y - zona ?z - robot) 
     :precondition (and (cogido ?x)(ubicado ?y ?z)) 
     :effect (and (manovacia)(not (cogido ?x))(esta ?y ?x))) 

    ;ACC: (mover(x, y) 
    ;LP: en(x)^¬en(y)^camino(x, y) 
    ;lS: en(y) 
    ;LA: en(x) 
    (:action mover 
     :parameters (?z - robot ?x - zona ?y - zona ?t - tipo ?q - objeto) 
     :precondition (and (not (ubicado ?y ?z))(ubicado ?x ?z)(camino ?x ?y) 
         (or(cogido ?q)(cargado ?q))(and (clase ?y ?t)(or(permite-avanzar ?t ?q)(no-necesita-objeto ?t ?q))) 
         (>=(-(total-fuel)(coste-zona ?t))0)) 
     :effect (and (ubicado ?y ?z)(not (ubicado ?x ?z))(decrease (total-fuel) (coste-zona ?t))) 
    ) 
) 

し、問題がある:

(define (problem BELKAN) 

(:domain BELKAN-DOMAIN) 

(:OBJECTS Z1 Z2 Z3 Z4 Z5 Z6 Z7 Z8 Z9 Z10 Z11 Z12 Z13 Z14 Z15 Z16 Z17 Z18 Z19 Z20 Z21 Z22 Z23 Z24 
    Z25 - zona ROBOT - robot OSCAR MANZANA ROSA ALGORITMO ORO BIKINI ZAPATILLA - objeto PRINCESA PRINCIPE BRUJA 
    PROFESOR LEONARDO - personaje MOCHILA - mochila BOSQUE PLAYA PRECIPICIO ARENA PIEDRA - tipo) 

(:INIT 
     (CAMINO Z1 Z2) 
     (CAMINO Z2 Z1) 
     (CAMINO Z2 Z3) 
     (CAMINO Z3 Z2) 
     (CAMINO Z3 Z4) 
     (CAMINO Z4 Z3) 
     (CAMINO Z5 Z6) 
     (CAMINO Z6 Z5) 
     (CAMINO Z6 Z7) 
     (CAMINO Z7 Z6) 
     (CAMINO Z7 Z8) 
     (CAMINO Z8 Z7) 
     (CAMINO Z9 Z10) 
     (CAMINO Z10 Z9) 
     (CAMINO Z10 Z11) 
     (CAMINO Z11 Z12) 
     (CAMINO Z12 Z11) 
     (CAMINO Z13 Z14) 
     (CAMINO Z14 Z13) 
     (CAMINO Z14 Z15) 
     (CAMINO Z15 Z14) 
     (CAMINO Z15 Z16) 
     (CAMINO Z16 Z15) 
     (CAMINO Z1 Z5) 
     (CAMINO Z5 Z1) 
     (CAMINO Z2 Z6) 
     (CAMINO Z6 Z2)   ;  1 <-> 2 <-> 3 <-> 4 
     (CAMINO Z3 Z7)   ;  |  |  |  | 
     (CAMINO Z7 Z3)   ;  5 <-> 6 <-> 7 <-> 8 
     (CAMINO Z4 Z8)   ;  |  |  |  | 
     (CAMINO Z8 Z4)   ;  9 <-> 10 <-> 11 <-> 12 
     (CAMINO Z5 Z9)   ;  |  |  |  | 
     (CAMINO Z9 Z5)   ;  13 <-> 14 <-> 15 <-> 16 
     (CAMINO Z6 Z10)   
     (CAMINO Z10 Z6)   
     (CAMINO Z7 Z11)   
     (CAMINO Z11 Z7)   
     (CAMINO Z8 Z12)   
     (CAMINO Z12 Z8)   
     (CAMINO Z9 Z13)   
     (CAMINO Z13 Z9) 
     (CAMINO Z10 Z14) 
     (CAMINO Z14 Z10) 
     (CAMINO Z11 Z15) 
     (CAMINO Z15 Z11) 
     (CAMINO Z12 Z16) 
     (CAMINO Z16 Z12) 
;  s(CAMINO Z2 Z5) 
;  (CAMINO Z5 Z2) 
;  (CAMINO Z3 Z6) 
;  (CAMINO Z6 Z3) 
;  (CAMINO Z4 Z7) 
;  (CAMINO Z7 Z4) 
;  (CAMINO Z6 Z9) 
;  (CAMINO Z9 Z6) 
;  (CAMINO Z7 Z10) 
;  (CAMINO Z10 Z7) 
;  (CAMINO Z8 Z11) 
;  (CAMINO Z11 Z8) 
;  (CAMINO Z10 Z13) 
;  (CAMINO Z13 Z10) 
;  (CAMINO Z11 Z14) 
;  (CAMINO Z14 Z11) 
;  (CAMINO Z12 Z15) 
;  (CAMINO Z15 Z12) 

     ;;;;;;;;;;;;;;;; 
     ;objetos 
     (ESTA Z2 ORO) 
     (EN Z4 PRINCIPE) 
     (EN Z6 LEONARDO) 
     (EN Z7 BRUJA) 
     (ESTA Z5 OSCAR) 
     (ESTA Z10 MANZANA) 
     (EN Z13 PRINCESA) 
     (ESTA Z14 ROSA) 
     (EN Z9 PROFESOR) 
     (ESTA Z12 ALGORITMO) 
     (UBICADO Z5 ROBOT) 
     (MANOVACIA) 

     ;;;;;;;;;;;;;;;;;; 
     ;tipos de zonas 
     (CLASE Z1 PRECIPICIO) 
     (CLASE Z2 PLAYA) 
     (CLASE Z3 PLAYA) 
     (CLASE Z4 BOSQUE) 
     (CLASE Z5 PIEDRA) 
     (CLASE Z6 PIEDRA) 
     (CLASE Z7 BOSQUE) 
     (CLASE Z8 BOSQUE) 
     (CLASE Z9 BOSQUE) 
     (CLASE Z10 PLAYA) 
     (CLASE Z11 BOSQUE) 
     (CLASE Z12 ARENA) 
     (CLASE Z13 BOSQUE) 
     (CLASE Z14 ARENA) 
     (CLASE Z15 PLAYA) 
     (CLASE Z16 ARENA) 

     ;;;;;;;;;;;;;;;;;;;;; 
     (PERMITE-AVANZAR PLAYA BIKINI) 
     (PERMITE-AVANZAR BOSQUE ZAPATILLA) 
     (NO-NECESITA-OBJETO ARENA BIKINI) 
     (NO-NECESITA-OBJETO PIEDRA BIKINI) 
     (NO-NECESITA-OBJETO PRECIPICIO BIKINI) 
     (NO-NECESITA-OBJETO ARENA ZAPATILLA) 
     (NO-NECESITA-OBJETO PIEDRA ZAPATILLA) 
     (NO-NECESITA-OBJETO PRECIPICIO ZAPATILLA) 
     (ESTA Z5 ZAPATILLA) 
     (ESTA Z4 BIKINI) 
     (= (coste-zona PRECIPICIO) 10000) 
     (= (coste-zona PLAYA) 1) 
     (= (coste-zona BOSQUE) 1) 
     (= (coste-zona ARENA) 1) 
     (= (coste-zona PIEDRA) 2) 
     (= (total-fuel) 100) 
     (= (puntos) 0) 
     (= (suma-puntos OSCAR LEONARDO) -10) 
     (= (suma-puntos OSCAR PRINCESA) -5) 
     (= (suma-puntos OSCAR BRUJA) -4) 
     (= (suma-puntos OSCAR PROFESOR) -3) 
     (= (suma-puntos OSCAR PRINCIPE) -1) 
     (= (suma-puntos ROSA LEONARDO) -1) 
     (= (suma-puntos ROSA PRINCESA) -10) 
     (= (suma-puntos ROSA BRUJA) -5) 
     (= (suma-puntos ROSA PROFESOR) -4) 
     (= (suma-puntos ROSA PRINCIPE) -3) 
     (= (suma-puntos MANZANA LEONARDO) -3) 
     (= (suma-puntos MANZANA PRINCESA) -1) 
     (= (suma-puntos MANZANA BRUJA) -10) 
     (= (suma-puntos MANZANA PROFESOR) -5) 
     (= (suma-puntos MANZANA PRINCIPE) -4) 
     (= (suma-puntos ALGORITMO LEONARDO) -4) 
     (= (suma-puntos ALGORITMO PRINCESA) -3) 
     (= (suma-puntos ALGORITMO BRUJA) -1) 
     (= (suma-puntos ALGORITMO PROFESOR) -10) 
     (= (suma-puntos ALGORITMO PRINCIPE) -5) 
     (= (suma-puntos ORO LEONARDO) -5) 
     (= (suma-puntos ORO PRINCESA) -4) 
     (= (suma-puntos ORO BRUJA) -3) 
     (= (suma-puntos ORO PROFESOR) -1) 
     (= (suma-puntos ORO PRINCIPE) -10) 

     (= (capacidad-mochila) 5) 
     (= (ocupado-mochila) 0) 
     (= (CONSTANTE) -1) 

) 
(:goal (and (UBICADO Z16 ROBOT))) 
;(TIENE PRINCIPE ORO)(TIENE BRUJA MANZANA) 
;(:goal (and (forall (?x - personaje)(?y - objeto)) (TIENE ?x ?y))) 
;(:metric minimize (*(CONSTANTE)(puntos))) 
(:metric maximize (puntos)) 
) 

答えて

0

例えばsuma-puntos oscar leonardoはボーナスの10ポイントを持っているメトリックは、ポイントの逆関数でなければなりませんsuma-puntos OSCAR LEONARDO 0の場合はsuma-puntos OSCAR LEONARDO 10に変更してください。他の例では、suma-puntos BRUJA OSCAR 6suma-puntos BRUJA OSCAR 4となり、問題のメトリックのペナルティを最小限に抑えます。これらのコードで:

(= (puntos) 50) 
.... 
(:metric maximize (puntos)) 

編集:

メトリックが負であるか、またはメトリック-FF間違い与える必要があります。間違った方向に メトイコイの変更を。

関連する問題