Numerical solution of cohesive crack problems through optimization method