You are on page 1of 8

Exercise 5 -------------------------------------------------------------------------------Goal counting heuristics h_gc(s) = |G\s|.

So, In goal state s, h_gc(s) = 0, because at goal state s S G imply |S\G| = 0. So goal counting heuristics is goal-aware. But it not always consistent i.e it som etime violates the condition h(s) h(s' ) + c(a) . So it is not admissible. Here we explaining a counter example. Say we take a tree search space, where the goal is to collect three marbles, red , green and blue. Then the heuristic value at the root node(s) is 3 as there are no marbles. Say, all three marbles are in the very next node on one child node( s') of tree. Clearly h(s') = 0. As c(a) is unit cost h(s) >= h(s' ) + c(a) and c onsistency property is violated. h_gc implemented and attached in the folder sheet02.

Exercise 6 -------------------------------------------------------------------------------Output on logistics for our own heuristic ----------------kaustuv@kaustuv-VirtualBox:~/host/AP/Programs/FD-Stripped/run$ ./plan_logistics logistics/logisticsDom.pddl logistics/logisticsProb02.pddl output.txt 1. Running translator Parsing... Parsing: [0.010s CPU, 0.007s wall-clock] Normalizing task... [0.000s CPU, 0.000s wall-clock] Instantiating... Generating Datalog program... [0.000s CPU, 0.001s wall-clock] Normalizing Datalog program... Normalizing Datalog program: [0.010s CPU, 0.022s wall-clock] Preparing model... [0.000s CPU, 0.002s wall-clock] Generated 16 rules. Computing model... [0.010s CPU, 0.007s wall-clock] 154 relevant atoms 102 auxiliary atoms 256 final queue length 290 total queue pushes Completing instantiation... [0.020s CPU, 0.008s wall-clock] Instantiating: [0.040s CPU, 0.042s wall-clock] Computing fact groups... Finding invariants... 9 initial candidates Finding invariants: [0.000s CPU, 0.006s wall-clock] Checking invariant weight... [0.000s CPU, 0.000s wall-clock] Instantiating groups... [0.000s CPU, 0.001s wall-clock] Collecting mutex groups... [0.000s CPU, 0.000s wall-clock] Choosing groups... 0 uncovered facts Choosing groups: [0.000s CPU, 0.000s wall-clock] Building translation key... [0.000s CPU, 0.000s wall-clock] Computing fact groups: [0.000s CPU, 0.010s wall-clock] Building STRIPS to SAS dictionary... [0.000s CPU, 0.000s wall-clock] Building dictionary for full mutex groups... [0.000s CPU, 0.000s wall-clock] Building mutex information... Building mutex information: [0.000s CPU, 0.000s wall-clock] Translating task...

Processing axioms... Simplifying axioms... [0.000s CPU, 0.000s wall-clock] Processing axioms: [0.000s CPU, 0.001s wall-clock] Translating task: [0.010s CPU, 0.007s wall-clock] 0 implied effects removed 0 effect conditions simplified 0 implied preconditions added Detecting unreachable propositions... 0 operators removed 7 propositions removed Detecting unreachable propositions: [0.010s CPU, 0.002s wall-clock] Translator variables: 7 Translator derived variables: 0 Translator facts: 41 Translator mutex groups: 7 Translator total mutex groups size: 41 Translator operators: 68 Translator task size: 359 Translator peak memory: 40824 KB Writing output... [0.000s CPU, 0.010s wall-clock] Done! [0.070s CPU, 0.082s wall-clock] 2. Running preprocessor Building causal graph... The causal graph is acyclic. 7 variables of 7 necessary 0 of 7 mutex groups necessary. 68 of 68 operators necessary. 0 of 0 axiom rules necessary. Building domain transition graphs... solveable in poly time 0 Building successor generator... Preprocessor facts: 41 Preprocessor derived variables: 0 Preprocessor task size: 318 Writing output... done 3. Running search Simplifying transitions... done! Truck Index found at: 0 Conducting A* search, (real) bound = 2147483647 Initializing logistics-domain specific heuristic... f = 12 [1 evaluated, 0 expanded, t=0.02s] Best heuristic value: 12 [g=0, 1 evaluated, 0 expanded, t=0.02s] Best heuristic value: 10 [g=1, 3 evaluated, 1 expanded, t=0.02s] f = 13 [13 evaluated, 5 expanded, t=0.02s] Best heuristic value: 9 [g=4, 15 evaluated, 6 expanded, t=0.02s] Best heuristic value: 8 [g=5, 17 evaluated, 7 expanded, t=0.02s] f = 14 [47 evaluated, 20 expanded, t=0.02s] Best heuristic value: 6 [g=7, 73 evaluated, 32 expanded, t=0.02s] f = 15 [102 evaluated, 46 expanded, t=0.02s] f = 16 [231 evaluated, 106 expanded, t=0.03s] Best heuristic value: 5 [g=11, 233 evaluated, 108 expanded, t=0.03s] f = 17 [599 evaluated, 276 expanded, t=0.03s] Best heuristic value: 4 [g=12, 712 evaluated, 333 expanded, t=0.03s] f = 18 [1486 evaluated, 697 expanded, t=0.03s] Best heuristic value: 3 [g=15, 1513 evaluated, 709 expanded, t=0.03s] f = 19 [3322 evaluated, 1625 expanded, t=0.04s]

Best heuristic value: 2 [g=17, 3325 evaluated, 1627 expanded, t=0.04s] f = 20 [6713 evaluated, 3412 expanded, t=0.05s] Best heuristic value: 1 [g=19, 6715 evaluated, 3414 expanded, t=0.05s] f = 21 [12569 evaluated, 6756 expanded, t=0.07s] Best heuristic value: 0 [g=21, 12577 evaluated, 6760 expanded, t=0.07s] Solution found! Actual search time: 0.05s [t=0.07s] load truck01 sydney package03 (1) drive truck01 sydney brisbane (1) load truck01 brisbane package01 (1) load truck01 brisbane package04 (1) drive truck01 brisbane sydney (1) drive truck01 sydney adelaide (1) unload truck01 adelaide package01 (1) drive truck01 adelaide perth (1) unload truck01 perth package04 (1) load truck01 perth package05 (1) drive truck01 perth adelaide (1) unload truck01 adelaide package05 (1) load truck01 adelaide package06 (1) drive truck01 adelaide darwin (1) unload truck01 darwin package03 (1) unload truck01 darwin package06 (1) load truck01 darwin package02 (1) drive truck01 darwin adelaide (1) drive truck01 adelaide sydney (1) drive truck01 sydney brisbane (1) unload truck01 brisbane package02 (1) Plan length: 21 step(s). Plan cost: 21 Initial state h value: 12. Expanded 6761 state(s). Reopened 0 state(s). Evaluated 12577 state(s). Generated 26686 state(s). Dead ends: 0 state(s). Expanded until last jump: 6756 state(s). Reopened until last jump: 0 state(s). Evaluated until last jump: 12569 state(s). Generated until last jump: 26672 state(s). Search space hash size: 12577 Search space hash bucket count: 24593 Search time: 0.05s Total time: 0.07s Peak memory: 3888 KB output.txt -------------(load truck01 sydney package03) (drive truck01 sydney brisbane) (load truck01 brisbane package01) (load truck01 brisbane package04) (drive truck01 brisbane sydney) (drive truck01 sydney adelaide) (unload truck01 adelaide package01) (drive truck01 adelaide perth) (unload truck01 perth package04) (load truck01 perth package05) (drive truck01 perth adelaide) (unload truck01 adelaide package05)

(load truck01 adelaide package06) (drive truck01 adelaide darwin) (unload truck01 darwin package03) (unload truck01 darwin package06) (load truck01 darwin package02) (drive truck01 darwin adelaide) (drive truck01 adelaide sydney) (drive truck01 sydney brisbane) (unload truck01 brisbane package02) Output on logistics for Goal Counting Heuristic ----------------kaustuv@kaustuv-VirtualBox:~/host/AP/Programs/FD-Stripped/run$ ./plan_gc logisti cs/logisticsDom.pddl logistics/logisticsProb02.pddl output.txt1. Running transla tor Parsing... Parsing: [0.010s CPU, 0.006s wall-clock] Normalizing task... [0.000s CPU, 0.000s wall-clock] Instantiating... Generating Datalog program... [0.000s CPU, 0.000s wall-clock] Normalizing Datalog program... Normalizing Datalog program: [0.010s CPU, 0.022s wall-clock] Preparing model... [0.000s CPU, 0.001s wall-clock] Generated 16 rules. Computing model... [0.000s CPU, 0.005s wall-clock] 154 relevant atoms 102 auxiliary atoms 256 final queue length 290 total queue pushes Completing instantiation... [0.010s CPU, 0.007s wall-clock] Instantiating: [0.020s CPU, 0.037s wall-clock] Computing fact groups... Finding invariants... 9 initial candidates Finding invariants: [0.010s CPU, 0.003s wall-clock] Checking invariant weight... [0.000s CPU, 0.000s wall-clock] Instantiating groups... [0.000s CPU, 0.001s wall-clock] Collecting mutex groups... [0.000s CPU, 0.000s wall-clock] Choosing groups... 0 uncovered facts Choosing groups: [0.000s CPU, 0.000s wall-clock] Building translation key... [0.000s CPU, 0.000s wall-clock] Computing fact groups: [0.010s CPU, 0.006s wall-clock] Building STRIPS to SAS dictionary... [0.000s CPU, 0.000s wall-clock] Building dictionary for full mutex groups... [0.000s CPU, 0.000s wall-clock] Building mutex information... Building mutex information: [0.000s CPU, 0.000s wall-clock] Translating task... Processing axioms... Simplifying axioms... [0.000s CPU, 0.000s wall-clock] Processing axioms: [0.000s CPU, 0.001s wall-clock] Translating task: [0.010s CPU, 0.005s wall-clock] 0 implied effects removed 0 effect conditions simplified 0 implied preconditions added Detecting unreachable propositions... 0 operators removed

7 propositions removed Detecting unreachable propositions: [0.000s CPU, 0.002s wall-clock] Translator variables: 7 Translator derived variables: 0 Translator facts: 41 Translator mutex groups: 7 Translator total mutex groups size: 41 Translator operators: 68 Translator task size: 359 Translator peak memory: 40824 KB Writing output... [0.010s CPU, 0.005s wall-clock] Done! [0.060s CPU, 0.065s wall-clock] 2. Running preprocessor Building causal graph... The causal graph is acyclic. 7 variables of 7 necessary 0 of 7 mutex groups necessary. 68 of 68 operators necessary. 0 of 0 axiom rules necessary. Building domain transition graphs... solveable in poly time 0 Building successor generator... Preprocessor facts: 41 Preprocessor derived variables: 0 Preprocessor task size: 318 Writing output... done 3. Running search Simplifying transitions... done! Conducting A* search, (real) bound = 2147483647 Initializing goal-counting heuristic... f = 6 [1 evaluated, 0 expanded, t=0.01s] Best heuristic value: 6 [g=0, 1 evaluated, 0 expanded, t=0.01s] f = 7 [4 evaluated, 1 expanded, t=0.01s] f = 8 [11 evaluated, 4 expanded, t=0.01s] f = 9 [26 evaluated, 11 expanded, t=0.01s] Best heuristic value: 5 [g=4, 35 evaluated, 14 expanded, t=0.01s] f = 10 [60 evaluated, 28 expanded, t=0.01s] Best heuristic value: 4 [g=6, 78 evaluated, 38 expanded, t=0.01s] f = 11 [138 evaluated, 65 expanded, t=0.01s] f = 12 [305 evaluated, 143 expanded, t=0.01s] f = 13 [692 evaluated, 325 expanded, t=0.01s] Best heuristic value: 3 [g=10, 840 evaluated, 404 expanded, t=0.02s] f = 14 [1509 evaluated, 740 expanded, t=0.02s] f = 15 [3060 evaluated, 1583 expanded, t=0.02s] f = 16 [5894 evaluated, 3179 expanded, t=0.03s] Best heuristic value: 2 [g=14, 5920 evaluated, 3193 expanded, t=0.03s] f = 17 [10935 evaluated, 6115 expanded, t=0.05s] Best heuristic value: 1 [g=16, 11052 evaluated, 6190 expanded, t=0.05s] f = 18 [19334 evaluated, 11280 expanded, t=0.07s] f = 19 [32186 evaluated, 19776 expanded, t=0.12s] f = 20 [50387 evaluated, 32721 expanded, t=0.19s] f = 21 [74593 evaluated, 51089 expanded, t=0.26s] Best heuristic value: 0 [g=21, 74597 evaluated, 51095 expanded, t=0.26s] Solution found! Actual search time: 0.25s [t=0.26s] load truck01 sydney package03 (1)

drive truck01 sydney brisbane (1) load truck01 brisbane package01 (1) load truck01 brisbane package04 (1) drive truck01 brisbane sydney (1) drive truck01 sydney adelaide (1) unload truck01 adelaide package01 (1) drive truck01 adelaide perth (1) unload truck01 perth package04 (1) load truck01 perth package05 (1) drive truck01 perth adelaide (1) unload truck01 adelaide package05 (1) load truck01 adelaide package06 (1) drive truck01 adelaide darwin (1) unload truck01 darwin package03 (1) unload truck01 darwin package06 (1) load truck01 darwin package02 (1) drive truck01 darwin adelaide (1) drive truck01 adelaide sydney (1) drive truck01 sydney brisbane (1) unload truck01 brisbane package02 (1) Plan length: 21 step(s). Plan cost: 21 Initial state h value: 6. Expanded 51096 state(s). Reopened 0 state(s). Evaluated 74597 state(s). Generated 205023 state(s). Dead ends: 0 state(s). Expanded until last jump: 51089 state(s). Reopened until last jump: 0 state(s). Evaluated until last jump: 74593 state(s). Generated until last jump: 205008 state(s). Search space hash size: 74597 Search space hash bucket count: 98317 Search time: 0.25s Total time: 0.26s Peak memory: 11272 KB output.txt -------------(load truck01 sydney package03) (drive truck01 sydney brisbane) (load truck01 brisbane package01) (load truck01 brisbane package04) (drive truck01 brisbane sydney) (drive truck01 sydney adelaide) (unload truck01 adelaide package01) (drive truck01 adelaide perth) (unload truck01 perth package04) (load truck01 perth package05) (drive truck01 perth adelaide) (unload truck01 adelaide package05) (load truck01 adelaide package06) (drive truck01 adelaide darwin) (unload truck01 darwin package03) (unload truck01 darwin package06) (load truck01 darwin package02) (drive truck01 darwin adelaide) (drive truck01 adelaide sydney)

(drive truck01 sydney brisbane) (unload truck01 brisbane package02) Comparison -----------------Plan length Runtime -----------------Goal Counting Heuristic 0.26s Our heuristic 0.07s 21 21 51096 6761 -------------Expanded Nodes

Clearly out heuristic performs better.

Exercise 7 -------------------------------------------------------------------------------The heuristic we developed first finds the truck index from the g_variable_name and the g_goal. So, it assumes there exists one truck and it is not present in t he goal state. This drawback can easily be overcome if the index of the truck ca n be provided from the rest of the portion of the code or by string manipulation on g_fact_names. It considers the packages that are not in the goal position(just like goal count ing heuristic) and additionally also the position of the truck. For every packag e that is not in the goal state and if for that package the truck is also not in the same position, then 1 is added for that package, as, atleast 1 move will be needed to take the truck to the position where the package is. Formal description of our heuristics: Let = (P; A; c; I; G) be a STRIPS planning task. The logistic heuristic for ined as follows: is def

h_logistic(s) := |G \ S| + x {G \ S} {1 | truck S & truck.position x.position}. Here we add some more cost with goal counting heuristics for each facts that not satisfied with goal state. It considers the packages that are not in the goal p osition(just like goal counting heuristic) and additionally for every package th at is not in the goal state and if for that package the truck position is differ ent from package position, then unit cost is added for that package. Because atl east 1 move will be needed to take the truck to the position where the package i s. We claim that our heuristics is admissible for any combination of initial state and goal. Following condition may happen and we describe how our heuristic value never ove restimated.

1. package is into the truck at goal position: In this case we need action unloading of package and according to planning truck cannot unload more than one package simultaneously. So heuristics value 1 count for each of this kind of package does not overestimated. 2. Package is in other position ,truck is in same position and package is not lo aded to truck: In this case, At least one load action needed to delivery the package to destina tion and atleast one move is needed as package is not in destination and also un load each of these package . So, our heuristics value is 1 count for each of thi s kind of package does not overestimated. 3. Package is in other position ,truck is in same position and package is loaded to truck: Like case 2 atleast one move is needed as package is not in destination and als o unloading action for each package. So heuristics value 1 count for each of thi s kind of package does not overestimated. 4. Package is in other position from destination and truck is in other position from package position. To reach the goal state loading and unloading action for each of such kind of package need additionally atleast one action for moving of truck to the current package position and then at least one action for package p osition to goal position needed. So heuristics value 2 count for each of this ki nd of package does not overestimated.

You might also like