Beispiel #1
0
def augment_evaluations(evaluations, future_map):
    for evaluation in list(filter(is_atom, evaluations)):
        name = evaluation.head.function
        if name in future_map:
            new_head = Head(future_map[name], evaluation.head.args)
            new_evaluation = Evaluation(new_head, evaluation.value)
            evaluations[new_evaluation] = None
Beispiel #2
0
def augment_evaluations(evaluations, future_map):
    for evaluation in list(filter(is_atom, evaluations)):
        name = evaluation.head.function
        if name in future_map:
            new_head = Head(future_map[name], evaluation.head.args)
            new_evaluation = Evaluation(new_head, evaluation.value)
            add_fact(evaluations, fact_from_evaluation(new_evaluation),
                     result=INTERNAL_EVALUATION, complexity=0)
Beispiel #3
0
def evaluation_from_fd(fd):
    if isinstance(fd, pddl.Literal):
        head = Head(fd.predicate, tuple(map(obj_from_pddl, fd.args)))
        return Evaluation(head, not fd.negated)
    if isinstance(fd, pddl.f_expression.Assign):
        raise NotImplementedError(fd)
        #head = Head(fd.fluent.symbol, tuple(map(obj_from_pddl, fd.fluent.args)))
        #return Evaluation(head, float(fd.expression.value) / get_cost_scale())  # Need to be careful due to rounding
    raise ValueError(fd)
Beispiel #4
0
def evaluation_from_fact(fact):
    prefix = get_prefix(fact)
    if prefix == EQ:
        head, value = fact[1:]
    elif prefix == NOT:
        head = fact[1]
        value = False
    else:
        head = fact
        value = True
    return Evaluation(head_from_fact(head), value)