AI learns physics to optimize particle accelerator performance