Unless utility functions are logarithmic or posed problems are single-period, it is very difficult to explicitly solve constrained optimal portfolio problems. This paper proposes a new numerical method for solving the multiple-period constrained optimal portfolio problems. This method combines an asymptotic expansion method applied to the optimal portfolio problem in complete markets by Takahashi and Yoshida (2004. Statistical Inference for Stochastic Processes, 7(2), 153–188), a technique of reformulating the multiple-period constrained optimal portfolio problem into a corresponding backward stochastic differential equation by Hu et al. (2005. The Annals of Applied Probability, 15(3), 1691–1712), and a method for solving the backward stochastic differential equation using machine learning by E et al. (2017. Communications in Mathematics and Statistics, 5(4), 349–380) and Han et al. (2018. Proceedings of the National Academy of Sciences, 115(34), 8505–8510). It is essential to decompose the backward stochastic differential equation into parts involving with the unconstrained optimal portfolio problems and the remainder. Numerical simulations suggest that the proposed method may outperform conventional methods such as E et al. (2017. Communications in Mathematics and Statistics, 5(4), 349–380) and Han et al. (2018. Proceedings of the National Academy of Sciences, 115(34), 8505–8510) in estimating the multiple-period constrained optimal portfolios.