https://github.com/elucidation/hanoi-pddl-generator
N-disk Hanoi tower PDDL generator
https://github.com/elucidation/hanoi-pddl-generator
Last synced: about 1 year ago
JSON representation
N-disk Hanoi tower PDDL generator
- Host: GitHub
- URL: https://github.com/elucidation/hanoi-pddl-generator
- Owner: Elucidation
- Created: 2011-12-11T10:41:38.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-01-03T08:27:51.000Z (over 14 years ago)
- Last Synced: 2025-03-22T02:02:42.047Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 102 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
N-disk Hanoi PDDL generator
---
[STRIPS](http://en.wikipedia.org/wiki/STRIPS) is an automated planner that solves problems defined by a PDDL syntax.
This python script generates PDDL problems for N-disk 3-peg [Tower of Hanoi](http://en.wikipedia.org/wiki/Tower_of_hanoi) problems
Usage:
python towerHanoiMaker.py N
where `N` is the number of disks
For example, for N = 3
python towerHanoiMaker.py 3 > hanoi3.txt
Which produces the following file
```
(define (problem hanoi-3)
(:domain hanoi-domain)
(:objects p1 p2 p3 d1 d2 d3 )
(:init
(smaller d1 p1)(smaller d1 p2)(smaller d1 p3)
(smaller d2 p1)(smaller d2 p2)(smaller d2 p3)
(smaller d3 p1)(smaller d3 p2)(smaller d3 p3)
(smaller d1 d2)(smaller d1 d3)
(smaller d2 d3)
(clear p1)(clear p2)(clear d1)
(disk d1)(disk d2)(disk d3)
(on d1 d2)(on d2 d3)(on d3 p3)
)
(:goal
(and (on d1 d2)(on d2 d3)(on d3 p1) )
)
)
```
That can be fed into a STRIPS planner and solved for, producing a set of move instructions. For example, for a `N = 6` problem, the solution produced
```
ff: parsing domain file
domain 'HANOI-DOMAIN' defined
... done.
ff: parsing problem file
problem 'HANOI-6' defined
... done.
Cueing down from goal distance: 6 into depth [1]
5 [1][2][3][4]
4 [1]
Enforced Hill-climbing failed !
switching to Best-first Search now.
advancing to distance : 6
5
4
3
2
1
0
ff: found legal plan as follows
step 0: MOVE-DISK D1 D2 P2
1: MOVE-DISK D2 D3 P1
2: MOVE-DISK D1 P2 D2
3: MOVE-DISK D3 D4 P2
4: MOVE-DISK D1 D2 D4
5: MOVE-DISK D2 P1 D3
6: MOVE-DISK D1 D4 D2
7: MOVE-DISK D4 D5 P1
8: MOVE-DISK D1 D2 D4
9: MOVE-DISK D2 D3 D5
10: MOVE-DISK D1 D4 D2
11: MOVE-DISK D3 P2 D4
12: MOVE-DISK D1 D2 P2
13: MOVE-DISK D2 D5 D3
14: MOVE-DISK D1 P2 D2
15: MOVE-DISK D5 D6 P2
16: MOVE-DISK D1 D2 D6
17: MOVE-DISK D2 D3 D5
18: MOVE-DISK D1 D6 D2
19: MOVE-DISK D3 D4 D6
20: MOVE-DISK D1 D2 D4
21: MOVE-DISK D2 D5 D3
22: MOVE-DISK D1 D4 D2
23: MOVE-DISK D4 P1 D5
24: MOVE-DISK D1 D2 D4
25: MOVE-DISK D2 D3 P1
26: MOVE-DISK D1 D4 D2
27: MOVE-DISK D3 D6 D4
28: MOVE-DISK D1 D2 D6
29: MOVE-DISK D2 P1 D3
30: MOVE-DISK D1 D6 D2
31: MOVE-DISK D6 P3 P1
32: MOVE-DISK D1 D2 D6
33: MOVE-DISK D2 D3 P3
34: MOVE-DISK D1 D6 D2
35: MOVE-DISK D3 D4 D6
36: MOVE-DISK D1 D2 D4
37: MOVE-DISK D2 P3 D3
38: MOVE-DISK D1 D4 D2
39: MOVE-DISK D4 D5 P3
40: MOVE-DISK D1 D2 D4
41: MOVE-DISK D2 D3 D5
42: MOVE-DISK D1 D4 D2
43: MOVE-DISK D3 D6 D4
44: MOVE-DISK D1 D2 D6
45: MOVE-DISK D2 D5 D3
46: MOVE-DISK D1 D6 D2
47: MOVE-DISK D5 P2 D6
48: MOVE-DISK D1 D2 P2
49: MOVE-DISK D2 D3 D5
50: MOVE-DISK D1 P2 D2
51: MOVE-DISK D3 D4 P2
52: MOVE-DISK D1 D2 D4
53: MOVE-DISK D2 D5 D3
54: MOVE-DISK D1 D4 D2
55: MOVE-DISK D4 P3 D5
56: MOVE-DISK D1 D2 D4
57: MOVE-DISK D2 D3 P3
58: MOVE-DISK D1 D4 D2
59: MOVE-DISK D3 P2 D4
60: MOVE-DISK D1 D2 P2
61: MOVE-DISK D2 P3 D3
62: MOVE-DISK D1 P2 D2
time spent: 0.00 seconds instantiating 231 easy, 0 hard action templates
0.00 seconds reachability analysis, yielding 42 facts and 166 actions
0.00 seconds creating final representation with 41 relevant facts
0.00 seconds building connectivity graph
0.00 seconds searching, evaluating 334 states, to a max depth of 4
0.00 seconds total time
```