Dynamic Model of Optimal Age Polyethism in Social Insects under Stable and Fluctuating Environments