Machine learning to optimize isolation criteria for leptons/photons in the hardware trigger at the LHC/CMS