Optimization of time-varying multi-variable couplings for enhanced synchronization in complex networks