concepts.dm.crow.planners.regression_planning_impl.crow_regression_planner_astar_v1.CrowRegressionPlannerAStarv1#

class CrowRegressionPlannerAStarv1[source]#

Bases: CrowRegressionPlanner

Methods

bfs(planning_state)

bfs_add_queue(planning_state)

bfs_expand(planning_state)

The BFS algorithm is simulating a hierarchical planning algorithm.

evaluate(expression, state[, csp, ...])

Evaluate an expression and return the result.

main()

main_entry(program[, minimize])

set_results(results)

Attributes

domain

results

search_stat

queue

executor

The executor.

state

The initial state.

goal_expr

The goal expression.

simulation_interface

The simulation interface.

is_goal_ordered

Whether the goal is ordered.

is_goal_serializable

Whether the goal is serializable.

is_goal_refinement_compressible

Whether the refinement for each component of the goal is compressible.

enable_csp

Whether to enable the CSP solver.

max_csp_trials

The maximum number of CSP trials (for solving a single CSP).

max_global_csp_trials

The maximum number of global CSP trials.

max_csp_branching_factor

The maximum CSP branching factor.

use_generator_manager

Whether to use the generator manager.

store_generator_manager_history

Whether to store the generator manager history.

include_effect_appliers

Whether to include the effect appliers in the search result.

include_dependency_trace

Whether to include the dependency graph in the search result.

verbose

Whether to output verbose information.

__init__(executor, state, goal_expr, *, simulation_interface=None, is_goal_ordered=True, is_goal_serializable=True, is_goal_refinement_compressible=True, enable_csp=True, max_csp_trials=1, max_global_csp_trials=100, max_csp_branching_factor=5, use_generator_manager=True, store_generator_manager_history=False, include_effect_appliers=False, include_dependency_trace=False, verbose=False, **kwargs)#

Initialize the planner.

Parameters:
  • executor (CrowExecutor) – the executor.

  • state (CrowState) – the initial state.

  • goal_expr (str | ValueOutputExpression | None) – the goal expression.

  • simulation_interface (CrowSimulationControllerInterface | None) – the simulation interface.

  • enable_reordering – whether to enable reordering.

  • is_goal_ordered (bool) – whether the goal is ordered.

  • is_goal_serializable (bool) – whether the goal is serializable.

  • is_goal_refinement_compressible (bool) – whether the goal refinement is compressible.

  • enable_csp (bool) – whether to enable the CSP solver.

  • max_csp_trials (int) – the maximum number of CSP trials.

  • max_global_csp_trials (int) – the maximum number of global CSP trials.

  • max_csp_branching_factor (int) – the maximum CSP branching factor.

  • use_generator_manager (bool) – whether to use the generator manager.

  • store_generator_manager_history (bool) – whether to store the generator manager history.

  • include_effect_appliers (bool) – whether to include the effect appliers in the search result. The effect appliers are of type CrowEffectApplier.

  • include_dependency_trace (bool) – whether to include the dependency graph in the search result.

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

__new__(**kwargs)#
bfs(planning_state)[source]#
Parameters:

planning_state (_AStarNode)

Return type:

Sequence[CrowPlanningResult]

bfs_add_queue(planning_state)[source]#
Parameters:

planning_state (_AStarNode)

bfs_expand(planning_state)[source]#

The BFS algorithm is simulating a hierarchical planning algorithm. The current state can be encoded as:

left_actions = (a1, a2, a3, ...)
middle_program = CrowActionOrderingSuite(...)
right_statements = [RegressionStatement2(...), RegressionStatement2(...), ...]

It corresponds to this figure:

a1 -> a2 -> a3 -> ... -> {middle_program} -> [right_statements]

Therefore,

  • state.left_actions: the actions that have been executed (a1, a2, a3, …).

  • state.program: the current program that is being expanded ({middle_program}).

  • state.right_statements: the statements that are waiting to be expanded ([right_statements]).

At each step,

  • If the program is empty, we will pop up the first right statement and expand it.

  • If the program is not empty, we will randomly pop a statement from the middle program, and prepend it to the right statements.

Parameters:

planning_state (_AStarNode)

evaluate(expression, state, csp=None, bounded_variables=None, clone_csp=True, force_tensor_value=False)#

Evaluate an expression and return the result.

Parameters:
Returns:

the evaluation result and the updated CSP.

Return type:

Tuple[None | StateObjectReference | StateObjectList | TensorValue | OptimisticValue, ConstraintSatisfactionProblem | None]

main()#
Return type:

Tuple[List[Tuple[CrowControllerApplier, …]], dict]

main_entry(program, minimize=None)[source]#
Parameters:
Return type:

List[Tuple[CrowControllerApplier, …]]

set_results(results)#
Parameters:

results (List[CrowPlanningResult])

Return type:

None

property domain: CrowDomain#
enable_csp: bool#

Whether to enable the CSP solver.

executor: CrowExecutor#

The executor.

goal_expr: ValueOutputExpression | None#

The goal expression. If this is None, the goal will be extracted from the behavior named ‘__goal__’.

include_dependency_trace: bool#

Whether to include the dependency graph in the search result.

include_effect_appliers: bool#

Whether to include the effect appliers in the search result.

is_goal_ordered: bool#

Whether the goal is ordered. This only takes effect when the goal is a set of AND-connected expressions.

is_goal_refinement_compressible: bool#

Whether the refinement for each component of the goal is compressible. This only takes effect when the goal is a set of AND-connected expressions.

is_goal_serializable: bool#

Whether the goal is serializable. This only takes effect when the goal is a set of AND-connected expressions.

max_csp_branching_factor: int#

The maximum CSP branching factor.

max_csp_trials: int#

The maximum number of CSP trials (for solving a single CSP).

max_global_csp_trials: int#

The maximum number of global CSP trials.

queue: PriorityQueue#
property results: List[CrowPlanningResult]#
property search_stat: dict#
simulation_interface: CrowSimulationControllerInterface | None#

The simulation interface.

state: CrowState#

The initial state.

store_generator_manager_history: bool#

Whether to store the generator manager history.

use_generator_manager: bool#

Whether to use the generator manager.

verbose: bool#

Whether to output verbose information.