concepts.pdsketch.strips.strips_grounding.GStripsTranslatorOptimistic#

class GStripsTranslatorOptimistic[source]#

Bases: GStripsTranslatorBase

Methods

compile_derived_predicate(dp, state[, ...])

compile_expr(expr, state)

compile_operator(op, state[, is_relaxed])

compile_regression_rule(op, state)

compile_state(state[, forward_derived])

compile_task(state, goal_expr[, actions, ...])

Compile a grounded STRIPS task.

compose_bool_expression(expr[, negated])

compose_grounded_assignment(assignments[, ...])

compose_grounded_predicate(predicate_app[, ...])

define_grounded_predicate(name[, modifier])

Allocate a new identifier for the predicate (with modifier).

get_grounded_predicate_indentifier(name[, ...])

recompile_relaxed_task(task[, ...])

Recompile a task to a delete-relaxed task.

recompile_task_new_state(task, new_state[, ...])

Compile a new GStripsTask from a new state.

relevance_analysis(task[, ...])

Attributes

domain

The domain.

executor

The executor for the domain.

predicate2index

The mapping from predicate names to index.

__init__(executor, use_string_name=True, prob_goal_threshold=0.5, use_derived_predicates=False, use_regression_rules=True)#
Parameters:
__new__(**kwargs)#
compile_derived_predicate(dp, state, is_relaxed=False)[source]#
Parameters:
Return type:

List[GStripsDerivedPredicate]

compile_expr(expr, state)[source]#
Parameters:
Return type:

Tuple[GSBoolOutputExpression, Set[str]]

compile_operator(op, state, is_relaxed=False)[source]#
Parameters:
Return type:

GStripsOperator

compile_regression_rule(op, state)#
Parameters:
Return type:

GStripsRegressionRule

compile_state(state, forward_derived=False)[source]#
Parameters:
Return type:

SState

compile_task(state, goal_expr, actions=None, regression_rules=None, is_relaxed=False, forward_relevance_analysis=True, backward_relevance_analysis=True, verbose=False)#

Compile a grounded STRIPS task.

Parameters:
  • state (State) – the initial state.

  • goal_expr (str | Expression) – the goal expression.

  • actions (Sequence[OperatorApplier] | None) – the list of actions. If not specified, all actions in the domain will be used.

  • regression_rules (Sequence[RegressionRuleApplier] | None) – the list of regression rules. If not specified, all regression rules in the domain will be used.

  • is_relaxed (bool) – whether the task is a delete-relaxed task.

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

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

  • verbose (bool) – whether to print verbose information.

Returns:

the compiled task.

Return type:

GStripsProblem

compose_bool_expression(expr, negated=False)[source]#
Parameters:
Return type:

Tuple[GSBoolOutputExpression | GSOptimisticStaticObjectType, Set[str]]

compose_grounded_assignment(assignments, is_relaxed=False)[source]#
Parameters:
Return type:

Tuple[List[GSVariableAssignmentExpression], Set[str]]

compose_grounded_predicate(predicate_app, negated=False, optimistic=None, allow_set=False, return_argument_indices=False)[source]#
Parameters:
Return type:

str | Tuple[str, List[int]]

define_grounded_predicate(name, modifier=None)#

Allocate a new identifier for the predicate (with modifier).

Parameters:
  • name (str) – the name of the predicate.

  • modifier (str | None) – an optional modifier (e.g., not)

Returns:

the index of the predicate.

Return type:

int

get_grounded_predicate_indentifier(name, modifier=None)#
Parameters:
  • name (str)

  • modifier (str | None)

recompile_relaxed_task(task, forward_relevance_analysis=True, backward_relevance_analysis=True)#

Recompile a task to a delete-relaxed task.

Parameters:
  • task (GStripsProblem) – the task to be recompiled.

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

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

Returns:

the recompiled task.

Return type:

GStripsProblem

recompile_task_new_state(task, new_state, forward_relevance_analysis=True, backward_relevance_analysis=True, forward_derived=False)#

Compile a new GStripsTask from a new state.

Parameters:
  • task (GStripsProblem) – the original task.

  • new_state (State | SState | Set[str]) – the new state.

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

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

  • forward_derived (bool) – whether to forward derived predicates. Defaults to False.

Returns:

the new task.

Return type:

GStripsProblem

relevance_analysis(task, relaxed_relevance=False, forward=True, backward=True)[source]#
Parameters:
Return type:

GStripsProblem

property domain: Domain#

The domain.

property executor: PDSketchExecutor#

The executor for the domain.

property predicate2index: Dict[Tuple[str, str], int]#

The mapping from predicate names to index.