Application of optimal control theory to milling process