Optimization of machining parameters in multi-pass turning and milling operations