Adaptive dynamics: theory and applications