  The present paper studies a kind of robust optimization problems with
constraint. The problem is formulated through Backward Stochastic Differential
Equations (BSDEs) with quadratic generators. A necessary condition is
established for the optimal solution using a terminal perturbation method and
properties of Bounded Mean Oscillation (BMO) martingales. The necessary
condition is further proved to be sufficient for the existence of an optimal
solution under an additional convexity assumption. Finally, the optimality
condition is applied to discuss problems of partial hedging with ambiguity,
fundraising under ambiguity and randomized testing problems for a quadratic
$g$-expectation.
