The design of various conventional dairy barns is based on centuries of experience, but there is hardly any experience with robotic milking barns (RMB). Furthermore, as each farmer has his own management practices, the optimal layout is 'site dependent'. A new universally applicable design methodology has been developed, to overcome this lack of experience with RMBs and to facilitate the designing of their optimal layout. This model for optimizing facility allocation, based on cow behaviour, welfare needs, and facility utilization, uses queuing network theory, Markov process, and heuristic optimization. The methodology has been programmed into a software application, supporting the design process. On a particular farm, presented later as a case study, numerical results include: if the herd contains more than 50 cows, the forage-lane utilization is greater than 70% (or idle time is less than 30%). To meet animal-welfare demands, the herd size should not exceed 60 cows. Therefore, the herd should comprise 50-60 cows. In the second scenario examined, the average robot idle time was 25%, queue length was three cows, and each cow waited for about 3 min at the robot. It is still uncommon to apply techniques from queuing-network theory to livestock housing, and this study demonstrates their potential as practical design tools that meet both economic and animal welfare needs. #