def create_D_matrix(cost_matrix, pi_vector_new):
    """
    According to the paper, transofrmation into the D matrix significantly improves the approximation.
    D[i][j] = cost_matrix[i][j] + pi[i]+pi[j], where pi is a vector.
    pi^(k+1) = pi^k + t^k*v^k

    The aim is now to find a transformation C->D, given by the vector pi = (pi1, pi2, ..., pin), that maximizes the lower bound
    w(pi)=L(Tn) - 2*sum(pii).
    Args:
        cost_matrix (2d np. array):

    Returns:
    Transformed cost matrix into D_matrix (2d np.array).
    """
    nodes_count = len(cost_matrix)
    for row in range(nodes_count):
        for col in range(nodes_count):
            cost_matrix[row][col] = cost_matrix[row][col] + pi_vector_new[row
                ] + pi_vector_new[col]
    return cost_matrix
