Optimized synthesis of wave-manipulating devices within the system-by-design paradigm