added tps-cost function