optimize city pattern