cost minimzation problem