Optimal task sequencing with precedence constraints