def set_savings (problem, alpha=0.3):
    """
    This method calculate the saving of edges according to the given alpha.

    NOTE: Edges are modified in place.

    :param problem: The instance of the problem to solve.
    :param alpha: The alpha parameter of the PJS.
    :return: The problem instance modified in place.
    """
    dists, depot = problem.dists, problem.depot
    for edge in problem.edges:
        cost, inode, jnode = edge.cost, edge.inode, edge.jnode
        revenue = inode.revenue + jnode.revenue
        edge.savings = {
            source.id : (1.0 - alpha)*(dists[inode.id, depot.id] + dists[source.id, jnode.id] - cost) + alpha*revenue
        for source in problem.sources}
    return problem