Optimization Based Domain Decomposition Methods for Linear and Nonlinear Problems