add cost func declearation