Determination of residual stresses and material properties by an energy-based method using artificial neural networks