Optimization with Temporal and Logical Specifications via Generalized Mean-based Smooth Robustness Measures