0

我有这个任务: 如下图所示,给出了包含3 个红球和3 个黑球的16 个隔间。重新排列球,使相邻的三个红球紧随其后的是黑球!两个相邻的球可以同时从它们的隔间中捡起并移动到两个相邻的隔间,同时保持它们的顺序。

  PFPFPF__________

我已经推断出一个可能的解决方案,但我收到如下错误消息:

/tmp/solver_planning_domains_tmp_41C20mfKR69ZM/domain.pddl: syntax error in line 110, '(':
domain definition expected.

这是我的解决方案,但我知道有更好的解决方案,所以我接受任何帮助!谢谢!

;;;
(define (problem ball)
   (:domain ball)
   (:objects vp vp  vp vf vf vf)
   (:init
        (at vp pos1)
    (at vf pos2)
    (at vp pos3)
    (at vf pos4)
    (at vp pos5)
    (at vf pos6)
        (clear pos7)
        (clear pos8)
        (clear pos9)
        (clear pos10)
        (clear pos11)
        (clear pos12)
        (clear pos13)
        (clear pos14)
        (clear pos15)
        (clear pos16)

   )
   (:goal (and 
       (clear pos1)
       (clear pos2)
       (clear pos3)    
       (clear pos4)    
       (clear pos5)    
       (clear pos6)
       (clear pos7)
       (clear pos8)
       (at vp pos9)
       (at vp pos10)
       (at vp pos11)
       (at vf pos12)
       (at vf pos13)
       (at vf pos14)
       (clear pos15)
       (clear pos16)    
       ))
  
)
(define (domain ball)
   (:requirements :strips)
   (:predicates (pos1 ?v)
                (pos2 ?v)
                (pos3 ?v)
                (pos4 ?v)
                (pos5 ?v)
                (pos6 ?v)
                (pos7 ?v)
                (pos8 ?v)
                (pos9 ?v)
                (pos10 ?v)
                (pos11 ?v)
                (pos12 ?v)
                (pos13 ?v)
                (pos14 ?v)
                (pos15 ?v)
                (pos16 ?v))

   ;     _______                _______
   ;    P F P F P F_ _ _ _ _ _ _ _ _ _  --->  P F P F _ _PF _ _ _ _ _ _ _ _
   ;
   (:action move1
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (pos1 ?vp)
                (pos2 ?vP) 
                                (pos3 ?vp)
                (pos4 ?vf)
                (pos5 ?vF)
                (pos6 ?vf)
                (clear pos7)
                (clear pos8)
                (clear pos9)
                (clear pos10)
                (clear pos11)
                (clear pos12)
                (clear pos13)
                (clear pos14)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (pos1 ?vp)              
                           (pos2 ?vp)              
                           (pos3 ?vp)              
                           (pos4 ?vf)              
                           (clear pos5)              
                           (clear pos6)  
               (pos7 ?vp)
               (pos8 ?vf)       
                           (not (pos5 ?vp))
                           (not (pos6 ?vf))
                   (clear pos9)
               (clear pos10)
               (clear pos11)
               (clear pos12)
               (clear pos13)
               (clear pos14)
               (clear pos15)
               (clear pos16))
    ) 

;   P F P F _ _PF _ _ _ _ _ _ _ _   - - -> P _ _ F _ _P F F P _ _ _ _ _ _ 
 (:action move2
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (pos1 ?vp)
                (pos2 ?vP) 
                                (pos3 ?vp)
                (pos4 ?vf)
                (clear pos5)
                (clear pos6)
                (pos7 ?vp)
                (pos8 ?vf)
                (clear pos9)
                (clear pos10)
                (clear pos11)
                (clear pos12)
                (clear pos13)
                (clear pos14)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (pos1 ?vp)              
                           (clear pos2)              
                           (clear pos3)              
                           (pos4 ?vf)              
                           (clear pos5)              
                           (clear pos6)  
               (pos7 ?vp)
               (pos8 ?vf)       
                           (pos9 ?vf)
                           (pos10 ?vp)
               (clear pos11)
               (clear pos12)
               (clear pos13)
               (clear pos14)
               (clear pos15)
               (clear pos16)
               (not (pos2 ?vf))
               (not (pos3 ?vp))
               (not (clear pos9))
               (not (clear pos10))
    ) 

;    P _ _ F _ _ P F F P _ _ _ _ _ _ ---> P P F F _ _ _ _ F P _ _ _ _ _ _

 (:action move3
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (pos1 ?vp)
                (clear pos2) 
                                (clear pos3)
                (pos4 ?vf)
                (clear pos5)
                (clear pos6)
                (pos7 ?vp)
                (pos8 ?vf)
                (pos9 ?vf)
                (pos10 ?vp)
                (clear pos11)
                (clear pos12)
                (clear pos13)
                (clear pos14)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (pos1 ?vp)              
                           (pos2 ?vp)              
                           (pos3 ?vf)              
                           (pos4 ?vf)              
                           (clear pos5)              
                           (clear pos6)
                   (clear pos7)
               (clear pos8)  
               (pos9 ?vf)
               (pos10 ?vp)      
               (clear pos11)
               (clear pos12)
               (clear pos13)
               (clear pos14)
               (clear pos15)
               (clear pos16)
               (not (clear pos2))
               (not (clear pos3))
               (not (pos7 ?vp))
               (not (pos8 ?vf))
    ) 

;  P P F F _ _ _ _ F P _ _ _ _ _ _ ---> P P _ _ _ _ _ _ F P F F _ _ _ _

 (:action move4
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (pos1 ?vp)
                (pos2 ?vP) 
                                (pos3 ?vf)
                (pos4 ?vf)
                (clear pos5)
                (pos6 ?vf)
                (clear pos7)
                (clear pos8)
                (pos9 ?vf)
                (pos10 ?vp)
                (clear pos11)
                (clear pos12)
                (clear pos13)
                (clear pos14)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (pos1 ?vp)              
                           (pos2 ?vp)              
                           (clear pos3)              
                           (clear pos4)              
                           (clear pos5)              
                           (clear pos6)
                   (clear pos7)
               (clear pos8)  
               (pos9 ?vf)
               (pos10 ?vp)      
               (pos11 ?vf)
               (pos12 ? vf)
               (clear pos13)
               (clear pos14)
               (clear pos15)
               (clear pos16)
               (not (pos3 ?vf))
               (not (pos4 ?vf))
               (not (clear pos11))
               (not (clear pos12))
    ) 

;  P P _ _ _ _ _ _ F P F F _ _ _ _  ---> P P _ _ _ _ P F F _ _ F _ _ _ _

 (:action move5
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (pos1 ?vp)
                (pos2 ?vP) 
                                (clear pos3)
                (clear pos4)
                (clear pos5)
                (clear pos6)
                (clear pos7)
                (clear pos8)
                (pos9 ?vf)
                (pos10 ?vp)
                (pos11 ?vf)
                (pos12 ?vf)
                (clear pos13)
                (clear pos14)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (pos1 ?vp)              
                           (pos2 ?vp)              
                           (clear pos3)              
                           (clear pos4)              
                           (clear pos5)              
                           (clear pos6)
                   (pos7 ?vp)
               (pos8 ?vf)  
               (pos9 ?vf)
               (clear pos10)        
               (clear pos11)
               (pos12 ? vf)
               (clear pos13)
               (clear pos14)
               (clear pos15)
               (clear pos16)
               (not (pos10 ?vp))
               (not (pos11 ?vf))
               (not (clear pos7))
               (not (clear pos8))
    ) 

;  P P _ _ _ _ P F F _ _ F _ _ _ _  ---> _ _ _ _ _ _ P F F P P F _ _ _ _

 (:action move6
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (pos1 ?vp)
                (pos2 ?vP) 
                                (clear pos3)
                (clear pos4)
                (clear pos5)
                (clear pos6)
                (pos7 ?vp)
                (pos8 ?vf)
                (pos9 ?vf)
                (clear pos10)
                (clear pos11)
                (pos12 ?vf)
                (clear pos13)
                (clear pos14)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (clear pos1)              
                           (clear pos2)              
                           (clear pos3)              
                           (clear pos4)              
                           (clear pos5)              
                           (clear pos6)
                   (pos7 ?vp)
               (pos8 ?vf)  
               (pos9 ?vf)
               (pos10 ?vp)      
               (pos11 ?vp)
               (pos12 ? vf)
               (clear pos13)
               (clear pos14)
               (clear pos15)
               (clear pos16)
               (not (pos1 ?vp))
               (not (pos2 ?vp))
               (not (clear pos10))
               (not (clear pos11))
    ) 

; _ _ _ _ _ _ P F F P P F _ _ _ _  ---> _ _ P P _ _ P F F _ _ F _ _ _ _

 (:action move7
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (clear pos1)
                (clear pos2) 
                                (clear pos3)
                (clear pos4)
                (clear pos5)
                (clear pos6)
                (pos7 ?vp)
                (pos8 ?vf)
                (pos9 ?vf)
                (pos10 ?vp)
                (pos11 ?vp)
                (pos12 ?vf)
                (clear pos13)
                (clear pos14)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (clear pos1)              
                           (clear pos2)              
                           (pos3 ?vp)              
                           (pos4 ?vp)              
                           (clear pos5)              
                           (clear pos6)
                   (pos7 ?vp)
               (pos8 ?vf)  
               (pos9 ?vf)
               (clear pos10)        
               (clear pos11)
               (pos12 ? vf)
               (clear pos13)
               (clear pos14)
               (clear pos15)
               (clear pos16)
               (not (pos10 ?vp))
               (not (pos11 ?vp))
               (not (clear 3))
               (not (clear 4))
    ) 

;  _ _ P P _ _ P F F _ _ F _ _ _ _    --->  _ _P P F F P _ _ _ _ F _ _ _ _

 (:action move8
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (clear pos1)
                (clear pos2) 
                                (pos3 ?vp)
                (pos4 ?vp)
                (clear pos5)
                (clear pos6)
                (pos7 ?vp)
                (pos8 ?vf)
                (pos9 ?vf)
                (clear pos10)
                (clear pos11)
                (pos12 ?vf)
                (clear pos13)
                (clear pos14)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (clear pos1)              
                           (clear pos2)              
                           (pos3 ?vp)              
                           (pos4 ?vp)              
                           (pos5 ?vf)              
                           (pos6 ?vf)
                   (pos7 ?vp)
               (clear pos8)  
               (clear pos9)
               (clear pos10)        
               (clear pos11)
               (pos12 ? vf)
               (clear pos13)
               (clear pos14)
               (clear pos15)
               (clear pos16)
               (not (pos8 ?vf))
               (not (pos9 ?vf))
               (not (clear 5))
               (not (clear 6))
    ) 


;    --->  _ _P P F F P _ _ _ _ F _ _ _ _     --->  _ _ P P _ _ P _ _ _ _ F F F _ _

 (:action move9
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (clear pos1)
                (clear pos2) 
                                (pos3 ?vp)
                (pos4 ?vp)
                (pos5 ?vF)
                (pos6 ?vf)
                (pos7 ?vp)
                (clear pos8)
                (clear pos9)
                (clear pos10)
                (clear pos11)
                (pos12 ?vf)
                (clear pos13)
                (clear pos14)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (clear pos1)              
                           (clear pos2)              
                           (pos3 ?vp)              
                           (pos4 ?vp)              
                           (clear pos5)              
                           (clear pos6)
                   (pos7 ?vp)
               (clear pos8)  
               (clear pos9)
               (clear pos10)        
               (clear pos11)
               (pos12 ?vf)
               (pos13 ?vf)
               (pos14 ?vf)
               (clear pos15)
               (clear pos16)
               (not (pos5 ?vf))
               (not (pos6 ?vf))
               (not (clear 13))
               (not (clear 14))
    ) 


;       --->  _ _ P P _ _ P _ _ _ _ F F F _ _    ---> _ _ _ _ P P P _ _ _ _ F F F _ _

 (:action move10
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (clear pos1)
                (clear pos2) 
                                (pos3 ?vp)
                (pos4 ?vp)
                (clear pos5)
                (clear pos6)
                (pos7 ?vp)
                (clear pos8)
                (clear pos9)
                (clear pos10)
                (clear pos11)
                (pos12 ?vf)
                (pos13 ?vf)
                (pos14 ?vf)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (clear pos1)              
                           (clear pos2)              
                           (clear pos3)              
                           (clear pos4)              
                           (pos5 ?vp)              
                           (pos6 ?vp)
                   (pos7 ?vp)
               (clear pos8)  
               (clear pos9)
               (clear pos10)        
               (clear pos11)
               (pos12 ?vf)
               (pos13 ?vf)
               (pos14 ?vf)
               (clear pos15)
               (clear pos16)
               (not (pos3 ?vp))
               (not (pos4 ?vp))
               (not (clear 5))
               (not (clear 6))
    ) 

;      _ _ _ _ P P P _ _ _ _ F F F _ _  ---> _ _ _ _ _ _ P P P _ _ F F F _ _

 (:action move11
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (clear pos1)
                (clear pos2) 
                                (clear pos3)
                (clear pos4)
                (pos5 ?vp)
                (pos6 ?vp)
                (pos7 ?vp)
                (clear pos8)
                (clear pos9)
                (clear pos10)
                (clear pos11)
                (pos12 ?vf)
                (pos13 ?vf)
                (pos14 ?vf)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (clear pos1)              
                           (clear pos2)              
                           (clear pos3)              
                           (clear pos4)              
                           (clear pos5)              
                           (clear pos6)
                   (pos7 ?vp)
               (pos8 ?vp)  
               (pos9 ?vp)
               (clear pos10)        
               (clear pos11)
               (pos12 ?vf)
               (pos13 ?vf)
               (pos14 ?vf)
               (clear pos15)
               (clear pos16)
               (not (pos5 ?vp))
               (not (pos6 ?vp))
               (not (clear 8))
               (not (clear 9))
    ) 


;   _ _ _ _ _ _ P P P _ _ F F F _ _    ---> _ _ _ _ _ _ _ _ P P P F F F _ _

 (:action move12
             :parameters (?vp ?vp ?vp ?vf ?vf ?vf)
             :precondition (and (clear pos1)
                (clear pos2) 
                                (clear pos3)
                (clear pos4)
                (clear pos5)
                (clear pos6)
                (pos7 ?vp)
                (pos8 ?vp)
                (pos9 ?vp)
                (clear pos10)
                (clear pos11)
                (pos12 ?vf)
                (pos13 ?vf)
                (pos14 ?vf)
                (clear pos15)
                (clear pos16)
                                
                                )
             :effect  (and 
                           (clear pos1)              
                           (clear pos2)              
                           (clear pos3)              
                           (clear pos4)              
                           (clear pos5)              
                           (clear pos6)
                   (clear pos7)
               (clear pos8)  
               (pos9  ?vp)
               (pos10 ?vp)      
               (pos11 ?vp)
               (pos12 ?vf)
               (pos13 ?vf)
               (pos14 ?vf)
               (clear pos15)
               (clear pos16)
               (not (pos7 ?vp))
               (not (pos8 ?vp))
               (not (clear 10))
               (not (clear 11))
    ) 
4

1 回答 1

0

您缺少括号来关闭(domain ...)语句。

于 2022-01-14T13:38:14.447 回答