Dynamic Control of Flexible Queueing Networks with Application to Shipbuilding.