示例#1
0
def get_generator(initial, goal, oracle, planner):
  if planner == MANIPULATION_PLANNERS.FFROB:
    return ffrob_generator(initial, goal, oracle)
  if planner == MANIPULATION_PLANNERS.TRAJECTORY_HBF:
    return default_scheduler_generator(goal, lambda rg: TrajectoryScheduler(rg, oracle))
  if planner == MANIPULATION_PLANNERS.ROADMAP_HBF:
    return default_scheduler_generator(goal, lambda rg: RoadmapScheduler(rg, oracle))
  if planner == MANIPULATION_PLANNERS.HBF:
    return default_scheduler_generator(goal, lambda rg: GeneratingScheduler(rg, [SP(oracle) for SP in USE_SUBPLANNERS]))
  if planner == MANIPULATION_PLANNERS.RMMP:
    return pick_and_place_generator(initial, goal, oracle)
  raise RuntimeError(planner + ' is not a valid manipulation planner')
示例#2
0
def solve(problem_name, print_profile=False):
  dt = datetime.datetime.now()
  directory = './simulations/discrete/planning/{}/{}/{}/'.format(problem_name, dt.strftime('%Y-%m-%d'), dt.strftime('%H-%M-%S'))
  start, goal, Scheduler = getattr(problems, problem_name)()
  generator = default_scheduler_generator(goal, Scheduler)

  print SEPARATOR + '\nSolving planning problem ' + problem_name

  def execute():
    output = default_plan(start, goal, generator)
    make_dir(directory)
    print 'Created directory:', directory
    return output

  (plan_data, search_data), profile_output = profile(execute, filename=directory+'profile')
  print 'Wrote', directory+'profile'
  print SEPARATOR

  if plan_data is None:
    data = str_line('Could not find plan\n')
  else:
    data = str(plan_data)
  data += '\n' + str(search_data)
  print data
  write(directory + 'planner_statistics', data)
  print 'Wrote', directory+'planner_statistics'

  if print_profile:
    print SEPARATOR
    print profile_output
  print SEPARATOR
def solve(problem_name, print_profile=False):
  dt = datetime.datetime.now()
  directory = './simulations/discrete/planning/{}/{}/{}/'.format(problem_name, dt.strftime('%Y-%m-%d'), dt.strftime('%H-%M-%S'))
  start, goal, Scheduler = getattr(problems, problem_name)()
  generator = default_scheduler_generator(goal, Scheduler)

  print SEPARATOR + '\nSolving planning problem ' + problem_name

  def execute():
    output = default_plan(start, goal, generator)
    make_dir(directory)
    print 'Created directory:', directory
    return output

  (plan_data, search_data), profile_output = profile(execute, filename=directory+'profile')
  print 'Wrote', directory+'profile'
  print SEPARATOR

  if plan_data is None:
    data = str_line('Could not find plan\n')
  else:
    data = str(plan_data)
  data += '\n' + str(search_data)
  print data
  write(directory + 'planner_statistics', data)
  print 'Wrote', directory+'planner_statistics'

  if print_profile:
    print SEPARATOR
    print profile_output
  print SEPARATOR