CSE 574: Planning & Learning Instructor: Dr. Subbarao Kambhampati Project 1 Submission Name: Srinivas Vadrevu Date: 09/23/2004 1. English Description of the Domain: This domain describes various stages in human life, the incidents he/she goes through, and their effect on his /her life. The predicates in the domain correspond to various conditions in the human life, for e.g., whether the person is alive, dead, has college degree, married, broke, or blissful. The domain also models some material/non-material possessions of the human, for e.g., car, home, education, etc. The actions in the domain describe various incidents that happen in the life of a human, such as graduation, securing a job and getting married. Some of the problems defined in the domain include transitioning from one stage of the life to another stage. Since the desired plan is very obvious in these problems, it is interesting to see that the planners which do not have any prior knowledge of the domain perform according to the expectations. 2. PDDL Description: ;; ;; PDDL file for the domain LIFE ;; created for CSE 574: Planning and Learning Course by Subbarao Kambhampati at ASU ;; ;; Author: Srinivas Vadrevu 09/21/2004 ;; ;; Disclaimer: The conditions, situations expressed in this domain and ;; problems are fictious and have no resemblence to any particular person. ;; Any similarity to actual persons living or dead is unintentional ;; and purely coincidental. This domain and problems do not reflect the thoughts ;; or opinions of my company, my university, my colleagues, my parents, ;; my significant other, my friends, my worst enemies, or me; don't quote ;; me on that; don't quote me on anything, except that what I say is OK. (define (domain life) (:requirements :adl :typing :conditional-effects) (:types degree job academicarea place university name car) (:predicates (rich ?n1 -name) (child ?n1 - name) (young ?n1 - name) (old ?n1 - name) (has-job ?n1 - name ?j1 - job) (no-college-degree ?n1 - name) (single ?n1 - name) (studies-in ?n1 - name ?d1 - degree ?a1 - academicarea ?u1 - university ?p1 - place) (has-degree ?n1 - name ?d1 - degree ?a1 - academicarea ?u1 - university ?p1 - place) (broke ?n1 - name) (married ?n1 - name ?n2 - name) (divorced ?n1 - name) (retired ?n1 - name) (resides-in ?n1 - name ?p1 - place) (has-car ?n1 - name ?c1 - car) (has-house ?n1 - name ?p1 - place) (yogi ?n1 - name) (blissful ?n1 - name) (alive ?n1 - name) (drug-addict ?n1 - name) 1 (intelligent ?n1 - name) (loser ?n1 - name) (successful ?n1 - name) (loyal ?n1 - name) (like ?n1 - name ?n2 - name) ) (:action graduate :parameters (?n1 - name ?u1 - university ?d1 - degree ?a1 - academicarea ?p1 - place) :precondition (and (no-college-degree ?n1) (resides-in ?n1 ?p1) (studies-in ?n1 ?d1 ?a1 ?u1 ?p1) (not (drug-addict ?n1)) ) :effect (has-degree ?n1 ?d1 ?a1 ?u1 ?p1) ) (:action dropout :parameters (?n1 - name ?u1 - university ?d1 - degree ?a1 - academicarea ?p1 - place) :precondition (and (no-college-degree ?n1) (resides-in ?n1 ?p1) (studies-in ?n1 ?d1 ?a1 ?u1 ?p1) (drug-addict ?n1) ) :effect (and (not (studies-in ?n1 ?d1 ?a1 ?u1 ?p1)) (broke ?n1) ) ) (:action marry :parameters (?n1 - name ?n2 - name) :precondition (or (and (single ?n1) (single ?n2) (like ?n1 ?n2)) (divorced ?n1) (divorced ?n2) ) :effect (and (married ?n1 ?n2) (not (single ?n1)) (not (single ?n2)) (not (blissful ?n1)) (not (blissful ?n2)) ) ) (:action become-unloyal :parameters (?n1 - name) :precondition (alive ?n1) :effect (not (loyal ?n1)) ) (:action divorce :parameters (?n1 - name ?n2 - name) :precondition (and (married ?n1 ?n2) 2 (or (not (loyal ?n1)) (not (loyal ?n2)) ) ) :effect (and (divorced ?n1) (divorced ?n2) ) ) (:action get-job :parameters (?n1 - name ?j1 - job ?a1 - academicarea ?d1 - degree ?u1 - university ?p1 - place ?c1 - car) :precondition (and (has-degree ?n1 ?d1 ?a1 ?u1 ?p1) (intelligent ?n1) ) :effect (and (has-job ?n1 ?j1) (not (broke ?n1)) (rich ?n1) (has-car ?n1 ?c1) ) ) (:action born :parameters (?n1 - name) :precondition (not (alive ?n1)) :effect (and (alive ?n1) (blissful ?n1) ) ) (:action car-accident :parameters (?n1 - name ?c1 - car) :precondition (and (alive ?n1) (has-car ?n1 ?c1) (drug-addict ?n1) ) :effect (not (alive ?n1)) ) (:action is-a-loser :parameters (?n1 - name ?d1 - degree ?p1 - place ?c1 - car ?j1 - job ?a1 - academicarea ?u1 - university) :precondition (alive ?n1) :effect (when (and (broke ?n1) (no-college-degree ?n1) (not (has-job ?n1 ?j1)) (not (has-house ?n1 ?p1)) (not (has-car ?n1 ?c1))) (loser ?n1)) ) (:action is-successful :parameters (?n1 - name ?d1 - degree ?p1 - place ?c1 - car ?j1 - job ?a1 - academicarea ?u1 - university) :precondition (alive ?n1) :effect (when (and (has-job ?n1 ?j1) (has-house ?n1 ?p1) (has-car ?n1 ?c1) 3 (has-degree ?n1 ?d1 ?a1 ?u1 ?p1) (rich ?n1)) (successful ?n1)) ) (:action domain-axioms :parameters (?n1 - name ?p1 - place) :precondition: (alive ?n1) :effect (and (when (rich ?n1) (has-house ?n1 ?p1)) (when (yogi ?n1) (blissful ?n1)) ) ) (:action fired :parameters (?n1 - name ?j1 - job ?p1 - place ?c1 - car) :precondition (has-job ?n1 ?j1) :effect (and (not (has-job ?n1 ?j1)) (broke ?n1) (not (has-car ?n1 ?c1)) (not (has-house ?n1 ?p1)) ) ) ) 3. Issues in Modeling the Domain: Numerical Predicates & Categorization: The domain requires a numerical attribute for some of the predicates, such as money in dollars, age, etc. I initially modeled these predicates as numerical attributes, but I quickly realized that I have to manipulate with numerical comparison methods such as greater than, less than in my actions which increases the complexity of simpler actions. In some cases, the boundaries (the amount of the money, or the age of the person) are not very clear, and it is not appropriate to have hard boundaries on these attributes. So I decided to abstract these predicates into categories, such as rich, poor, young, old, etc. Domain Axioms: The domain requires some axioms that will help the planner to prune the search space and to reach to the goal quickly. These axioms are so obvious that it is very common to ignore these and let the planner decide what is best. Even though there is support for domain axioms in PDDL, I realized that these axioms can be modeled as special actions that do not require any preconditions and have conditional effects. This way, I can group the domain axioms into categories, such as personal related, job related, and general facts. Miscellaneous: After I modeled the domain and started modeling various problems in the domain, I realized that many predicates that I have in the domain are redundant. For example, (alive ?n1) and (dead ?n1) are both redundant and one of them suffices the purpose. I had to convert some of the predicates into actions because there is no way to make such predicates true without creating an action, for e.g., I initially had a predicate (college-dropout ?n1), but then I realized that is actually an action and not a predicate and created an action that gives (no-college-degree ?n1) as an effect. Conditional Effects: 4 I observed that when the planner has opportunity to use actions without conditional effects, it uses them instead of the ones with conditional effects. I had a conditional effect, which given when a person is young or old or child implies that the person is alive (domain axiom). Now when I check if the person is alive, it executes the born action, instead of this action with conditional effect. This is quite interesting to see. Since it is awkward to see the planner executing the born action when the person is young, I removed the conditional effect and included the ‘alive’ predicate in my initial state. Negative Literals in Initial State: I could not use negative literals as facts in the initial state in ADL description, so I had to introduce an action that negates the literals that I wanted to get around it. I am sure there is an easier way to resolve this issue but I could not find any obvious solutions. 4. Planning Problems from the Domain Problem 1 (Successful): ;; ;; PDDL file for Problem 01 in Life Domain ;; created for CSE 574: Planning and Learning Course by Subbarao Kambhampati at ASU ;; ;; Author: Srinivas Vadrevu 09/21/2004 ;; (define (problem P01_Successful) (:domain life) (:objects Virinchi - name IIM - university Ahmedabad - place Finance - academicarea Jaguar - car MBA - degree Accountant - job ) (:init (alive Virinchi) (intelligent Virinchi) (no-college-degree Virinchi) (resides-in Virinchi Ahmedabad) (studies-in Virinchi MBA Finance IIM Ahmedabad) ) (:goal (and ;(has-degree Virinchi MBA Finance IIM Ahmedabad) ;(has-job Virinchi Accountant) ;(has-house Virinchi Ahmedabad) (successful Virinchi) ) ) ) Problem 2 (NotSuccessful): ;; ;; PDDL file for Problem 02 in Life Domain ;; created for CSE 574: Planning and Learning Course by Subbarao Kambhampati at ASU ;; 5 ;; Author: Srinivas Vadrevu 09/21/2004 ;; (define (problem P02_NotSuccessful) (:domain life) (:objects Joe - name IIM - university Ahmedabad - place Finance - academicarea Jaguar - car MBA - degree Accountant - job ) (:init (alive Joe) (drug-addict Joe) (no-college-degree Joe) (resides-in Joe Ahmedabad) (studies-in Joe MBA Finance IIM Ahmedabad) ) (:goal (successful Joe)) ) Problem 3 (Loser): ;; ;; PDDL file for Problem 03 in Life Domain ;; created for CSE 574: Planning and Learning Course by Subbarao Kambhampati at ASU ;; ;; Author: Srinivas Vadrevu 09/21/2004 ;; (define (problem P03_Loser) (:domain life) (:objects Joe - name IIM - university Ahmedabad - place Finance - academicarea Jaguar - car MBA - degree Accountant - job ) (:init (alive Joe) (drug-addict Joe) (no-college-degree Joe) (resides-in Joe Ahmedabad) (studies-in Joe MBA Finance IIM Ahmedabad) ) (:goal (and ;(broke Joe) ;(has-degree Joe MBA Finance IIM Ahmedabad) (loser Joe) ) 6 ) ) Problem 4 (Marriage): ;; ;; PDDL file for Problem 04 in Life Domain ;; created for CSE 574: Planning and Learning Course by Subbarao Kambhampati at ASU ;; ;; Author: Srinivas Vadrevu 09/21/2004 ;; (define (problem P04_Marriage) (:domain life) (:objects Ahalya - name Gautam - name Indra - name Pushpak - car Rishi - degree Veda - academicarea Ashram - university King - job Swarga - place ) (:init (alive Gautam) (alive Indra) (alive Ahalya) (single Indra) (single Ahalya) (single Gautam) (like Gautam Ahalya) ) (:goal (and (divorced Gautam) (married Indra Ahalya) ) ) ) Problem 5 (Reincarnation): ;; ;; PDDL file for Problem 05 in Life Domain ;; created for CSE 574: Planning and Learning Course by Subbarao Kambhampati at ASU ;; ;; Author: Srinivas Vadrevu 09/21/2004 ;; (define (problem P05_Reincarnation) (:domain life) (:objects Ravan - name Mandodari - name Pushpak - car 7 VedaExpert - degree Veda - academicarea Anthapuram - university King - job Lanka - place ) (:init (alive Ravan) (alive Mandodari) (drug-addict Ravan) (no-college-degree Ravan) (married Ravan Mandodari) (resides-in Ravan Lanka) (has-car Ravan Pushpak) (studies-in Ravan VedaExpert Veda Anthapuram Lanka) ) (:goal (blissful Ravan)) ) 5. Results From FF AltAlt planner had some problems parsing my domain and problem files. So I used FF which gave solutions to all the problems in a way I thought it should. It’s PDDL syntax checker was very helpful in correcting my PDDL files. These are the results obtained by running FF planner on my domain and the above 5 problems. Problem 1 (Successful): ! general > ffunix -p ../Domains/Life/ -o LifeDomain.PDDL -f P01_Successful.PDDL ff: parsing domain file domain 'LIFE' defined ... done. ff: parsing problem file problem 'P01_SUCCESSFUL' defined ... done. Cueing down from goal distance: 4 into depth [1] 3 [1] 2 [1] 1 [1] 0 ff: found legal plan as follows step 0: 1: 2: 3: GRADUATE JOE IIM MBA FINANCE AHMEDABAD GET-JOB JOE ACCOUNTANT FINANCE MBA IIM AHMEDABAD JAGUAR DOMAIN-AXIOMS JOE AHMEDABAD IS-SUCCESSFUL JOE MBA AHMEDABAD JAGUAR ACCOUNTANT FINANCE IIM time spent: 0.01 0.01 0.00 0.00 0.00 0.02 seconds seconds seconds seconds seconds seconds instantiating 8 easy, 0 hard action templates reachability analysis, yielding 13 facts and 7 actions creating final representation with 11 relevant facts building connectivity graph searching, evaluating 5 states, to a max depth of 1 total time Problem 2 (NotSuccessful): ! general > ffunix -p ../Domains/Life/ -o LifeDomain.PDDL -f P02_NotSuccessful.PDDL ff: parsing domain file domain 'LIFE' defined 8 ... done. ff: parsing problem file problem 'P02_NOTSUCCESSFUL' defined ... done. Enforced Hill-climbing failed ! switching to Best-first Search now. best first search space empty! problem proven unsolvable. time spent: 0.01 0.01 0.00 0.00 0.00 0.02 seconds seconds seconds seconds seconds seconds instantiating 8 easy, 0 hard action templates reachability analysis, yielding 9 facts and 5 actions creating final representation with 6 relevant facts building connectivity graph searching, evaluating 2 states, to a max depth of 0 total time Problem 3 (Loser): ! general > ffunix -p ../Domains/Life/ -o LifeDomain.PDDL -f P03_Loser.PDDL ff: parsing domain file domain 'LIFE' defined ... done. ff: parsing problem file problem 'P03_LOSER' defined ... done. Cueing down from goal distance: 2 into depth [1] 1 [1] 0 ff: found legal plan as follows step 0: DROPOUT JOE IIM MBA FINANCE AHMEDABAD 1: IS-A-LOSER JOE MBA AHMEDABAD JAGUAR ACCOUNTANT FINANCE IIM time spent: 0.01 0.01 0.00 0.00 0.00 0.02 seconds seconds seconds seconds seconds seconds instantiating 8 easy, 0 hard action templates reachability analysis, yielding 9 facts and 5 actions creating final representation with 6 relevant facts building connectivity graph searching, evaluating 3 states, to a max depth of 1 total time Problem 4 (Marriage): ! general > ffunix -p ../Domains/Life/ -o LifeDomain.PDDL -f P04_Marriage.PDDL ff: parsing domain file domain 'LIFE' defined ... done. ff: parsing problem file problem 'P04_MARRIAGE' defined ... done. Cueing down from goal distance: 3 into depth [1] 2 [1] 1 [1] 0 ff: found legal plan as follows step 0: MARRY GAUTAM AHALYA 1: DIVORCE GAUTAM AHALYA 2: MARRY INDRA AHALYA time spent: 0.02 seconds instantiating 37 easy, 0 hard action templates 0.03 seconds reachability analysis, yielding 21 facts and 31 actions 0.00 seconds creating final representation with 18 relevant facts 9 0.00 seconds building connectivity graph 0.00 seconds searching, evaluating 4 states, to a max depth of 1 0.05 seconds total time Problem 5 (Reincarnation): ! general > ffunix -p ../Domains/Life/ -o LifeDomain.PDDL -f P05_Reincarnation.PDDL ff: parsing domain file domain 'LIFE' defined ... done. ff: parsing problem file problem 'P05_REINCARNATION' defined ... done. Cueing down from goal distance: 2 into depth [1] 1 [1] 0 ff: found legal plan as follows step 0: CAR-ACCIDENT RAVAN PUSHPAK 1: BORN RAVAN time spent: 0.01 0.02 0.00 0.00 0.00 0.03 seconds seconds seconds seconds seconds seconds instantiating 20 easy, 0 hard action templates reachability analysis, yielding 22 facts and 17 actions creating final representation with 16 relevant facts building connectivity graph searching, evaluating 3 states, to a max depth of 1 total time 6. Discussion on Results: It is interesting to see that the results obtained by FF planner matched exactly with my intuition of the problems. Even though the domain is large, the problems were quite simple and it was easy to verify the solutions given by FF. The maximum length of the plan for all the problems is 3. There is one problem (Problem 3) for which FF could not give the solution, where the answer is intuitively false but there is no way for the learner to figure that out. The enforced hillclimbing algorithm could not yield any solutions for this problem. This illustrates and enforces the point that knowledge representation is an important issue in modeling the domains. I personally felt PDDL is not the best language to model planning domains and problems as I was not able to represent many things I wanted in a simpler way. These issues were outlined in Section 3. 7. Comparison of My Domain with Other Domains Most of the domains we considered in the previous project are much complex than my artificial domain. The problems were harder to solve and some of the planners took long time to solve the problems. The average length of the plan was also much higher. Even though the ‘life’ domain is complex enough, the problems were not very hard for the planner to solve and it found solutions within reasonable amount of time. In total, this exercise was helpful in understanding the modeling issues of a domain and gave some insight into the workings of a general planner. 10