A General Maximum Principle for Optimization Problems with Operator Inequalities