A variational form of the equivalent inclusion method for numerical homogenization