def h3(solution, option):
    """ Measures weight of MST, ignoring weight of already-cleared roads """
    s = solution.step(option)
    v = s.vertices
    e = s.edges
    c = s.decisions

    [cc.clear() for cc in c]
    e_mst = mst(v, e)
    result = sum([e.weight for e in e_mst])
    [cc.restore() for cc in c]

    return result
def h4(solution, option):
    """ Combined weight of shortest path between supply and node * demand of node """
    s = solution.step(option)
    v = s.vertices
    e = s.edges
    c = s.decisions

    #XXX generalize to many supplies
    [cc.clear() for cc in c]
    e_mst = mst(v, e)
    paths = dijkstra(v, e_mst, s.supplies[0])
    result = sum([v[i].demand * paths[i] for i in range(len(v))])
    [cc.restore() for cc in c]

    return result