Duality Theory and Optimality Conditions for Generalized Complementary Problems