# hub.domain.plado.llg_encoder
Domain specification
# EdgeLabel
An enumeration.
# EFFECT EdgeLabel
# GAMMA EdgeLabel
# NU EdgeLabel
# PRE EdgeLabel
# NodeLabel
An enumeration.
# ACTION NodeLabel
# ASSIGN NodeLabel
# DIVIDE NodeLabel
# EQUAL NodeLabel
# FLUENT NodeLabel
# GOAL NodeLabel
# GREATER NodeLabel
# LESS NodeLabel
# MINUS NodeLabel
# MULTIPLY NodeLabel
# NEGATED NodeLabel
# NUMERIC NodeLabel
# OBJECT NodeLabel
# PLUS NodeLabel
# PREDICATE NodeLabel
# STATE NodeLabel
# STATIC NodeLabel
# IndexFunctionType
An enumeration.
# ONEHOT IndexFunctionType
# RANDSPHERE IndexFunctionType
# LLGEncoder
Lifted Learning Graph encoder for plado state.
This encodes the current state of a PDDL domain/problem pair into a LLG similar to what is presented in
Chen, D. Z., Thiébaux, S., & Trevizan, F. (2024). Learning Domain-Independent Heuristics for Grounded and Lifted Planning. Proceedings of the AAAI Conference on Artificial Intelligence, 38(18), 20078-20086. https://doi.org/10.1609/aaai.v38i18.29986
# Constructor LLGEncoder
LLGEncoder(
task: Task,
index_function_type: IndexFunctionType = IndexFunctionType.ONEHOT,
index_function_default_dim: int = 2,
cost_functions: Optional[set[int]] = None
)
Initialize self. See help(type(self)) for accurate signature.
# decode LLGEncoder
decode(
self,
graph: gym.spaces.GraphInstance
) -> State
Decode an LLG into a plado state.
Here we use the fact that the graph from this LLGEncoder.encode(). So
- we know that nodes are well ordered:
- predicate node before atom arg nodes
- first atom arg before second atom arg
- we now already the correspondance between nodes and predicates/objects
If these hypotheses are not valid, rather use decode_llg()
which makes less hypotheses,
but could be less efficient.
# encode LLGEncoder
encode(
self,
state: State
) -> gym.spaces.GraphInstance
Encode plado state into an LLG.
# index_function LLGEncoder
index_function(
self,
x: Union[int, npt.NDArray[np.int_]]
) -> npt.NDArray[Union[np.int_, np.float_]]
Maps an index into sphere S^T.
# index_function_inverse LLGEncoder
index_function_inverse(
self,
y: npt.NDArray[Union[np.int_, np.float_]]
) -> Union[int, npt.NDArray[np.int_]]
Inverse of index function.
# plot LLGEncoder
plot(
self,
graph: gym.spaces.GraphInstance,
subgraph: Optional[Any] = None,
subgraphs: Optional[Iterable[Any]] = None,
ax: Optional[Any] = None
) -> None
Plot the encoding graph (or a subgraph of it)
Args: graph: encoding llg subgraph: subgraph id (action or predicate) ax: matplotlib axes in which plot the graph
Returns:
# decode_llg
decode_llg(
graph: gym.spaces.GraphInstance,
cost_functions: Optional[set[int]] = None
) -> State
Decode a llg graph into a plado state without information about the plado.Task.
This may be less efficient than LLGEncoder.decode() but is self-sufficient.