Physics-informed machine learning and stray field computation with application to micromagnetic energy minimization