State discontinuity analysis of linear switched systems via energy function optimization