MCPcopy Create free account
hub / github.com/caelan/pddlstream / parse_problem

Function parse_problem

pddlstream/algorithms/algorithm.py:75–108  ·  view source on GitHub ↗
(problem, stream_info={}, constraints=None, unit_costs=False, unit_efforts=False)

Source from the content-addressed store, hash-verified

73 SOLUTIONS[:] = []
74
75def 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

Callers

nothing calls this directly

Calls 13

parse_domainFunction · 0.90
set_unit_costsFunction · 0.90
has_costsFunction · 0.90
evaluations_from_initFunction · 0.90
ObjectClass · 0.90
add_plan_constraintsFunction · 0.90
parse_goalFunction · 0.90
normalize_domain_goalFunction · 0.90
compile_to_exogenousFunction · 0.90
parse_constantsFunction · 0.85
parse_stream_pddlFunction · 0.85

Tested by

no test coverage detected