def partial_weight(problem, partial_tour):
    """Return weight of partial tour, excluding the edge from last to first city."""
    weight = 0
    for i in range(1, len(partial_tour)):
        weight += problem.get_weight(partial_tour[i], partial_tour[i - 1])
    return weight