Constrained optimization and image space analysis. Vol. 1. Separation of sets and optimality conditions