Maintenance optimization in a digital twin for Industry 4.0