Variational approximation of anisotropic functionals on partitions