def reschedule_stream_plan(evaluations, target_facts, domain, stream_results, unique_binding=False, unsatisfiable=False, max_effort=INF, planner=RESCHEDULE_PLANNER, debug=False): # TODO: search in space of partially ordered plans # TODO: constrain selection order to be alphabetical? domain.actions[:], stream_result_from_name = get_stream_actions( stream_results, unique_binding=unique_binding) goal_expression = And(*target_facts) if unsatisfiable: # TODO: ensure that the copy hasn't harmed anything goal_expression = add_unsatisfiable_to_goal(domain, goal_expression) reschedule_problem = get_problem(evaluations, goal_expression, domain, unit_costs=False) reschedule_task = task_from_domain_problem(domain, reschedule_problem) #reschedule_task.axioms = [] # TODO: ensure that the constants are added in the event that axioms are needed? sas_task = sas_from_pddl(reschedule_task) stream_names, effort = solve_from_task(sas_task, planner=planner, max_planner_time=10, max_cost=max_effort, debug=debug) if stream_names is None: return None stream_plan = [stream_result_from_name[name] for name, _ in stream_names] return stream_plan
def solve_sequential(evaluations, goal_exp, domain, unit_costs=False, debug=False, **search_args): problem = get_problem(evaluations, goal_exp, domain, unit_costs) task = task_from_domain_problem(domain, problem) if has_attachments(domain): with Verbose(debug): instantiated = instantiate_task(task) return solve_pyplanners(instantiated, **search_args) sas_task = sas_from_pddl(task, debug=debug) return abstrips_solve_from_task(sas_task, debug=debug, **search_args)
def solve_finite(evaluations, goal_exp, domain, unit_costs=False, debug=False, **search_args): if isinstance(domain, SimplifiedDomain): problem = get_problem_pddl(evaluations, goal_exp, domain.pddl) pddl_plan, cost = solve_tfd(domain.pddl, problem, debug=debug) else: problem = get_problem(evaluations, goal_exp, domain, unit_costs) task = task_from_domain_problem(domain, problem) if has_attachments(domain): with Verbose(debug): instantiated = instantiate_task(task) pddl_plan, cost = solve_pyplanners(instantiated, **search_args) else: sas_task = sas_from_pddl(task, debug=debug) pddl_plan, cost = abstrips_solve_from_task(sas_task, debug=debug, **search_args) plan = obj_from_pddl_plan(pddl_plan) return plan, cost
def solve_finite(evaluations, goal_exp, domain, unit_costs=False, debug=False, **search_args): if isinstance(domain, SimplifiedDomain): problem = get_problem_pddl(evaluations, goal_exp, domain.pddl) pddl_plan, cost = solve_tfd(domain.pddl, problem, debug=debug) else: task = task_from_domain_problem( domain, get_problem(evaluations, goal_exp, domain, unit_costs)) sas_task = sas_from_pddl(task, debug=debug) pddl_plan, cost = abstrips_solve_from_task(sas_task, debug=debug, **search_args) plan = obj_from_pddl_plan(pddl_plan) return plan, cost