concepts.dm.crow.planners.regression_planning_impl.crow_regression_planner_iddfs_v1.CrowRegressionPlannerIDDFSv1#
- class CrowRegressionPlannerIDDFSv1[source]#
Bases:
CrowRegressionPlanner
Methods
dfs
(planning_state, depth)The main entry of the depth-first search.
dfs_impl
(planning_state, depth)The actual implementation of the depth-first search.
dfs_inner
(planning_state, stmt, ...)evaluate
(expression, state[, csp, ...])Evaluate an expression and return the result.
hash_state
(planning_state)hash_state_human
(planning_state)Hash the planning state for human-readable output.
main
()main_entry
(program)set_results
(results)Attributes
Whether to always commit the skeleton of the program.
The minimum search depth.
Whether to include the effect appliers in the search result.
- __init__(executor, state, goal_expr, *, simulation_interface=None, enable_reordering=True, min_search_depth=5, max_search_depth=20, max_beam_size=20, always_commit_skeleton=True, is_goal_ordered=False, is_goal_serializable=False, is_goal_refinement_compressible=True, enable_csp=True, max_csp_trials=10, max_global_csp_trials=100, max_csp_branching_factor=5, use_generator_manager=False, store_generator_manager_history=False, include_effect_appliers=False, include_dependency_trace=False, verbose=False)[source]#
Initialize the planner.
- Parameters:
executor (CrowExecutor) – the executor.
state (CrowState) – the initial state.
goal_expr (str | ValueOutputExpression) – the goal expression.
simulation_interface (CrowSimulationControllerInterface | None) – the simulation interface.
enable_reordering (bool) – whether to enable reordering.
max_search_depth (int) – the maximum search depth.
max_beam_size (int) – the maximum beam size.
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.
min_search_depth (int)
always_commit_skeleton (bool)
- __new__(**kwargs)#
- dfs(planning_state, depth)[source]#
The main entry of the depth-first search. This function is a generator of possible planning results. Internally, it calls
dfs_impl()
to perform the actual search but wraps around it to handle visited states (so that we can avoid redundant search).- Parameters:
planning_state (CrowPlanningState3) – the current planning state.
depth (int) – the current search depth.
- Return type:
- dfs_impl(planning_state, depth)[source]#
The actual implementation of the depth-first search. This function is a generator of possible planning results.
- Parameters:
planning_state (CrowPlanningState3) – the current planning state.
depth (int) – the current search depth.
- Return type:
- dfs_inner(planning_state, stmt, middle_program, scope_id, depth)[source]#
- Parameters:
planning_state (CrowPlanningState3)
stmt (CrowBehaviorOrderingSuite | CrowBehaviorForeachLoopSuite | CrowBehaviorWhileLoopSuite | CrowBehaviorConditionSuite | CrowBindExpression | CrowAssertExpression | CrowRuntimeAssignmentExpression | CrowControllerApplicationExpression | CrowAchieveExpression | CrowUntrackExpression | CrowBehaviorApplicationExpression | CrowBehaviorEffectApplicationExpression | CrowBehaviorCommit)
middle_program (CrowBehaviorOrderingSuite | None)
scope_id (int)
depth (int)
- Return type:
- evaluate(expression, state, csp=None, bounded_variables=None, clone_csp=True, force_tensor_value=False)#
Evaluate an expression and return the result.
- Parameters:
expression (ObjectOrValueOutputExpression | VariableAssignmentExpression) – the expression to evaluate.
state (CrowState) – the current state.
csp (ConstraintSatisfactionProblem | None) – the current CSP.
bounded_variables (Dict[str, TensorValue | ObjectConstant] | None) – the bounded variables.
clone_csp (bool) – whether to clone the CSP.
force_tensor_value (bool) – whether to force the result to be a tensor value.
- Returns:
the evaluation result and the updated CSP.
- Return type:
Tuple[None | StateObjectReference | StateObjectList | TensorValue | OptimisticValue, ConstraintSatisfactionProblem | None]
- hash_state(planning_state)[source]#
- Parameters:
planning_state (CrowPlanningState3)
- Return type:
- hash_state_human(planning_state)[source]#
Hash the planning state for human-readable output. Note that this function is not toally consistent with hash_state. This function is a “stronger” version of hash_state. For example, the following two states with different hash_state corresponds to the same human-readable hash.
State1:
unordered{ achieve@4 clear(V::x) } Scopes: 0: {} 1: {} 2: {'x': ObjectConstant<A: block>, 'y': ObjectConstant<B: block>} 3: {'x': ObjectConstant<B: block>, 'y': ObjectConstant<C: block>} 4: {'x': ObjectConstant<B: block>}
State2:
unordered{ achieve@2 clear(V::y) } Scopes: 0: {} 1: {} 2: {'x': ObjectConstant<A: block>, 'y': ObjectConstant<B: block>} 3: {'x': ObjectConstant<B: block>, 'y': ObjectConstant<C: block>} 4: {'x': ObjectConstant<B: block>}
- Parameters:
planning_state (CrowPlanningState3) – the planning state to hash.
- Returns:
the hash of the planning state. It is a tuple of strings.
- Return type:
- main_entry(program)[source]#
- Parameters:
program (CrowBehaviorOrderingSuite)
- Return type:
- set_enable_human_control_interface(human_control_interface=True)[source]#
- Parameters:
human_control_interface (bool)
- set_enable_visited_states_count(enable_visited_states_count=True)[source]#
- Parameters:
enable_visited_states_count (bool)
- set_results(results)#
- Parameters:
results (List[CrowPlanningResult])
- Return type:
None
- property domain: CrowDomain#
- include_effect_appliers: bool#
Whether to include the effect appliers in the search result. The effect appliers are of type
CrowEffectApplier
.
- property results: List[CrowPlanningResult]#