Added a specialized template function for BOBYQA in Trainer