Optimal control applied in automatic clutch engagements of vehicles