Fixed loop range issue in setoptimoptions. Fixed example in minimize()'s help section.