objective function for horizontal and vertical