A Merit Function for Automated Mirror Design