Determining appropriate cost functions