Added gradients to many niching functions.