@rhamphorhynchus @TazPoltorak afaik there is, and it is an hard problem
valentina (valentinaproject.bitbucket.io/) has a layout tool that iirc was designed to be usable for both laying the pieces on paper to be printed and to do the layout for fabric, but in some cases I've been able to get a more efficient design myself by hand :(
afaik commercial pattern CAD programs, that are definitely not cheap, also come with a layout program, and it's a pretty important part of the suite