Evolution of the ISM in luminous infrared galaxies