(problem, stream_info={}, constraints=None, unit_costs=False, unit_efforts=False)
| 73 | SOLUTIONS[:] = [] |
| 74 | |
| 75 | def parse_problem(problem, stream_info={}, constraints=None, unit_costs=False, unit_efforts=False): |
| 76 | # TODO: just return the problem if already written programmatically |
| 77 | #reset_globals() # Prevents use of satisfaction.py |
| 78 | domain_pddl, constant_map, stream_pddl, stream_map, init, goal = problem |
| 79 | |
| 80 | domain = parse_domain(domain_pddl) # TODO: normalize here |
| 81 | #domain = domain_pddl |
| 82 | if len(domain.types) != 1: |
| 83 | raise NotImplementedError('Types are not currently supported') |
| 84 | if unit_costs: |
| 85 | set_unit_costs(domain) |
| 86 | if not has_costs(domain): |
| 87 | # TODO: set effort_weight to 1 if no costs |
| 88 | print('Warning! All actions have no cost. Recommend setting unit_costs=True') |
| 89 | obj_from_constant = parse_constants(domain, constant_map) # Keep before parse_stream_pddl |
| 90 | |
| 91 | streams = parse_stream_pddl(stream_pddl, stream_map, stream_info=stream_info, |
| 92 | unit_costs=unit_costs, unit_efforts=unit_efforts) |
| 93 | check_problem(domain, streams, obj_from_constant) |
| 94 | |
| 95 | evaluations = evaluations_from_init(init) |
| 96 | goal_exp = obj_from_value_expression(goal) |
| 97 | |
| 98 | if isinstance(domain, SimplifiedDomain): |
| 99 | #assert isinstance(domain, str) # raw PDDL is returned |
| 100 | _ = {name: Object(value, name=name) for name, value in constant_map.items()} |
| 101 | return evaluations, goal_exp, domain, streams |
| 102 | |
| 103 | goal_exp = add_plan_constraints(constraints, domain, evaluations, goal_exp) |
| 104 | parse_goal(goal_exp, domain) # Just to check that it parses |
| 105 | normalize_domain_goal(domain, goal_exp) # TODO: does not normalize goal_exp |
| 106 | |
| 107 | compile_to_exogenous(evaluations, domain, streams) |
| 108 | return evaluations, goal_exp, domain, streams |
| 109 | |
| 110 | ################################################## |
| 111 |
nothing calls this directly
no test coverage detected