# Path: misc/numerical.py
# INF = float('inf')


from collections import defaultdict, namedtuple
from heapq import heappush, heappop
from misc.numerical import INF
            # Only computes costs for relevant operators
            if (effect in unprocessed) and (effect not in literal_costs or
                                            (literal_cost < literal_costs[effect].cost)):
                literal_costs[effect] = Pair(literal_cost, literal_level)
                heappush(queue, (literal_cost, effect))
        return False

    for operator in unsatisfied:
        if unsatisfied[operator] == 0:
            process_operator(operator)
    while queue:
        _, literal = heappop(queue)
        if literal not in unprocessed:
            continue
        for operator in unprocessed[literal]:
            unsatisfied[operator] -= 1
            if unsatisfied[operator] == 0:
                process_operator(operator)
        del unprocessed[literal]

    return literal_costs, operator_costs

###########################################################################

def h_add(state, goal, operators):
    _, operator_costs = compute_costs(state, goal, operators, op=sum)
    return operator_costs[goal].cost if goal in operator_costs else INF

def h_max(state, goal, operators):
    _, operator_costs = compute_costs(state, goal, operators, op=max)

# Path: misc/numerical.py
# INF = float('inf')


# Path: strips/hsp.py
from collections import defaultdict, namedtuple
from heapq import heappush, heappop
from misc.numerical import INF

            # Only computes costs for relevant operators
            if (effect in unprocessed) and (effect not in literal_costs or
                                            (literal_cost < literal_costs[effect].cost)):
                literal_costs[effect] = Pair(literal_cost, literal_level)
                heappush(queue, (literal_cost, effect))
        return False

    for operator in unsatisfied:
        if unsatisfied[operator] == 0:
            process_operator(operator)
    while queue:
        _, literal = heappop(queue)
        if literal not in unprocessed:
            continue
        for operator in unprocessed[literal]:
            unsatisfied[operator] -= 1
            if unsatisfied[operator] == 0:
                process_operator(operator)
        del unprocessed[literal]

    return literal_costs, operator_costs

###########################################################################

def h_add(state, goal, operators):
    _, operator_costs = compute_costs(state, goal, operators, op=sum)
    return operator_costs[goal].cost if goal in operator_costs else INF

def h_max(state, goal, operators):
    _, operator_costs = compute_costs(state, goal, operators, op=max)

    return operator_costs[goal].cost if goal in operator_costs else INF