A general approach for automated building generation under permanent cost and quality control