Пример #1
0
 def mapping(self):
     if self._mapping is None:
         self._mapping = get_mapping(self.external.inputs,
                                     self.input_objects)
         for constant in self.external.constants:
             self._mapping[constant] = Object.from_name(constant)
     return self._mapping
Пример #2
0
def obj_from_pddl(pddl):
    if pddl in Object._obj_from_name:
        return Object.from_name(pddl)
    elif pddl in OptimisticObject._obj_from_name:
        return OptimisticObject.from_name(pddl)
    else:
        raise ValueError(pddl)
Пример #3
0
 def __init__(self, external, input_objects):
     self.external = external
     self.input_objects = tuple(input_objects)
     self.enumerated = False
     self.disabled = False
     self.opt_index = 0
     self.results_history = []
     self.mapping = dict(zip(self.external.inputs, self.input_objects))
     for constant in self.external.constants:
         self.mapping[constant] = Object.from_name(constant)
     self.domain = substitute_expression(self.external.domain,
                                         self.get_mapping())
Пример #4
0
def convert_constants(fact):
    # TODO: take the constant map as an input
    # TODO: throw an error if undefined
    return Fact(get_prefix(fact), [
        p if is_parameter(p) else Object.from_name(p) for p in get_args(fact)
    ])