send reg cost function.