cost function

cost function