An optimization approach to the identification of a system of regions