Hype is able to compile a domain to a DOT output that can be transformed into a graph image by Graphviz. The output is based on the interaction between the methods and how they decompose, not just the operators. Even simple HTN domains can generate complex graphs. Here the basic JSHOP domain description is used as an example of how to obtain and read a graph.
(defdomain basic (
(:operator (!pickup ?a) ((not (have ?a))) () ((have ?a)))
(:operator (!drop ?a) ((have ?a)) ((have ?a)) ())
(:method (swap ?x ?y)
((have ?x) (not (have ?y)))
((!drop ?x) (!pickup ?y))
((have ?y) (not (have ?x)))
((!drop ?y) (!pickup ?x)))))
Which is converted to a DOT description using the following command.
cd HyperTensioN
ruby Hype.rb examples/basic/basic.jshop examples/basic/pb1.jshop dot
Complex DOT descriptions are not intended to be generated and read by humans, as one can see:
// Generated by Hype
digraph "basic" {
nodesep=1
ranksep=1
// Operators
node [shape=record]
"pickup" [
label="{{\N|?a}|{not (have ?a)\l|(have ?a)\l}}"
]
"drop" [
label="{{\N|?a}|{(have ?a)\l|not (have ?a)\l}}"
]
// Methods
node [shape=Mrecord]
"swap" [
style=bold
label="{{\N|?x ?y}|{<0>swap_case_0|<1>swap_case_1}}"
]
"swap_case_0" [
label="{{\N|}|(have ?x)\lnot (have ?y)\l|<0>drop ?x|<1>pickup ?y}"
]
"swap":0 -> "swap_case_0" [style=dotted]
"swap_case_0":0 -> "drop"
"swap_case_0":1 -> "pickup"
"swap_case_1" [
label="{{\N|}|(have ?y)\lnot (have ?x)\l|<0>drop ?y|<1>pickup ?x}"
]
"swap":1 -> "swap_case_1" [style=dotted]
"swap_case_1":0 -> "drop"
"swap_case_1":1 -> "pickup"
}
Which results in the following image using the dot layout, with methods, cases and operators. The bold rounded rectangle is a method, with name, parameters and two decompositions. Each decomposition is a case to be evaluated by the HTN planner, a rounded rectangle containing a name (optional in JSHOP, generated when not given), free variables to be unified at run-time, preconditions and a sequence of operators. The operators are the rectangles containing name, parameters, preconditions and effects.