Advertisement
Guest User

Untitled

a guest
May 21st, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. (define (domain jug-pouring)
  2. (:requirements :typing :fluents)
  3. (:types jug)
  4. (:functions
  5. ;amount of water in a jug
  6. (amount ?j - jug)
  7. ;capacity of a jug
  8. (capacity ?j - jug)
  9. ;how many actions were already done
  10. (pour-counter))
  11. ;pour entire jug
  12. (:action pour-to-empty
  13. :parameters (?jug1 ?jug2 - jug)
  14. :precondition (and
  15. ; jugs should be different
  16. (not (= ?jug1 ?jug2))
  17. ; first jug can't be empty
  18. (not (= (amount ?jug1) 0))
  19. ; the second jug has to have enough empty space
  20. (>= (- (capacity ?jug2) (amount ?jug2)) (amount ?jug1)))
  21. :effect (and
  22. ; mark first jug as empty
  23. (assign (amount ?jug1) 0)
  24. ; add amount from the first jug to the second
  25. (increase (amount ?jug2) (amount ?jug1))
  26. ; increase pour-counter
  27. (increase (pour-counter) 1))
  28. )
  29. ;pour only part of the jug
  30. (:action pour-partly
  31. :parameters (?jug1 ?jug2 - jug)
  32. :precondition (and
  33. ; jugs should be different
  34. (not (= ?jug1 ?jug2))
  35. ; first jug can't be empty
  36. (> (amount ?jug1) 0)
  37. ; second jug should have less space than water contained in the first jug
  38. (< (- (capacity ?jug2) (amount ?jug2)) (amount ?jug1)))
  39. :effect (and
  40. ; decrease the amount of the water in the first jug
  41. (decrease (amount ?jug1) (- (capacity ?jug2) (amount ?jug2)))
  42. ; mark the second jug as full
  43. (assign (amount ?jug2) (capacity ?jug2))
  44. ; increase pour-counter
  45. (increase (pour-counter) 1))
  46. )
  47. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement