Adder p01

From Ippc2008

Jump to: navigation, search

Domain:

(define (domain adder)
    (:requirements :typing :equality)
   (:types bit)
   (:predicates (high ?b - bit) (low ?b - bit) (constant ?b - bit))
   (:action and-gate
     :parameters (?x ?y ?z - bit)
     :precondition (and (not (constant ?z)) (not (= ?x ?y)) (not (= ?x ?z)) (not (= ?y ?z)))
     :effect (and (when (and (high ?x) (high ?y)) (and (not (low ?z)) (high ?z)))
                  (when (low ?x) (and (not (high ?z)) (low ?z)))
                  (when (low ?y) (and (not (high ?z)) (low ?z)))
             )
   )
   (:action or-gate
     :parameters (?x ?y ?z - bit)
     :precondition (and (not (constant ?z)) (not (= ?x ?y)) (not (= ?x ?z)) (not (= ?y ?z)))
     :effect (and (when (high ?x) (and (not (low ?z)) (high ?z)))
                  (when (high ?y) (and (not (low ?z)) (high ?z)))
                  (when (and (low ?x) (low ?y)) (and (not (high ?z)) (low ?z))))
   )
   (:action xor-gate
     :parameters (?x ?y ?z - bit)
     :precondition (and (not (constant ?z)) (not (= ?x ?y)) (not (= ?x ?z)) (not (= ?y ?z)))
     :effect (and (when (and (high ?x) (low ?y)) (and (not (low ?z)) (high ?z)))
                  (when (and (low ?x) (high ?y)) (and (not (low ?z)) (high ?z)))
                  (when (and (low ?x) (low ?y)) (and (not (high ?z)) (low ?z)))
                  (when (and (high ?x) (high ?y)) (and (not (high ?z)) (low ?z))))
   )
   (:action not-gate
     :parameters (?x ?z - bit)
     :precondition (and (not (constant ?z)) (not (= ?x ?z)))
     :effect (and (when (low ?x) (and (not (low ?z)) (high ?z)))
                  (when (high ?x) (and (not (high ?z)) (low ?z))))
   )
)

Problem:

(define (problem p1)
  (:domain adder)
  (:objects t f tmp1 tmp2 x1 y1 r1 z1 r2 z2 - bit)
  (:init (and (high t) (low f)
              (low r1) (low r2) 
              (low z1) (low z2) 
              (oneof (low x1) (high x1))
              (oneof (low y1) (high y1))
              (constant x1) 
              (constant y1) 
        )
  )
  (:goal (and (low r1)
              (or (low z2) (high r2))
              (or (low r2) (high z2))
              (or (low r2) (high x1) (high y1))
              (or (low r2) (high x1) (high r1))
              (or (low r2) (high y1) (high r1))
              (or (low x1) (low y1) (high r2))
              (or (low x1) (low r1) (high r2))
              (or (low y1) (low r1) (high r2))
              (or (low z1) (low x1) (high y1) (low r1))
              (or (low z1) (low x1) (low y1) (high r1))
              (or (low z1) (high x1) (low y1) (low r1))
              (or (low z1) (high x1) (high y1) (high r1))
              (or (low x1) (low y1) (low r1) (high z1))
              (or (low x1) (high y1) (high r1) (high z1))
              (or (high x1) (low y1) (high r1) (high z1))
              (or (high x1) (high y1) (low r1) (high z1))
        )
  )
)