Variational problems with a free discontinuity set