Machine learning, neural networks, and metaheuristic algorithms are relatively new subjects, closely related to each other: learning is somehow an intrinsic part of all of them. On the other hand, cell formation (CF) and facility layout design are the two fundamental steps in the CMS implementation. To get a successful CMS design, addressing the interrelated decisions simultaneously is important. In this article, a new nonlinear mixed-integer programming model is presented which comprehensively considers solving the integrated dynamic cell formation and inter/intracell layouts in continuous space. In the proposed model, cells are configured in flexible shapes during the planning horizon considering cell capacity in each period. This study considers the exact information about facility layout design and material handling cost. The proposed model is an NP-hard mixed-integer nonlinear programming model. To optimize the proposed problem, first, three metaheuristic algorithms, that is, Genetic Algorithm (GA), Keshtel Algorithm (KA), and Red Deer Algorithm (RDA), are employed. Then, to further improve the quality of the solutions, using machine learning approaches and combining the results of the aforementioned algorithms, a new metaheuristic algorithm is proposed. Numerical examples, sensitivity analyses, and comparisons of the performances of the algorithms are conducted.