Add cost function metrics to metrics.weighted_undirected.py