def pick_from_many(self, options): options = self.remove_return_actions(options) # if there is only one options after reducing actions that take you back if len(options) == 1: return options[0] # create pddl_problem for current state problem_path = self.services.problem_generator.generate_problem( self.services.goal_tracking.uncompleted_goals[0], self.services.perception.get_state()) self.plan = make_plan(self.services.pddl.domain_path, problem_path) return self.next_step_in_plan()
def try_planner(): """ try make a plan using the default planner. :return: boolean, True if planner returned a plan """ plan = None try: plan = planner.make_plan(domain_path, problem_path) except: plan = None return plan
def initialize(self, services): self.services = services self.actions = PythonValidActions(services.parser, services.perception) self.perceiver = Perceiver(services.perception) try: filename = services.parser.problem_name + '.txt' print filename with open(filename, 'rb') as load_file: self.q_dict = pickle.load(load_file) self.task = self.execute_policy self.start_state = self.services.perception.get_state() self.sorted_keys = self.start_state.keys() self.sorted_keys.sort() except IOError: self.steps = planner.make_plan(services.pddl.domain_path, services.pddl.problem_path) self.planner = PlanDispatcher(services) self.task = self.planner.next_action
def initialize(self, services): global goals_size self.services = services is_deterministic = 1 for action in self.services.parser.task.actions: if action.effects_probs is not None: is_deterministic = 0 if is_deterministic == 1: # for planning self.steps = planner.make_plan(sys.argv[2], sys.argv[3]) else: # for learning for goal in self.services.goal_tracking.uncompleted_goals[0].parts: goals.append(goal.args) goals_size = goals_size + 1 for goal in self.services.goal_tracking.uncompleted_goals: for part in goal.parts: goals_parts.append(part.args)
def __init__(self, services): super(PlanDispatcher, self).__init__() self.steps = planner.make_plan(services.pddl.domain_path, services.pddl.problem_path)
def initialize(self,services): self.steps = planner.make_plan(services.pddl.domain_path, services.pddl.problem_path)