コード例 #1
0
    recurse(goal)
    cut_hmax, cut = hmax(task, goal_plateau)
    assert cut_hmax == infinity, "did not extract a landmark!"
    return cut


def additive_hmax(task):
    MULTIPLIER = 1
    result = 0
    for action in task.actions:
        action.cost *= MULTIPLIER
    while True:
        cost, _ = hmax(task)
        if cost == 0:
            break
        result += 1
        cut = collect_cut(task)
        for action in cut:
            assert action.cost >= 1
            action.cost -= 1
    return (result + MULTIPLIER - 1) // MULTIPLIER


if __name__ == "__main__":
    task = pddl.open()
    relaxed_task = relaxed_tasks.build_relaxed_task(task)
    relaxed_task.convert_to_canonical_form()
    crossreference_task(relaxed_task)
    # relaxed_task.dump()
    print(additive_hmax(relaxed_task))
コード例 #2
0
ファイル: additive-hmax.py プロジェクト: herry13/fdt
    recurse(goal)
    cut_hmax, cut = hmax(task, goal_plateau)
    assert cut_hmax == infinity, "did not extract a landmark!"
    return cut


def additive_hmax(task):
    MULTIPLIER = 1
    result = 0
    for action in task.actions:
        action.cost *= MULTIPLIER
    while True:
        cost, _ = hmax(task)
        if cost == 0:
            break
        result += 1
        cut = collect_cut(task)
        for action in cut:
            assert action.cost >= 1
            action.cost -= 1
    return (result + MULTIPLIER - 1) // MULTIPLIER


if __name__ == "__main__":
    task = pddl.open()
    relaxed_task = relaxed_tasks.build_relaxed_task(task)
    relaxed_task.convert_to_canonical_form()
    crossreference_task(relaxed_task)
    # relaxed_task.dump()
    print(additive_hmax(relaxed_task))