0

I have this task: 16 compartments containing 3 red and 3 black balls are given as shown in the figure below. Rearrange the balls so that the three red balls next to each other are directly followed by the black balls! Two adjacent balls can be picked up from their compartment at the same time and moved to two adjacent compartments while maintaining their order.

  PFPFPF__________

I have deduced a possible solution, but I get an error message like this:

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

Here is my solution, but i know there is a better, so i accept any help! Thanks!

;;;
(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))
    ) 
Bilal
  • 3,191
  • 4
  • 21
  • 49
Rox
  • 1

1 Answers1

0

You are missing parentheses to close the (domain ...) statement.

Victor Paléologue
  • 2,025
  • 1
  • 17
  • 27