An analysis of the efficiency of urban residential structure, with an application to racial integration