A numerical algorithm for the solution of product-form models with infinite state spaces