An algorithm for the two-dimensional assortment problem