Deep Learning Method for Partial Differential Equations and Optimal Problems