Non-Linear Counterfactual Aggregate Optimization