結果 : how to develop a cost function