Optimal Estimation of Generalized Average Treatment Effects using Kernel Optimal Matching