Optimality and invexity in optimization problems in Banach algebras (spaces)