  In this paper, we consider the problem of synthesizing a controller in the
presence of uncertainty such that the resulting closed-loop system satisfies
certain hard constraints while optimizing certain (soft) performance
objectives. We assume that the hard constraints encoding safety or
mission-critical task objectives are expressed using Signal Temporal Logic
(STL), while performance is quantified using standard cost functions on system
trajectories. In order to prioritize the satisfaction of the hard STL
constraints, we utilize the framework of control barrier functions (CBFs) and
algorithmically obtain CBFs for STL objectives. We assume that the controllers
are modeled using neural networks (NNs) and provide an optimization algorithm
to learn the optimal parameters for the NN controller that optimize the
performance at a user-specified robustness margin for the safety
specifications. We use the formalism of risk measures to evaluate the risk
incurred by the trade-off between robustness margin of the system and its
performance. We demonstrate the efficacy of our approach on well-known
difficult examples for nonlinear control such as a quad-rotor and a unicycle,
where the mission objectives for each system include hard timing constraints
and safety objectives.
