This paper deals with the intra-cell machines layout problem, an intermediate step of the workshop design. In this workshop, the production systems belong to a specific class: the flexible manufacturing systems (FMS). The problem consists in finding a positioning of machines in a given manufacturing cell that is the most appropriate for the production process and that optimizes the criterion chosen for minimizing the distances between machines and so minimizing the total transportation time. This problem has been solved in the literature by developing heuristics based on the simulating annealing approach. In order to avoid the problems confronted by some authors, consisting of redefining all the parameters each time, the problem is changed. A generic method is determined by mathematically formulating the machine layout problem. Thus, when it is linear, the problem is solved by CPLEX and the optimal solution is given within a few seconds. When the configuration of the transport system leads to a non-linear problem, it is solved using an enumerative algorithm. In the literature, some restrictive hypotheses were set when solving the machine layout problem. In fact, the operating sequences were supposed to be linear and only one exemplar of each transformation resource was considered. In this paper three kinds of flexibility are introduced: multiplicity of the transformation resources, flexibility of the operating sequences and installation of a shortcut in the manufacturing cell. The method given here is used to solve the machine layout problem when taking flexibility into consideration. After proving that introducing flexibility in the production or the transport system increases the non-linearity of the problem, the algorithm developed to solve an illustrative example of a cell containing identical machines is described. The considered resources perform different part types having flexible operating sequences. To join distant machines, a shortcut was installed in the cell. Based on an enumerative method, the algorithm provides an optimal solution within a few seconds. The ability to solve the problem using an enumerative method and to obtain an optimal solution in a reasonable time is due to the fact that the step consisting of positioning the machines comes after the step of grouping machines into cells, so the number of machines in each cell is small enough to use the enumeration.