concepts.dm.pdsketch.strips.strips_heuristics.StripsRPGHeuristic#

class StripsRPGHeuristic[source]#

Bases: StripsHeuristic

RPG heuristic (relaxed planning graph).

Methods

compute(state)

Compute the heuristic value of the given state.

compute_rpg_forward_diff(state[, relaxed_task])

Compute the relaxed planning graph using forward differentiation.

from_type(type_identifier, task[, translator])

Create a heuristic from the given type identifier.

Attributes

goal_func

The (compiled version) of goal function of the task.

relaxed

The relaxed version of the task.

task

The grounded STRIPS planning task.

translator

The translator used to translate the task representation into the GS* (grounded STRIPS) representation.

__init__(task, translator=None, forward_relevance_analysis=True, backward_relevance_analysis=True)[source]#

Initialize an RPG heuristic.

Parameters:
  • task (GStripsProblem) – the grounded STRIPS planning task.

  • translator (GStripsTranslatorBase | None) – the translator used to translate the planning task to the GS* (grounded STRIPS) representation.

  • forward_relevance_analysis (bool) – whether to perform forward relevance analysis.

  • backward_relevance_analysis (bool) – whether to perform backward relevance analysis.

__new__(**kwargs)#
compute(state)[source]#

Compute the heuristic value of the given state.

Parameters:

state (SState) – the state to compute the heuristic value.

Returns:

the heuristic value of the given state.

Return type:

int

compute_rpg_forward_diff(state, relaxed_task=None)[source]#

Compute the relaxed planning graph using forward differentiation.

Parameters:
  • state (SState) – the state to compute the relaxed planning graph.

  • relaxed_task (GStripsProblem | None) – the relaxed version of the task. If not provided, the task will be relaxed using the translator.

Returns:

  • a list of sets of states, where each set contains all the states that can be reached from the initial state in the given number of steps.

  • a dictionary that maps propositions to their level.

  • a list of lists of tuples, where each tuple contains the following elements:
    • the index of the action in the relaxed task operator list.

    • the index of the effect in the operator.

    • the propositions that contributes to the effect (computed using Forward Diff).

  • a list of lists of tuples, where each tuple contains the following elements:
    • the index of the action that achieves the proposition.

    • the level of the proposition.

    • the set of propositions that are achieved by the action.

  • the result of forward differentiation of the goal function.

Return type:

the relaxed planning graph, which is represented as a tuple of the following elements

classmethod from_type(type_identifier, task, translator=None, **kwargs)#

Create a heuristic from the given type identifier.

Parameters:
  • type_identifier (str) – the type identifier of the heuristic.

  • task (GStripsProblem) – the grounded STRIPS planning task.

  • translator (GStripsTranslatorBase | None) – the translator used to translate the planning task to the GS* (grounded STRIPS) representation.

  • **kwargs – additional arguments to pass to the constructor.

Returns:

the created heuristic.

Return type:

StripsHeuristic

property goal_func: Callable[[SState], bool | GSBoolForwardDiffReturn]#

The (compiled version) of goal function of the task.

property relaxed: GStripsProblem#

The relaxed version of the task.

property task: GStripsProblem#

The grounded STRIPS planning task.

property translator: GStripsTranslatorBase | None#

The translator used to translate the task representation into the GS* (grounded STRIPS) representation.